Below is the list of changes that have just been committed into a local
5.0 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-12-15 15:39:45+01:00, jonas@stripped +5 -0
ndb - bug#25059
incorrect handling of commit/ignore error in unique index code
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp@stripped, 2006-12-15 15:39:43+01:00,
jonas@stripped +2 -13
1) handle potential ptr error
2) remove incorrect commit-handling in uk code
ndb/src/ndbapi/NdbTransaction.cpp@stripped, 2006-12-15 15:39:43+01:00,
jonas@stripped +9 -0
1) force 4012
2) handle AO_IgnoreError in uk code
ndb/src/ndbapi/Ndbif.cpp@stripped, 2006-12-15 15:39:43+01:00, jonas@stripped +1
-0
force 4012
ndb/test/ndbapi/testIndex.cpp@stripped, 2006-12-15 15:39:43+01:00, jonas@stripped
+65 -0
test program for 25059
ndb/test/run-test/daily-basic-tests.txt@stripped, 2006-12-15 15:39:44+01:00,
jonas@stripped +4 -0
add testcase
# 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/50-work
--- 1.44/ndb/test/run-test/daily-basic-tests.txt 2006-12-15 15:39:49 +01:00
+++ 1.45/ndb/test/run-test/daily-basic-tests.txt 2006-12-15 15:39:49 +01:00
@@ -215,6 +215,10 @@
cmd: testBasic
args: -n Bug25090 T1
+max-time: 500
+cmd: testIndex
+args: -n Bug25059 -r 3000 T1
+
# SCAN TESTS
#
max-time: 500
--- 1.101/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2006-12-15 15:39:49 +01:00
+++ 1.102/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2006-12-15 15:39:49 +01:00
@@ -5084,7 +5084,7 @@
ptrAss(tcConnectptr, tcConnectRecord);
TcConnectRecord * const regTcPtr = tcConnectptr.p;
if (regTcPtr->tcConnectstate == OS_OPERATING) {
- apiConnectptr.i = regTcPtr->apiConnect;
+ Uint32 save = apiConnectptr.i = regTcPtr->apiConnect;
ptrCheckGuard(apiConnectptr, capiConnectFilesize, apiConnectRecord);
ApiConnectRecord * const regApiPtr = apiConnectptr.p;
compare_transid1 = regApiPtr->transid[0] ^ lqhKeyRef->transId1;
@@ -5195,7 +5195,7 @@
regApiPtr->lqhkeyreqrec--; // Compensate for extra during read
tcKeyRef->connectPtr = indexOp;
EXECUTE_DIRECT(DBTC, GSN_TCKEYREF, signal, TcKeyRef::SignalLength);
- apiConnectptr.i = regTcPtr->apiConnect;
+ apiConnectptr.i = save;
apiConnectptr.p = regApiPtr;
} else {
jam();
@@ -11880,17 +11880,6 @@
case(IOS_INDEX_ACCESS_WAIT_FOR_TRANSID_AI):
case(IOS_INDEX_ACCESS_WAIT_FOR_TCKEYCONF): {
jam();
- // If we fail index access for a non-read operation during commit
- // we abort transaction
- if (commitFlg == 1) {
- jam();
- releaseIndexOperation(regApiPtr, indexOp);
- apiConnectptr.i = indexOp->connectionIndex;
- ptrCheckGuard(apiConnectptr, capiConnectFilesize, apiConnectRecord);
- terrorCode = tcKeyRef->errorCode;
- abortErrorLab(signal);
- break;
- }
/**
* Increase count as it will be decreased below...
* (and the code is written to handle failing lookup on "real" table
--- 1.52/ndb/src/ndbapi/NdbTransaction.cpp 2006-12-15 15:39:49 +01:00
+++ 1.53/ndb/src/ndbapi/NdbTransaction.cpp 2006-12-15 15:39:49 +01:00
@@ -474,6 +474,7 @@
* This timeout situation can occur if NDB crashes.
*/
ndbout << "This timeout should never occur, execute(..)" << endl;
+ theError.code = 4012;
setOperationErrorCodeAbort(4012); // Error code for "Cluster Failure"
DBUG_RETURN(-1);
}//if
@@ -1965,6 +1966,14 @@
theGlobalCheckpointId = tGCI;
} else if ((tNoComp >= tNoSent) &&
(theLastExecOpInList->theCommitIndicator == 1)){
+
+ if (m_abortOption == AO_IgnoreError && theError.code != 0){
+ /**
+ * There's always a TCKEYCONF when using IgnoreError
+ */
+ return -1;
+ }
+
/**********************************************************************/
// We sent the transaction with Commit flag set and received a CONF with
// no Commit flag set. This is clearly an anomaly.
--- 1.33/ndb/src/ndbapi/Ndbif.cpp 2006-12-15 15:39:49 +01:00
+++ 1.34/ndb/src/ndbapi/Ndbif.cpp 2006-12-15 15:39:49 +01:00
@@ -952,6 +952,7 @@
//abort();
#endif
a_con->theReleaseOnClose = true;
+ a_con->theError.code = 4012;
a_con->setOperationErrorCodeAbort(4012);
a_con->theCommitStatus = NdbTransaction::NeedAbort;
a_con->theCompletionStatus = NdbTransaction::CompletedFailure;
--- 1.17/ndb/test/ndbapi/testIndex.cpp 2006-12-15 15:39:49 +01:00
+++ 1.18/ndb/test/ndbapi/testIndex.cpp 2006-12-15 15:39:49 +01:00
@@ -1239,7 +1239,64 @@
return NDBT_OK;
}
+int
+runBug25059(NDBT_Context* ctx, NDBT_Step* step)
+{
+ Ndb* pNdb = GETNDB(step);
+ NdbDictionary::Dictionary * dict = pNdb->getDictionary();
+ const NdbDictionary::Index * idx = dict->getIndex(pkIdxName, *ctx->getTab());
+ HugoOperations ops(*ctx->getTab(), idx);
+
+ int res = NDBT_OK;
+ int loops = ctx->getNumLoops();
+ const int rows = ctx->getNumRecords();
+
+ while (res == NDBT_OK && loops--)
+ {
+ ops.startTransaction(pNdb);
+ ops.pkReadRecord(pNdb, 10 + rand() % rows, rows);
+ int tmp;
+ if (tmp = ops.execute_Commit(pNdb, AO_IgnoreError))
+ {
+ if (tmp == 4012)
+ res = NDBT_FAILED;
+ else
+ if (ops.getTransaction()->getNdbError().code == 4012)
+ res = NDBT_FAILED;
+ }
+ ops.closeTransaction(pNdb);
+ }
+
+ loops = ctx->getNumLoops();
+ while (res == NDBT_OK && loops--)
+ {
+ ops.startTransaction(pNdb);
+ ops.pkUpdateRecord(pNdb, 10 + rand() % rows, rows);
+ int tmp;
+ int arg;
+ switch(rand() % 2){
+ case 0:
+ arg = AbortOnError;
+ break;
+ case 1:
+ arg = AO_IgnoreError;
+ ndbout_c("ignore error");
+ break;
+ }
+ if (tmp = ops.execute_Commit(pNdb, (AbortOption)arg))
+ {
+ if (tmp == 4012)
+ res = NDBT_FAILED;
+ else
+ if (ops.getTransaction()->getNdbError().code == 4012)
+ res = NDBT_FAILED;
+ }
+ ops.closeTransaction(pNdb);
+ }
+
+ return res;
+}
NDBT_TESTSUITE(testIndex);
TESTCASE("CreateAll",
@@ -1563,6 +1620,14 @@
STEP(runBug21384);
FINALIZER(createPkIndex_Drop);
FINALIZER(runClearTable);
+}
+TESTCASE("Bug25059",
+ "Test that unique indexes and nulls"){
+ TC_PROPERTY("LoggedIndexes", (unsigned)0);
+ INITIALIZER(createPkIndex);
+ INITIALIZER(runLoadTable);
+ STEP(runBug25059);
+ FINALIZER(createPkIndex_Drop);
}
NDBT_TESTSUITE_END(testIndex);
| Thread |
|---|
| • bk commit into 5.0 tree (jonas:1.2280) BUG#25059 | jonas | 15 Dec |