List:Commits« Previous MessageNext Message »
From:jonas Date:February 5 2007 7:28pm
Subject:bk commit into 5.1 tree (jonas:1.2421)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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@stripped, 2007-02-05 20:28:11+01:00, jonas@eel.(none) +2 -0
  ndb -
  Add abort option to lots of Hugo code, 
  as it assumes it and default value has changed

  storage/ndb/test/src/HugoTransactions.cpp@stripped, 2007-02-05 20:28:08+01:00, jonas@eel.(none) +19 -195
    Add abort option to lots of Hugo code, 
    as it assumes it and default value has changed

  storage/ndb/test/src/UtilTransactions.cpp@stripped, 2007-02-05 20:28:08+01:00, jonas@eel.(none) +11 -11
    Add abort option to lots of Hugo code, 
    as it assumes it and default value has changed

# 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:	jonas
# Host:	eel.(none)
# Root:	/home/jonas/src/51-work

--- 1.31/storage/ndb/test/src/HugoTransactions.cpp	2007-02-05 20:28:18 +01:00
+++ 1.32/storage/ndb/test/src/HugoTransactions.cpp	2007-02-05 20:28:18 +01:00
@@ -94,7 +94,7 @@
       }
     }
 
-    check = pTrans->execute(NoCommit);
+    check = pTrans->execute(NoCommit, AbortOnError);
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
       if (err.status == NdbError::TemporaryError){
@@ -245,183 +245,7 @@
       }
     }
 
-    check = pTrans->execute(NoCommit);
-    if( check == -1 ) {
-      const NdbError err = pTrans->getNdbError();
-      if (err.status == NdbError::TemporaryError){
-	ERR(err);
-	closeTransaction(pNdb);
-	NdbSleep_MilliSleep(50);
-	retryAttempt++;
-	continue;
-      }
-      ERR(err);
-      closeTransaction(pNdb);
-      return NDBT_FAILED;
-    }
-
-    // Abort after 1-100 or 1-records rows
-    int ranVal = rand();
-    int abortCount = ranVal % (records == 0 ? 100 : records); 
-    bool abortTrans = false;
-    if (abort > 0){
-      // Abort if abortCount is less then abortPercent 
-      if (abortCount < abortPercent) 
-	abortTrans = true;
-    }
-    
-    int eof;
-    int rows = 0;
-    while((eof = pOp->nextResult(true)) == 0){
-      rows++;
-      if (calc.verifyRowValues(&row) != 0){
-	closeTransaction(pNdb);
-	return NDBT_FAILED;
-      }
-
-      if (abortCount == rows && abortTrans == true){
-	ndbout << "Scan is aborted" << endl;
-	g_info << "Scan is aborted" << endl;
-	pOp->close();
-	if( check == -1 ) {
-	  ERR(pTrans->getNdbError());
-	  closeTransaction(pNdb);
-	  return NDBT_FAILED;
-	}
-	
-	closeTransaction(pNdb);
-	return NDBT_OK;
-      }
-    }
-    if (eof == -1) {
-      const NdbError err = pTrans->getNdbError();
-      
-      if (err.status == NdbError::TemporaryError){
-	ERR_INFO(err);
-	closeTransaction(pNdb);
-	NdbSleep_MilliSleep(50);
-	switch (err.code){
-	case 488:
-	case 245:
-	case 490:
-	  // Too many active scans, no limit on number of retry attempts
-	  break;
-	default:
-	  retryAttempt++;
-	}
-	continue;
-      }
-      ERR(err);
-      closeTransaction(pNdb);
-      return NDBT_FAILED;
-    }
-
-    closeTransaction(pNdb);
-
-    g_info << rows << " rows have been read" << endl;
-    if (records != 0 && rows != records){
-      g_err << "Check expected number of records failed" << endl 
-	    << "  expected=" << records <<", " << endl
-	    << "  read=" << rows << endl;
-      return NDBT_FAILED;
-    }
-    
-    return NDBT_OK;
-  }
-  return NDBT_FAILED;
-}
-
-
-#define RESTART_SCAN 99
-
-int
-HugoTransactions::scanUpdateRecords(Ndb* pNdb, 
-				    int records,
-				    int abortPercent,
-				    int parallelism){
-  if(m_defaultScanUpdateMethod == 1){
-    return scanUpdateRecords1(pNdb, records, abortPercent, parallelism);
-  } else if(m_defaultScanUpdateMethod == 2){
-    return scanUpdateRecords2(pNdb, records, abortPercent, parallelism);
-  } else {
-    return scanUpdateRecords3(pNdb, records, abortPercent, parallelism);
-  }
-}
-
-// Scan all records exclusive and update 
-// them one by one
-int
-HugoTransactions::scanUpdateRecords1(Ndb* pNdb, 
-				     int records,
-				     int abortPercent,
-				     int parallelism){
-  return scanUpdateRecords3(pNdb, records, abortPercent, 1);
-}
-
-// Scan all records exclusive and update 
-// them batched by asking nextScanResult to
-// give us all cached records before fetching new 
-// records from db
-int
-HugoTransactions::scanUpdateRecords2(Ndb* pNdb, 
-				     int records,
-				     int abortPercent,
-				     int parallelism){
-  return scanUpdateRecords3(pNdb, records, abortPercent, parallelism);
-}
-
-int
-HugoTransactions::scanUpdateRecords3(Ndb* pNdb, 
-				     int records,
-				     int abortPercent,
-				     int parallelism){
-  int                  retryAttempt = 0;
-  int check, a;
-  NdbScanOperation *pOp;
-
-
-  while (true){
-restart:
-    if (retryAttempt++ >= m_retryMax){
-      g_info << "ERROR: has retried this operation " << retryAttempt 
-	     << " times, failing!" << endl;
-      return NDBT_FAILED;
-    }
-
-    pTrans = pNdb->startTransaction();
-    if (pTrans == NULL) {
-      const NdbError err = pNdb->getNdbError();
-      ERR(err);
-      if (err.status == NdbError::TemporaryError){
-	NdbSleep_MilliSleep(50);
-	continue;
-      }
-      return NDBT_FAILED;
-    }
-
-    pOp = getScanOperation(pTrans);
-    if (pOp == NULL) {
-      ERR(pTrans->getNdbError());
-      closeTransaction(pNdb);
-      return NDBT_FAILED;
-    }
-    
-    if( pOp->readTuplesExclusive(parallelism) ) {
-      ERR(pTrans->getNdbError());
-      closeTransaction(pNdb);
-      return NDBT_FAILED;
-    }
-    
-    // Read all attributes from this table    
-    for(a=0; a<tab.getNoOfColumns(); a++){
-      if((row.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == NULL){
-	ERR(pTrans->getNdbError());
-	closeTransaction(pNdb);
-	return NDBT_FAILED;
-      }
-    }
-    
-    check = pTrans->execute(NoCommit);
+    check = pTrans->execute(NoCommit, AbortOnError);
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
       ERR(err);
@@ -474,7 +298,7 @@
       } while((check = pOp->nextResult(false)) == 0);
 
       if(check != -1){
-	check = pTrans->execute(Commit);   
+	check = pTrans->execute(Commit, AbortOnError);   
 	if(check != -1)
 	  m_latest_gci = pTrans->getGCI();
 	pTrans->restart();
@@ -587,14 +411,14 @@
       closeTrans = false;
       if (!abort)
       {
-	check = pTrans->execute( Commit );
+	check = pTrans->execute(Commit, AbortOnError);
 	if(check != -1)
 	  m_latest_gci = pTrans->getGCI();
 	pTrans->restart();
       }
       else
       {
-	check = pTrans->execute( NoCommit );
+	check = pTrans->execute(NoCommit, AbortOnError);
 	if (check != -1)
 	{
 	  check = pTrans->execute( Rollback );	
@@ -603,7 +427,7 @@
       }
     } else {
       closeTrans = false;
-      check = pTrans->execute( NoCommit );
+      check = pTrans->execute(NoCommit, AbortOnError);
     }
     if(check == -1 ) {
       const NdbError err = pTrans->getNdbError();
@@ -717,7 +541,7 @@
     }
     
     // Execute the transaction and insert the record
-    check = pTrans->execute( Commit, CommitAsMuchAsPossible ); 
+    check = pTrans->execute(Commit, CommitAsMuchAsPossible ); 
     if(check == -1 ) {
       const NdbError err = pTrans->getNdbError();
       closeTransaction(pNdb);
@@ -829,7 +653,7 @@
       return NDBT_FAILED;
     }
     
-    check = pTrans->execute(Commit);   
+    check = pTrans->execute(Commit, AbortOnError);   
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
       
@@ -950,7 +774,7 @@
       return NDBT_FAILED;
     }
     
-    check = pTrans->execute(NoCommit);   
+    check = pTrans->execute(NoCommit, AbortOnError);   
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
       
@@ -991,7 +815,7 @@
 	
 	if(check != 2)
 	  break;
-	if((check = pTrans->execute(NoCommit)) != 0)
+	if((check = pTrans->execute(NoCommit, , AbortOnError)) != 0)
 	  break;
       }
       if(check != 1 || rows_found != batch)
@@ -1019,7 +843,7 @@
 	  return NDBT_FAILED;
 	}
       }
-      check = pTrans->execute(Commit);   
+      check = pTrans->execute(Commit, AbortOnError);   
     }
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
@@ -1119,7 +943,7 @@
      }
    }
    
-    check = pTrans->execute(NoCommit);   
+    check = pTrans->execute(NoCommit, AbortOnError);   
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
 
@@ -1194,7 +1018,7 @@
 
 
     
-    check = pTrans->execute(Commit);   
+    check = pTrans->execute(Commit, AbortOnError);   
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
 
@@ -1274,7 +1098,7 @@
       return NDBT_FAILED;
     }
 
-    check = pTrans->execute(Commit);   
+    check = pTrans->execute(Commit, AbortOnError);   
     if( check == -1) {
       const NdbError err = pTrans->getNdbError();
       
@@ -1387,7 +1211,7 @@
     int lockCount = lockTime / sleepInterval;
     int commitCount = 0;
     do {
-      check = pTrans->execute(NoCommit);   
+      check = pTrans->execute(NoCommit, AbortOnError);   
       if( check == -1) {
 	const NdbError err = pTrans->getNdbError();
 	
@@ -1413,7 +1237,7 @@
     } while (commitCount < lockCount);
     
     // Really commit the trans, puuh!
-    check = pTrans->execute(Commit);   
+    check = pTrans->execute(Commit, AbortOnError);   
     if( check == -1) {
       const NdbError err = pTrans->getNdbError();
       
@@ -1543,7 +1367,7 @@
       }
     }
 
-    check = pTrans->execute(Commit);   
+    check = pTrans->execute(Commit, AbortOnError);   
     check = (check == -1 ? -1 : !ordered ? check : sOp->nextResult(true));
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
@@ -1684,7 +1508,7 @@
       }
     }
      
-    check = pTrans->execute(NoCommit);   
+    check = pTrans->execute(NoCommit, AbortOnError);   
     check = (check == -1 ? -1 : !ordered ? check : sOp->nextResult(true));
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
@@ -1756,7 +1580,7 @@
       }
     }
     
-    check = pTrans->execute(Commit);   
+    check = pTrans->execute(Commit, AbortOnError);   
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
       ERR(err);

--- 1.24/storage/ndb/test/src/UtilTransactions.cpp	2007-02-05 20:28:18 +01:00
+++ 1.25/storage/ndb/test/src/UtilTransactions.cpp	2007-02-05 20:28:18 +01:00
@@ -121,7 +121,7 @@
       goto failed;
     }
     
-    if(pTrans->execute(NoCommit) != 0){
+    if(pTrans->execute(NoCommit, AbortOnError) != 0){
       err = pTrans->getNdbError();    
       if(err.status == NdbError::TemporaryError){
 	ERR(err);
@@ -141,7 +141,7 @@
       } while((check = pOp->nextResult(false)) == 0);
       
       if(check != -1){
-	check = pTrans->execute(Commit);   
+	check = pTrans->execute(Commit, AbortOnError);   
 	pTrans->restart();
       }
       
@@ -245,7 +245,7 @@
       }
     }
     
-    check = pTrans->execute(NoCommit);
+    check = pTrans->execute(NoCommit, AbortOnError);
     if( check == -1 ) {
       ERR(pTrans->getNdbError());
       closeTransaction(pNdb);
@@ -262,7 +262,7 @@
 	}
       } while((eof = pOp->nextResult(false)) == 0);
       
-      check = pTrans->execute(Commit);   
+      check = pTrans->execute(Commit, AbortOnError);   
       pTrans->restart();
       if( check == -1 ) {
 	const NdbError err = pTrans->getNdbError();    
@@ -414,7 +414,7 @@
     }
     // *************************************************
     
-    check = pTrans->execute(NoCommit);
+    check = pTrans->execute(NoCommit, AbortOnError);
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
 
@@ -520,7 +520,7 @@
     }
     
     
-    check = pTrans->execute(NoCommit);
+    check = pTrans->execute(NoCommit, AbortOnError);
     if( check == -1 ) {
       ERR(pTrans->getNdbError());
       closeTransaction(pNdb);
@@ -693,7 +693,7 @@
       }
     }
 
-    check = pTrans->execute(NoCommit);
+    check = pTrans->execute(NoCommit, AbortOnError);
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
       
@@ -956,7 +956,7 @@
     printf("\n");
 #endif
     scanTrans->refresh();
-    check = pTrans1->execute(Commit);
+    check = pTrans1->execute(Commit, AbortOnError);
     if( check == -1 ) {
       const NdbError err = pTrans1->getNdbError();
       
@@ -1078,7 +1078,7 @@
       abort();
     }
 
-    check = pTrans->execute(NoCommit);
+    check = pTrans->execute(NoCommit, AbortOnError);
     if( check == -1 ) {
       const NdbError err = pTrans->getNdbError();
       
@@ -1137,7 +1137,7 @@
 	  goto error;
       }     
 
-      check = pTrans->execute(NoCommit);
+      check = pTrans->execute(NoCommit, AbortOnError);
       if(check)
 	goto error;
 
@@ -1376,7 +1376,7 @@
       }
     }
     
-    if( pTrans->execute(NoCommit) == -1 ) {
+    if( pTrans->execute(NoCommit, AbortOnError) == -1 ) {
       ERR(err= pTrans->getNdbError());
       goto error;
     }
Thread
bk commit into 5.1 tree (jonas:1.2421)jonas5 Feb