#At file:///home/jonas/src/telco-6.2/
2613 jonas@stripped 2008-06-03
ndb - bug#37158
ndbapi could get confused if tckeyref/tckeyconf came in not common
order
modified:
storage/ndb/src/ndbapi/NdbTransaction.cpp
storage/ndb/test/ndbapi/testNdbApi.cpp
storage/ndb/test/run-test/daily-basic-tests.txt
per-file comments:
storage/ndb/src/ndbapi/NdbTransaction.cpp
handle any mixing of tckeyref/tckeyconf even with commit
storage/ndb/test/ndbapi/testNdbApi.cpp
test prg
storage/ndb/test/run-test/daily-basic-tests.txt
test
=== modified file 'storage/ndb/src/ndbapi/NdbTransaction.cpp'
--- a/storage/ndb/src/ndbapi/NdbTransaction.cpp 2008-05-21 16:39:51 +0000
+++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp 2008-06-03 12:37:17 +0000
@@ -1926,28 +1926,24 @@ from other transactions.
tGCI_lo = 0;
}
Uint64 tGCI = Uint64(tGCI_lo) | (Uint64(tGCI_hi) << 32);
- if (tCommitFlag == 1) {
+ if (tCommitFlag == 1)
+ {
theCommitStatus = Committed;
theGlobalCheckpointId = tGCI;
if (tGCI) // Read(dirty) only transaction doesnt get GCI
{
*p_latest_trans_gci = tGCI;
}
- } else if ((tNoComp >= tNoSent) &&
- (theLastExecOpInList->theCommitIndicator == 1)){
-
-
-/**********************************************************************/
-// We sent the transaction with Commit flag set and received a CONF with
-// no Commit flag set. This is clearly an anomaly.
-/**********************************************************************/
- theError.code = 4011;
- theCompletionStatus = CompletedFailure;
- theReturnStatus = NdbTransaction::ReturnFailure;
- theCommitStatus = Aborted;
- return 0;
+ }
+ else if (theLastExecOpInList->theCommitIndicator == 1)
+ {
+ /**
+ * We're waiting for a commit reply...
+ */
+ return -1;
}//if
- if (tNoComp >= tNoSent) {
+ if (tNoComp >= tNoSent)
+ {
return 0; // No more operations to wait for
}//if
// Not completed the reception yet.
@@ -2107,27 +2103,25 @@ NdbTransaction::receiveTCINDXCONF(const
Uint64 tGCI = Uint64(tGCI_lo) | (Uint64(tGCI_hi) << 32);
theNoOfOpCompleted = tNoComp;
- if (tCommitFlag == 1) {
+ if (tCommitFlag == 1)
+ {
theCommitStatus = Committed;
theGlobalCheckpointId = tGCI;
if (tGCI) // Read(dirty) only transaction doesnt get GCI
{
*p_latest_trans_gci = tGCI;
}
- } else if ((tNoComp >= tNoSent) &&
- (theLastExecOpInList->theCommitIndicator == 1)){
-
- /**********************************************************************/
- // We sent the transaction with Commit flag set and received a CONF with
- // no Commit flag set. This is clearly an anomaly.
- /**********************************************************************/
- theError.code = 4011;
- theCompletionStatus = NdbTransaction::CompletedFailure;
- theCommitStatus = NdbTransaction::Aborted;
- theReturnStatus = NdbTransaction::ReturnFailure;
- return 0;
+ }
+ else if (theLastExecOpInList->theCommitIndicator == 1)
+ {
+ /**
+ * We're waiting for a commit reply...
+ */
+ return -1;
}//if
- if (tNoComp >= tNoSent) {
+
+ if (tNoComp >= tNoSent)
+ {
return 0; // No more operations to wait for
}//if
// Not completed the reception yet.
=== modified file 'storage/ndb/test/ndbapi/testNdbApi.cpp'
--- a/storage/ndb/test/ndbapi/testNdbApi.cpp 2007-07-02 17:08:02 +0000
+++ b/storage/ndb/test/ndbapi/testNdbApi.cpp 2008-06-03 12:37:17 +0000
@@ -1674,6 +1674,60 @@ done:
return result;
}
+int
+runBug37158(NDBT_Context* ctx, NDBT_Step* step)
+{
+ int result = NDBT_OK;
+ Ndb* pNdb = GETNDB(step);
+
+ for (Uint32 i = 0; i<ctx->getNumLoops(); i++)
+ {
+ HugoOperations hugoOps(*ctx->getTab());
+ hugoOps.startTransaction(pNdb);
+ if (hugoOps.pkWriteRecord(pNdb, 0) != 0)
+ {
+ result = NDBT_FAILED;
+ goto done;
+ }
+
+
+ if (hugoOps.pkWritePartialRecord(pNdb, 1) != 0)
+ {
+ result = NDBT_FAILED;
+ goto done;
+ }
+
+ if (hugoOps.pkWriteRecord(pNdb, 2) != 0)
+ {
+ result = NDBT_FAILED;
+ goto done;
+ }
+
+ if (hugoOps.pkUpdateRecord(pNdb, 0) != 0)
+ {
+ result = NDBT_FAILED;
+ goto done;
+ }
+
+ if (hugoOps.execute_Commit(pNdb, AO_IgnoreError) == 4011)
+ {
+ result = NDBT_FAILED;
+ goto done;
+ }
+ hugoOps.closeTransaction(pNdb);
+
+ if (runClearTable(ctx, step) != 0)
+ {
+ result = NDBT_FAILED;
+ goto done;
+ }
+ }
+
+done:
+
+ return result;
+}
+
NDBT_TESTSUITE(testNdbApi);
TESTCASE("MaxNdb",
"Create Ndb objects until no more can be created\n"){
@@ -1782,6 +1836,10 @@ TESTCASE("Bug28443",
""){
INITIALIZER(runBug28443);
}
+TESTCASE("Bug37158",
+ ""){
+ INITIALIZER(runBug37158);
+}
NDBT_TESTSUITE_END(testNdbApi);
int main(int argc, const char** argv){
=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt 2008-05-29 15:58:58 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt 2008-06-03 12:37:17 +0000
@@ -1135,3 +1135,9 @@ cmd: testDict
args: -l 1 -n FailAddFragment
# EOF 2008-05-29
+# 2008-06-03
+max-time: 1200
+cmd: testNdbApi
+args: -l 100 -n Bug37158
+
+# EOF 2008-06-03
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-6.2 branch (jonas:2613) Bug#37158 | jonas | 3 Jun |