List:Commits« Previous MessageNext Message »
From:tomas Date:July 7 2006 10:46am
Subject:bk commit into 5.1 tree (tomas:1.2034) BUG#19202
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2034 06/07/07 12:46:17 tomas@stripped +2 -0
  Bug #19202  	Incorrect errorhandling in select count(*) wrt temporary error

  sql/ha_ndbcluster.cc
    1.247 06/07/07 12:46:03 tomas@stripped +65 -30
    Bug #19202  	Incorrect errorhandling in select count(*) wrt temporary error

  mysql-test/r/ndb_multi.result
    1.8 06/07/07 12:46:03 tomas@stripped +1 -0
    Bug #19202  	Incorrect errorhandling in select count(*) wrt temporary error

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/wl2325-alcatel

--- 1.246/sql/ha_ndbcluster.cc	2006-06-28 16:40:13 +02:00
+++ 1.247/sql/ha_ndbcluster.cc	2006-07-07 12:46:03 +02:00
@@ -479,6 +479,7 @@
   {
     Ndb *ndb= get_ndb();
     struct Ndb_statistics stat;
+    ndb->setDatabaseName(m_dbname);
     if (ndb_get_table_statistics(ndb, m_tabname, &stat) == 0){
       mean_rec_length= stat.row_size;
       data_file_length= stat.fragment_memory;
@@ -3127,6 +3128,7 @@
         DBUG_VOID_RETURN;
       Ndb *ndb= get_ndb();
       struct Ndb_statistics stat;
+      ndb->setDatabaseName(m_dbname);
       if (current_thd->variables.ndb_use_exact_count &&
           ndb_get_table_statistics(ndb, m_tabname, &stat) == 0)
       {
@@ -6561,40 +6563,61 @@
 {
   DBUG_ENTER("ndb_get_table_statistics");
   DBUG_PRINT("enter", ("table: %s", table));
-  NdbTransaction* pTrans= ndb->startTransaction();
-  if (pTrans == NULL)
-    ERR_RETURN(ndb->getNdbError());
-  do 
+  NdbTransaction* pTrans;
+  NdbError error;
+  int retries= 10;
+  int retry_sleep= 30 * 1000; /* 30 milliseconds */
+
+  do
   {
-    NdbScanOperation* pOp= pTrans->getNdbScanOperation(table);
-    if (pOp == NULL)
-      break;
+    Uint64 rows, commits, mem;
+    Uint32 size;
+    Uint32 count= 0;
+    Uint64 sum_rows= 0;
+    Uint64 sum_commits= 0;
+    Uint64 sum_row_size= 0;
+    Uint64 sum_mem= 0;
+    NdbScanOperation*pOp;
+    NdbResultSet *rs;
+    int check;
+
+    if ((pTrans= ndb->startTransaction()) == NULL)
+    {
+      error= ndb->getNdbError();
+      goto retry;
+    }
+      
+    if ((pOp= pTrans->getNdbScanOperation(table)) == NULL)
+    {
+      error= pTrans->getNdbError();
+      goto retry;
+    }
     
     if (pOp->readTuples(NdbOperation::LM_CommittedRead))
-      break;
+    {
+      error= pOp->getNdbError();
+      goto retry;
+    }
     
-    int check= pOp->interpret_exit_last_row();
-    if (check == -1)
-      break;
+    if (pOp->interpret_exit_last_row() == -1)
+    {
+      error= pOp->getNdbError();
+      goto retry;
+    }
     
-    Uint64 rows, commits, mem;
-    Uint32 size;
     pOp->getValue(NdbDictionary::Column::ROW_COUNT, (char*)&rows);
     pOp->getValue(NdbDictionary::Column::COMMIT_COUNT, (char*)&commits);
     pOp->getValue(NdbDictionary::Column::ROW_SIZE, (char*)&size);
     pOp->getValue(NdbDictionary::Column::FRAGMENT_MEMORY, (char*)&mem);
     
-    check= pTrans->execute(NdbTransaction::NoCommit,
-                           NdbTransaction::AbortOnError,
-                           TRUE);
-    if (check == -1)
-      break;
+    if (pTrans->execute(NdbTransaction::NoCommit,
+                        NdbTransaction::AbortOnError,
+                        TRUE) == -1)
+    {
+      error= pTrans->getNdbError();
+      goto retry;
+    }
     
-    Uint32 count= 0;
-    Uint64 sum_rows= 0;
-    Uint64 sum_commits= 0;
-    Uint64 sum_row_size= 0;
-    Uint64 sum_mem= 0;
     while ((check= pOp->nextResult(TRUE, TRUE)) == 0)
     {
       sum_rows+= rows;
@@ -6606,7 +6629,10 @@
     }
     
     if (check == -1)
-      break;
+    {
+      error= pOp->getNdbError();
+      goto retry;
+    }
 
     pOp->close(TRUE);
 
@@ -6623,12 +6649,21 @@
                         sum_mem, count));
 
     DBUG_RETURN(0);
-  } while (0);
-
-  if (pTrans)
-    ndb->closeTransaction(pTrans);
-  DBUG_PRINT("exit", ("failed"));
-  DBUG_RETURN(-1);
+retry:
+    if (pTrans)
+    {
+      ndb->closeTransaction(pTrans);
+      pTrans= NULL;
+    }
+    if (error.status == NdbError::TemporaryError && retries--)
+    {
+      my_sleep(retry_sleep);
+      continue;
+    }
+    break;
+  } while(1);
+  DBUG_PRINT("exit", ("failed, error %u(%s)", error.code, error.message));
+  ERR_RETURN(error);
 }
 
 /*

--- 1.7/mysql-test/r/ndb_multi.result	2005-10-20 22:48:14 +02:00
+++ 1.8/mysql-test/r/ndb_multi.result	2006-07-07 12:46:03 +02:00
@@ -34,6 +34,7 @@
 show warnings;
 Level	Code	Message
 Error	1296	Got error 241 'Invalid schema object version' from NDB
+Error	1296	Got error 241 'Invalid schema object version' from NDB
 Error	1412	Table definition has changed, please retry transaction
 Error	1105	Unknown error
 select * from t1;
Thread
bk commit into 5.1 tree (tomas:1.2034) BUG#19202tomas7 Jul