List:Internals« Previous MessageNext Message »
From:jonas.oreland Date:June 7 2005 3:11pm
Subject:bk commit into 4.1 tree (joreland:1.2275) BUG#11133
View as plain text  
Below is the list of changes that have just been committed into a local
4.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
  1.2275 05/06/07 15:10:57 joreland@stripped +4 -0
  bug#11133 - ndb
    incorrect handling of writeTuple with multi op transaction

  ndb/test/run-test/daily-basic-tests.txt
    1.20 05/06/07 15:10:54 joreland@stripped +4 -0
    Add testcase for bug 11133

  ndb/test/ndbapi/testNdbApi.cpp
    1.12 05/06/07 15:10:54 joreland@stripped +239 -0
    Add testcase for bug 11133

  ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
    1.52 05/06/07 15:10:54 joreland@stripped +14 -13
    Let ACC decide what operation was performed when WRITE

  ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
    1.32 05/06/07 15:10:54 joreland@stripped +12 -1
    1) Pass operation instead of insertIsDone to LQH
    2) transform operation correctly when in parallell que
       (multi op within same trans)

# 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:	joreland
# Host:	eel.ndb.mysql.com.ndb.mysql.com
# Root:	/home/jonas/src/mysql-4.1

--- 1.19/ndb/test/run-test/daily-basic-tests.txt	Thu May 26 22:48:23 2005
+++ 1.20/ndb/test/run-test/daily-basic-tests.txt	Tue Jun  7 15:10:54 2005
@@ -546,6 +546,10 @@
 cmd: testNdbApi
 args: -n ReadWithoutGetValue
 
+max-time: 500
+cmd: testNdbApi
+args: -n Bug_11133 T1 
+
 #max-time: 500
 #cmd: testInterpreter
 #args: T1 

--- 1.31/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	Mon Apr 25 11:58:58 2005
+++ 1.32/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	Tue Jun  7 15:10:54 2005
@@ -1589,7 +1589,7 @@
 void Dbacc::sendAcckeyconf(Signal* signal) 
 {
   signal->theData[0] = operationRecPtr.p->userptr;
-  signal->theData[1] = operationRecPtr.p->insertIsDone;
+  signal->theData[1] = operationRecPtr.p->operation;
   signal->theData[2] = operationRecPtr.p->fid;
   signal->theData[3] = operationRecPtr.p->localdata[0];
   signal->theData[4] = operationRecPtr.p->localdata[1];
@@ -1671,6 +1671,11 @@
     case ZWRITE:
     case ZSCAN_OP:
       if (!tgeLocked){
+	if(operationRecPtr.p->operation == ZWRITE)
+	{
+	  jam();
+	  operationRecPtr.p->operation = ZUPDATE;
+	}
         sendAcckeyconf(signal);
         if (operationRecPtr.p->dirtyRead == ZFALSE) {
 	  /*---------------------------------------------------------------*/
@@ -2182,6 +2187,12 @@
     return ZWRITE_ERROR;
   }//if
 
+  if(operationRecPtr.p->operation == ZWRITE)
+  {
+    operationRecPtr.p->operation = 
+      (mlpqOperPtr.p->operation == ZDELETE) ? ZINSERT : ZUPDATE;
+  }
+  
   operationRecPtr.p->localdata[0] = queOperPtr.p->localdata[0];
   operationRecPtr.p->localdata[1] = queOperPtr.p->localdata[1];
   operationRecPtr.p->prevParallelQue = mlpqOperPtr.i;

--- 1.51/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	Fri Apr 22 13:20:46 2005
+++ 1.52/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	Tue Jun  7 15:10:54 2005
@@ -3897,20 +3897,21 @@
    * EITHER TO THE TC BLOCK OR DIRECTLY TO THE APPLICATION. THE SCHEMA VERSION
    * IS NEEDED SINCE TWO SCHEMA VERSIONS CAN BE ACTIVE SIMULTANEOUSLY ON A 
    * TABLE.
-   * ------------------------------------------------------------------------ */
-  if (regTcPtr->operation == ZWRITE) {
-    if (signal->theData[1] > 0) {
-      /* --------------------------------------------------------------------
-       * ACC did perform an insert and thus we should indicate that the WRITE 
-       * is an INSERT otherwise it is an UPDATE.
-       * -------------------------------------------------------------------- */
-      jam();
-      regTcPtr->operation = ZINSERT;
-    } else {
-      jam();
-      tcConnectptr.p->operation = ZUPDATE;
-    }//if
+   * ----------------------------------------------------------------------- */
+  if (regTcPtr->operation == ZWRITE) 
+  {
+    Uint32 op= signal->theData[1];
+    if(likely(op == ZINSERT || op == ZUPDATE))
+    {
+      regTcPtr->operation = op;
+    }
+    else
+    {
+      warningEvent("Convering %d to ZUPDATE", op);
+      regTcPtr->operation = ZUPDATE;
+    }
   }//if
+  
   ndbrequire(localKeyFlag == 1);
   localKey2 = localKey1 & MAX_TUPLES_PER_PAGE;
   localKey1 = localKey1 >> MAX_TUPLES_BITS;

--- 1.11/ndb/test/ndbapi/testNdbApi.cpp	Thu May 26 22:04:47 2005
+++ 1.12/ndb/test/ndbapi/testNdbApi.cpp	Tue Jun  7 15:10:54 2005
@@ -1049,6 +1049,239 @@
   return result;
 }
 
+int runBug_11133(NDBT_Context* ctx, NDBT_Step* step){
+  int result = NDBT_OK;
+  const NdbDictionary::Table* pTab = ctx->getTab();
+
+  HugoOperations hugoOps(*pTab);
+
+  Ndb* pNdb = GETNDB(step);
+  Uint32 lm;
+
+  NdbConnection* pCon = pNdb->startTransaction();
+  if (pCon == NULL){
+    pNdb->closeTransaction(pCon);  
+    return NDBT_FAILED;
+  }
+  
+  NdbOperation* pOp = pCon->getNdbOperation(pTab->getName());
+  if (pOp == NULL){
+    ERR(pCon->getNdbError());
+    pNdb->closeTransaction(pCon);  
+    return NDBT_FAILED;
+  }
+  
+  if (pOp->readTuple(NdbOperation::LM_Exclusive) != 0){
+    pNdb->closeTransaction(pCon);
+    ERR(pOp->getNdbError());
+    return NDBT_FAILED;
+  }
+      
+  for(int a = 0; a<pTab->getNoOfColumns(); a++){
+    if (pTab->getColumn(a)->getPrimaryKey() == true){
+      if(hugoOps.equalForAttr(pOp, a, 1) != 0){
+	ERR(pCon->getNdbError());
+	pNdb->closeTransaction(pCon);
+	return NDBT_FAILED;
+      }
+    }
+  }
+
+  for(int a = 0; a<pTab->getNoOfColumns(); a++){
+    if (pTab->getColumn(a)->getPrimaryKey() != true){
+      if (pOp->getValue(pTab->getColumn(a)->getName()) == NULL) {
+	ERR(pCon->getNdbError());
+	pNdb->closeTransaction(pCon);
+	return NDBT_FAILED;
+      }
+    }
+  }
+  
+  int check = pCon->execute(NoCommit);
+  if (check == 0){
+    ndbout << "execute worked" << endl;
+  } else {
+    ERR(pCon->getNdbError());
+    result = NDBT_FAILED;
+  }
+  
+  pOp = pCon->getNdbOperation(pTab->getName());
+  if (pOp == NULL){
+    ERR(pCon->getNdbError());
+    pNdb->closeTransaction(pCon);  
+    return NDBT_FAILED;
+  }
+  
+  if (pOp->deleteTuple() != 0){
+    pNdb->closeTransaction(pCon);
+    ERR(pOp->getNdbError());
+    return NDBT_FAILED;
+  }
+      
+  for(int a = 0; a<pTab->getNoOfColumns(); a++){
+    if (pTab->getColumn(a)->getPrimaryKey() == true){
+      if(hugoOps.equalForAttr(pOp, a, 1) != 0){
+	ERR(pCon->getNdbError());
+	pNdb->closeTransaction(pCon);
+	return NDBT_FAILED;
+      }
+    }
+  }
+
+  check = pCon->execute(NoCommit);
+  if (check == 0){
+    ndbout << "execute worked" << endl;
+  } else {
+    ERR(pCon->getNdbError());
+    result = NDBT_FAILED;
+  }
+
+  pOp = pCon->getNdbOperation(pTab->getName());
+  if (pOp == NULL){
+    ERR(pCon->getNdbError());
+    pNdb->closeTransaction(pCon);  
+    return NDBT_FAILED;
+  }
+  
+  if (pOp->writeTuple() != 0){
+    pNdb->closeTransaction(pCon);
+    ERR(pOp->getNdbError());
+    return NDBT_FAILED;
+  }
+  
+  for(int a = 0; a<pTab->getNoOfColumns(); a++){
+    if (pTab->getColumn(a)->getPrimaryKey() == true){
+      if(hugoOps.equalForAttr(pOp, a, 1) != 0){
+	ERR(pCon->getNdbError());
+	pNdb->closeTransaction(pCon);
+	return NDBT_FAILED;
+      }
+    }
+  }
+  
+  for(int a = 0; a<pTab->getNoOfColumns(); a++){
+    if (pTab->getColumn(a)->getPrimaryKey() != true){
+      if(hugoOps.setValueForAttr(pOp, a, 1, 1) != 0)
+      {
+	ERR(pCon->getNdbError());
+	pNdb->closeTransaction(pCon);
+	return NDBT_FAILED;
+      }
+    }
+  }
+  
+  check = pCon->execute(NoCommit);
+  if (check == 0){
+    ndbout << "execute worked" << endl;
+  } else {
+    ERR(pCon->getNdbError());
+    result = NDBT_FAILED;
+  }
+
+  pOp = pCon->getNdbOperation(pTab->getName());
+  if (pOp == NULL){
+    ERR(pCon->getNdbError());
+    pNdb->closeTransaction(pCon);  
+    return NDBT_FAILED;
+  }
+  
+  if (pOp->writeTuple() != 0){
+    pNdb->closeTransaction(pCon);
+    ERR(pOp->getNdbError());
+    return NDBT_FAILED;
+  }
+  
+  for(int a = 0; a<pTab->getNoOfColumns(); a++){
+    if (pTab->getColumn(a)->getPrimaryKey() == true){
+      if(hugoOps.equalForAttr(pOp, a, 1) != 0){
+	ERR(pCon->getNdbError());
+	pNdb->closeTransaction(pCon);
+	return NDBT_FAILED;
+      }
+    }
+  }
+  
+  for(int a = 0; a<pTab->getNoOfColumns(); a++){
+    if (pTab->getColumn(a)->getPrimaryKey() != true){
+      if(hugoOps.setValueForAttr(pOp, a, 1, 1) != 0)
+      {
+	ERR(pCon->getNdbError());
+	pNdb->closeTransaction(pCon);
+	return NDBT_FAILED;
+      }
+    }
+  }
+  
+  check = pCon->execute(NoCommit);
+  if (check == 0){
+    ndbout << "execute worked" << endl;
+  } else {
+    ERR(pCon->getNdbError());
+    result = NDBT_FAILED;
+  }
+  
+  check = pCon->execute(Rollback);
+  if (check == 0){
+    ndbout << "execute worked" << endl;
+  } else {
+    ERR(pCon->getNdbError());
+    result = NDBT_FAILED;
+  }
+  
+  pCon->close();
+
+  pCon = pNdb->startTransaction();
+  if (pCon == NULL){
+    pNdb->closeTransaction(pCon);  
+    return NDBT_FAILED;
+  }
+
+  pOp = pCon->getNdbOperation(pTab->getName());
+  if (pOp == NULL){
+    ERR(pCon->getNdbError());
+    pNdb->closeTransaction(pCon);  
+    return NDBT_FAILED;
+  }
+  
+  if (pOp->writeTuple() != 0){
+    pNdb->closeTransaction(pCon);
+    ERR(pOp->getNdbError());
+    return NDBT_FAILED;
+  }
+  
+  for(int a = 0; a<pTab->getNoOfColumns(); a++){
+    if (pTab->getColumn(a)->getPrimaryKey() == true){
+      if(hugoOps.equalForAttr(pOp, a, 1) != 0){
+	ERR(pCon->getNdbError());
+	pNdb->closeTransaction(pCon);
+	return NDBT_FAILED;
+      }
+    }
+  }
+  
+  for(int a = 0; a<pTab->getNoOfColumns(); a++){
+    if (pTab->getColumn(a)->getPrimaryKey() != true){
+      if(hugoOps.setValueForAttr(pOp, a, 1, 1) != 0)
+      {
+	ERR(pCon->getNdbError());
+	pNdb->closeTransaction(pCon);
+	return NDBT_FAILED;
+      }
+    }
+  }
+  
+  check = pCon->execute(Commit);
+  if (check == 0){
+    ndbout << "execute worked" << endl;
+  } else {
+    ERR(pCon->getNdbError());
+    result = NDBT_FAILED;
+  }
+  
+  return result;
+}
+
+
 
 NDBT_TESTSUITE(testNdbApi);
 TESTCASE("MaxNdb", 
@@ -1122,6 +1355,12 @@
 	 "Test that it's possible to perform read wo/ getvalue's\n"){ 
   INITIALIZER(runLoadTable);
   INITIALIZER(runReadWithoutGetValue);
+  FINALIZER(runClearTable);
+}
+TESTCASE("Bug_11133", 
+	 "Test ReadEx-Delete-Write\n"){ 
+  INITIALIZER(runLoadTable);
+  INITIALIZER(runBug_11133);
   FINALIZER(runClearTable);
 }
 NDBT_TESTSUITE_END(testNdbApi);
Thread
bk commit into 4.1 tree (joreland:1.2275) BUG#11133jonas.oreland7 Jun