Commit 51ddd6ff authored by unknown's avatar unknown

Bug #19202 Incorrect errorhandling in select count(*) wrt temporary error

- added retry handling of temporary transaction errors

parent c0c6461a
...@@ -5650,12 +5650,24 @@ ndb_get_table_statistics(Ndb* ndb, const char * table, ...@@ -5650,12 +5650,24 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
{ {
DBUG_ENTER("ndb_get_table_statistics"); DBUG_ENTER("ndb_get_table_statistics");
DBUG_PRINT("enter", ("table: %s", table)); DBUG_PRINT("enter", ("table: %s", table));
NdbTransaction* pTrans= ndb->startTransaction(); NdbTransaction* pTrans;
do int retries= 10;
int retry_sleep= 30 * 1000; /* 30 milliseconds */
do
{ {
pTrans= ndb->startTransaction();
if (pTrans == NULL) if (pTrans == NULL)
{
if (ndb->getNdbError().status == NdbError::TemporaryError &&
retries--)
{
my_sleep(retry_sleep);
continue;
}
break; break;
}
NdbScanOperation* pOp= pTrans->getNdbScanOperation(table); NdbScanOperation* pOp= pTrans->getNdbScanOperation(table);
if (pOp == NULL) if (pOp == NULL)
break; break;
...@@ -5678,8 +5690,18 @@ ndb_get_table_statistics(Ndb* ndb, const char * table, ...@@ -5678,8 +5690,18 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
NdbTransaction::AbortOnError, NdbTransaction::AbortOnError,
TRUE); TRUE);
if (check == -1) if (check == -1)
{
if (pTrans->getNdbError().status == NdbError::TemporaryError &&
retries--)
{
ndb->closeTransaction(pTrans);
pTrans= 0;
my_sleep(retry_sleep);
continue;
}
break; break;
}
Uint32 count= 0; Uint32 count= 0;
Uint64 sum_rows= 0; Uint64 sum_rows= 0;
Uint64 sum_commits= 0; Uint64 sum_commits= 0;
...@@ -5713,7 +5735,7 @@ ndb_get_table_statistics(Ndb* ndb, const char * table, ...@@ -5713,7 +5735,7 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
sum_mem, count)); sum_mem, count));
DBUG_RETURN(0); DBUG_RETURN(0);
} while (0); } while(1);
if (pTrans) if (pTrans)
ndb->closeTransaction(pTrans); ndb->closeTransaction(pTrans);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment