List:Commits« Previous MessageNext Message »
From:tomas Date:June 29 2006 9:25pm
Subject:bk commit into 5.1 tree (tomas:1.2223)
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.2223 06/06/29 21:25:37 tomas@stripped +1 -0
  manual merge

  sql/ha_ndbcluster.cc
    1.345 06/06/29 21:25:23 tomas@stripped +1 -2
    manual merge

# 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/mysql-5.1-new-ndb/RESYNC

--- 1.344/sql/ha_ndbcluster.cc	2006-06-29 14:23:40 +02:00
+++ 1.345/sql/ha_ndbcluster.cc	2006-06-29 21:25:23 +02:00
@@ -457,8 +457,8 @@
   //  if (info->records == ~(ha_rows)0)
   {
     Ndb *ndb= get_ndb();
-    ndb->setDatabaseName(m_dbname);
     struct Ndb_statistics stat;
+    ndb->setDatabaseName(m_dbname);
     if (ndb_get_table_statistics(ndb, m_table, &stat) == 0)
     {
       stats.mean_rec_length= stat.row_size;
@@ -3594,6 +3594,7 @@
       Ndb *ndb= get_ndb();
       ndb->setDatabaseName(m_dbname);
       struct Ndb_statistics stat;
+      ndb->setDatabaseName(m_dbname);
       if (current_thd->variables.ndb_use_exact_count &&
           ndb_get_table_statistics(ndb, m_table, &stat) == 0)
       {
@@ -7403,6 +7404,7 @@
   DBUG_ENTER("ndb_get_table_statistics");
   DBUG_PRINT("enter", ("table: %s", ndbtab->getName()));
   NdbTransaction* pTrans;
+  NdbError error;
   int retries= 10;
   int retry_sleep= 30 * 1000; /* 30 milliseconds */
 
@@ -7410,57 +7412,51 @@
 
   do
   {
-    pTrans= ndb->startTransaction();
-    if (pTrans == NULL)
+    Uint64 rows, commits, mem;
+    Uint32 size;
+    Uint64 sum_rows= 0;
+    Uint64 sum_commits= 0;
+    NdbScanOperation*pOp;
+    NdbResultSet *rs;
+    int check;
+
+    if ((pTrans= ndb->startTransaction()) == NULL)
     {
-      if (ndb->getNdbError().status == NdbError::TemporaryError &&
-          retries--)
-      {
-        my_sleep(retry_sleep);
-        continue;
-      }
-      ERR_RETURN(ndb->getNdbError());
+      error= ndb->getNdbError();
+      goto retry;
+    }
+      
+    if ((pOp= pTrans->getNdbScanOperation(ndbtab)) == NULL)
+    {
+      error= pTrans->getNdbError();
+      goto retry;
     }
-
-    NdbScanOperation* pOp= pTrans->getNdbScanOperation(ndbtab);
-    if (pOp == NULL)
-      break;
     
     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)
+    if (pTrans->execute(NdbTransaction::NoCommit,
+                        NdbTransaction::AbortOnError,
+                        TRUE) == -1)
     {
-      if (pTrans->getNdbError().status == NdbError::TemporaryError &&
-          retries--)
-      {
-        ndb->closeTransaction(pTrans);
-        pTrans= 0;
-        my_sleep(retry_sleep);
-        continue;
-      }
-      break;
+      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;
@@ -7472,7 +7468,10 @@
     }
     
     if (check == -1)
-      break;
+    {
+      error= pOp->getNdbError();
+      goto retry;
+    }
 
     pOp->close(TRUE);
 
@@ -7489,12 +7488,21 @@
                         sum_mem, count));
 
     DBUG_RETURN(0);
+retry:
+    if (pTrans)
+    {
+      ndb->closeTransaction(pTrans);
+      pTrans= NULL;
+    }
+    if (error.status == NdbError::TemporaryError && retries--)
+    {
+      my_sleep(retry_sleep);
+      continue;
+    }
+    break;
   } while(1);
-
-  if (pTrans)
-    ndb->closeTransaction(pTrans);
-  DBUG_PRINT("exit", ("failed"));
-  DBUG_RETURN(-1);
+  DBUG_PRINT("exit", ("failed, error %u(%s)", error.code, error.message));
+  ERR_RETURN(error);
 }
 
 /*
Thread
bk commit into 5.1 tree (tomas:1.2223)tomas29 Jun