From: Date: October 10 2006 10:39am Subject: bk commit into 5.1 tree (jonas:1.2056) BUG#21941 List-Archive: http://lists.mysql.com/commits/13376 X-Bug: 21941 Message-Id: <20061010083906.CA20759BEF2@perch.ndb.mysql.com> 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, 2006-10-10 10:39:03+02:00, jonas@stripped +3 -0 ndb - bug#21941 Fix so that scans closed before execute are removed from "scans to send list" recommit in mysql-5.1-wl2325-5.0 storage/ndb/include/ndbapi/NdbTransaction.hpp@stripped, 2006-10-10 10:39:01+02:00, jonas@stripped +4 -1 Fix so that scans closed before execute are removed from "scans to send list" storage/ndb/src/ndbapi/NdbScanOperation.cpp@stripped, 2006-10-10 10:39:02+02:00, jonas@stripped +20 -2 Fix so that scans closed before execute are removed from "scans to send list" storage/ndb/src/ndbapi/NdbTransaction.cpp@stripped, 2006-10-10 10:39:02+02:00, jonas@stripped +48 -17 Fix so that scans closed before execute are removed from "scans to send list" # 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: perch.ndb.mysql.com # Root: /home/jonas/src/mysql-5.1-wl2325-5.0 --- 1.45/storage/ndb/include/ndbapi/NdbTransaction.hpp 2006-10-10 10:39:06 +02:00 +++ 1.46/storage/ndb/include/ndbapi/NdbTransaction.hpp 2006-10-10 10:39:06 +02:00 @@ -657,8 +657,11 @@ // Release all cursor operations in connection void releaseOps(NdbOperation*); void releaseScanOperations(NdbIndexScanOperation*); + bool releaseScanOperation(NdbIndexScanOperation** listhead, + NdbIndexScanOperation** listtail, + NdbIndexScanOperation* op); void releaseExecutedScanOperation(NdbIndexScanOperation*); - + // Set the transaction identity of the transaction void setTransactionId(Uint64 aTransactionId); --- 1.50/storage/ndb/src/ndbapi/NdbTransaction.cpp 2006-10-10 10:39:06 +02:00 +++ 1.51/storage/ndb/src/ndbapi/NdbTransaction.cpp 2006-10-10 10:39:06 +02:00 @@ -978,27 +978,58 @@ NdbTransaction::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp) { DBUG_ENTER("NdbTransaction::releaseExecutedScanOperation"); - DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp)) + DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp)); + + releaseScanOperation(&m_firstExecutedScanOp, 0, cursorOp); + + DBUG_VOID_RETURN; +}//NdbTransaction::releaseExecutedScanOperation() - // here is one reason to make op lists doubly linked - if (m_firstExecutedScanOp == cursorOp) { - m_firstExecutedScanOp = (NdbIndexScanOperation*)cursorOp->theNext; - cursorOp->release(); - theNdb->releaseScanOperation(cursorOp); - } else if (m_firstExecutedScanOp != NULL) { - NdbIndexScanOperation* tOp = m_firstExecutedScanOp; - while (tOp->theNext != NULL) { - if (tOp->theNext == cursorOp) { - tOp->theNext = cursorOp->theNext; - cursorOp->release(); - theNdb->releaseScanOperation(cursorOp); - break; +bool +NdbTransaction::releaseScanOperation(NdbIndexScanOperation** listhead, + NdbIndexScanOperation** listtail, + NdbIndexScanOperation* op) +{ + if (* listhead == op) + { + * listhead = (NdbIndexScanOperation*)op->theNext; + if (listtail && *listtail == op) + { + assert(* listhead == 0); + * listtail = 0; + } + + } + else + { + NdbIndexScanOperation* tmp = * listhead; + while (tmp != NULL) + { + if (tmp->theNext == op) + { + tmp->theNext = (NdbIndexScanOperation*)op->theNext; + if (listtail && *listtail == op) + { + assert(op->theNext == 0); + *listtail = tmp; + } + break; } - tOp = (NdbIndexScanOperation*)tOp->theNext; + tmp = (NdbIndexScanOperation*)tmp->theNext; } + if (tmp == NULL) + op = NULL; } - DBUG_VOID_RETURN; -}//NdbTransaction::releaseExecutedScanOperation() + + if (op != NULL) + { + op->release(); + theNdb->releaseScanOperation(op); + return true; + } + + return false; +} /***************************************************************************** NdbOperation* getNdbOperation(const char* aTableName); --- 1.74/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2006-10-10 10:39:06 +02:00 +++ 1.75/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2006-10-10 10:39:06 +02:00 @@ -676,9 +676,27 @@ theNdbCon = NULL; m_transConnection = NULL; - if (releaseOp && tTransCon) { + if (tTransCon) + { NdbIndexScanOperation* tOp = (NdbIndexScanOperation*)this; - tTransCon->releaseExecutedScanOperation(tOp); + + bool ret = true; + if (theStatus != WaitResponse) + { + /** + * Not executed yet + */ + ret = + tTransCon->releaseScanOperation(&tTransCon->m_theFirstScanOperation, + &tTransCon->m_theLastScanOperation, + tOp); + } + else if (releaseOp) + { + ret = tTransCon->releaseScanOperation(&tTransCon->m_firstExecutedScanOp, + 0, tOp); + } + assert(ret); } tCon->theScanningOp = 0;