From: Date: December 27 2006 10:04pm Subject: bk commit into 4.1 tree (pekka:1.2563) BUG#24028 List-Archive: http://lists.mysql.com/commits/17421 X-Bug: 24028 Message-Id: <200612272104.kBRL4IZi023369@orca.ndb.mysql.com> Below is the list of changes that have just been committed into a local 4.1 repository of pekka. When pekka 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-27 22:04:09+01:00, pekka@stripped +9 -0 ndb - bug#24028 4.1 mysql-test/r/ndb_blob.result@stripped, 2006-12-27 22:01:54+01:00, pekka@stripped +2 -0 NdbBlob: use NdbRecAttr UNDEFINED to check if read op succeeded mysql-test/t/ndb_blob.test@stripped, 2006-12-27 22:01:54+01:00, pekka@stripped +5 -0 NdbBlob: use NdbRecAttr UNDEFINED to check if read op succeeded ndb/include/ndbapi/NdbBlob.hpp@stripped, 2006-12-27 22:01:54+01:00, pekka@stripped +1 -1 NdbBlob: use NdbRecAttr UNDEFINED to check if read op succeeded ndb/include/ndbapi/NdbRecAttr.hpp@stripped, 2006-12-27 22:01:54+01:00, pekka@stripped +8 -0 NdbBlob: use NdbRecAttr UNDEFINED to check if read op succeeded ndb/src/ndbapi/NdbBlob.cpp@stripped, 2006-12-27 22:01:54+01:00, pekka@stripped +25 -9 NdbBlob: use NdbRecAttr UNDEFINED to check if read op succeeded ndb/src/ndbapi/NdbOperationDefine.cpp@stripped, 2006-12-27 22:01:54+01:00, pekka@stripped +1 -0 NdbBlob: use NdbRecAttr UNDEFINED to check if read op succeeded ndb/src/ndbapi/NdbOperationExec.cpp@stripped, 2006-12-27 22:01:54+01:00, pekka@stripped +1 -1 NdbBlob: use NdbRecAttr UNDEFINED to check if read op succeeded ndb/test/ndbapi/testBlobs.cpp@stripped, 2006-12-27 22:01:54+01:00, pekka@stripped +30 -16 NdbBlob: use NdbRecAttr UNDEFINED to check if read op succeeded ndb/test/ndbapi/testDict.cpp@stripped, 2006-12-27 21:30:02+01:00, pekka@stripped +3 -3 compile fix gcc-4.1 (unrelated to this cs) # 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: pekka # Host: orca.ndb.mysql.com # Root: /export/home/space/pekka/ndb/version/my41-bug24028 --- 1.9/ndb/include/ndbapi/NdbRecAttr.hpp 2006-12-27 22:04:21 +01:00 +++ 1.10/ndb/include/ndbapi/NdbRecAttr.hpp 2006-12-27 22:04:21 +01:00 @@ -246,6 +246,7 @@ Uint32 attrId() const; /* Get attribute id */ bool setNULL(); /* Set NULL indicator */ + void setUNDEFINED(); /* Set UNDEFINED indicator */ bool receive_data(const Uint32*, Uint32); void release(); /* Release memory if allocated */ @@ -408,6 +409,13 @@ { theNULLind = 1; return m_nullable; +} + +inline +void +NdbRecAttr::setUNDEFINED() +{ + theNULLind = -1; } inline --- 1.15/ndb/src/ndbapi/NdbOperationDefine.cpp 2006-12-27 22:04:21 +01:00 +++ 1.16/ndb/src/ndbapi/NdbOperationDefine.cpp 2006-12-27 22:04:21 +01:00 @@ -384,6 +384,7 @@ * Get a Receive Attribute object and link it into the operation object. ***********************************************************************/ if((tRecAttr = theReceiver.getValue(tAttrInfo, aValue)) != 0){ + tRecAttr->setUNDEFINED(); // NdbRecAttr::setup sets it to not-NULL theErrorLine++; return tRecAttr; } else { --- 1.17/ndb/src/ndbapi/NdbOperationExec.cpp 2006-12-27 22:04:21 +01:00 +++ 1.18/ndb/src/ndbapi/NdbOperationExec.cpp 2006-12-27 22:04:21 +01:00 @@ -581,7 +581,7 @@ { NdbRecAttr* tRecAttr = theReceiver.theFirstRecAttr; while (tRecAttr != NULL) { - tRecAttr->setNULL(); + tRecAttr->setUNDEFINED(); tRecAttr = tRecAttr->next(); }//while }//NdbOperation::handleFailedAI_ElemLen() --- 1.25/ndb/test/ndbapi/testBlobs.cpp 2006-12-27 22:04:21 +01:00 +++ 1.26/ndb/test/ndbapi/testBlobs.cpp 2006-12-27 22:04:21 +01:00 @@ -138,10 +138,9 @@ << " 0 getValue / setValue" << endl << " 1 setActiveHook" << endl << " 2 readData / writeData" << endl + << "example: -test kn0 (need all 3)" << endl << "bug tests (no blob test)" << endl << " -bug 4088 ndb api hang with mixed ops on index table" << endl - << " -bug nnnn delete + write gives 626" << endl - << " -bug nnnn acc crash on delete and long key" << endl ; } @@ -225,9 +224,8 @@ static int dropTable() { - NdbDictionary::Table tab(g_opt.m_tname); if (g_dic->getTable(g_opt.m_tname) != 0) - CHK(g_dic->dropTable(tab) == 0); + CHK(g_dic->dropTable(g_opt.m_tname) == 0); return 0; } @@ -993,6 +991,32 @@ return 0; } +static int +deleteNoPk() +{ + DBG("--- deleteNoPk ---"); + Tup no_tup; // bug#24028 + no_tup.m_pk1 = 0xb1ffb1ff; + sprintf(no_tup.m_pk2, "%-*.*s", g_opt.m_pk2len, g_opt.m_pk2len, "b1ffb1ff"); + CHK((g_con = g_ndb->startTransaction()) != 0); + Tup& tup = no_tup; + DBG("deletePk pk1=" << hex << tup.m_pk1); + CHK((g_opr = g_con->getNdbOperation(g_opt.m_tname)) != 0); + CHK(g_opr->deleteTuple() == 0); + CHK(g_opr->equal("PK1", tup.m_pk1) == 0); + if (g_opt.m_pk2len != 0) + CHK(g_opr->equal("PK2", tup.m_pk2) == 0); + CHK(g_con->execute(Commit) == -1); // fail + // BUG: error should be on op but is on con now + DBG("con: " << g_con->getNdbError()); + DBG("opr: " << g_opr->getNdbError()); + CHK(g_con->getNdbError().code == 626 || g_opr->getNdbError().code == 626); + g_ndb->closeTransaction(g_con); + g_opr = 0; + g_con = 0; + return 0; +} + // hash index ops static int @@ -1339,6 +1363,7 @@ CHK(readPk(style) == 0); } CHK(deletePk() == 0); + CHK(deleteNoPk() == 0); CHK(verifyBlob() == 0); } if (testcase('w')) { @@ -1353,6 +1378,7 @@ CHK(readPk(style) == 0); } CHK(deletePk() == 0); + CHK(deleteNoPk() == 0); CHK(verifyBlob() == 0); } } @@ -1762,18 +1788,6 @@ } CHK(memcmp(tup.m_blob1.m_val, tup.m_blob1.m_buf, 8 + g_opt.m_blob1.m_inline) == 0); } - return 0; -} - -static int -bugtest_2222() -{ - return 0; -} - -static int -bugtest_3333() -{ return 0; } --- 1.19/ndb/test/ndbapi/testDict.cpp 2006-12-27 22:04:21 +01:00 +++ 1.20/ndb/test/ndbapi/testDict.cpp 2006-12-27 22:04:21 +01:00 @@ -1018,8 +1018,8 @@ if (!pTab->equal(*pTab2)){ g_err << "equal failed" << endl; - g_info << *pTab; - g_info << *pTab2; + g_info << *(NDBT_Table*)pTab; // gcc-4.1.2 + g_info << *(NDBT_Table*)pTab2; return NDBT_FAILED; } return NDBT_OK; @@ -1029,7 +1029,7 @@ Ndb* pNdb = GETNDB(step); const NdbDictionary::Table* pTab = ctx->getTab(); ndbout << "|- " << pTab->getName() << endl; - g_info << *pTab; + g_info << *(NDBT_Table*)pTab; // Try to create table in db if (pTab->createTableInDb(pNdb) != 0){ return NDBT_FAILED; --- 1.16/mysql-test/r/ndb_blob.result 2006-12-27 22:04:21 +01:00 +++ 1.17/mysql-test/r/ndb_blob.result 2006-12-27 22:04:21 +01:00 @@ -76,6 +76,8 @@ select a from t1 where d is null; a 1 +delete from t1 where a=45567; +commit; delete from t1 where a=1; delete from t1 where a=2; commit; --- 1.16/mysql-test/t/ndb_blob.test 2006-12-27 22:04:21 +01:00 +++ 1.17/mysql-test/t/ndb_blob.test 2006-12-27 22:04:21 +01:00 @@ -96,6 +96,11 @@ commit; select a from t1 where d is null; +# bug#24028 - does not occur on MySQL level +# bug#17986 - not seen by us anymore but could show as warning here +delete from t1 where a=45567; +commit; + # pk delete delete from t1 where a=1; delete from t1 where a=2; --- 1.11/ndb/include/ndbapi/NdbBlob.hpp 2006-12-27 22:04:21 +01:00 +++ 1.12/ndb/include/ndbapi/NdbBlob.hpp 2006-12-27 22:04:21 +01:00 @@ -286,7 +286,7 @@ int setAccessKeyValue(NdbOperation* anOp); int setPartKeyValue(NdbOperation* anOp, Uint32 part); int getHeadInlineValue(NdbOperation* anOp); - void getHeadFromRecAttr(); + int getHeadFromRecAttr(); int setHeadInlineValue(NdbOperation* anOp); // data operations int readDataPrivate(char* buf, Uint32& bytes); --- 1.21/ndb/src/ndbapi/NdbBlob.cpp 2006-12-27 22:04:21 +01:00 +++ 1.22/ndb/src/ndbapi/NdbBlob.cpp 2006-12-27 22:04:21 +01:00 @@ -422,17 +422,27 @@ setErrorCode(anOp); return -1; } + /* + * NdbOperation does not always return error (TCROLLBACKREP). + * We rely on following to check if anything was returned. + */ + assert(theHeadInlineRecAttr->isNULL() == -1); return 0; } -void +int NdbBlob::getHeadFromRecAttr() { assert(theHeadInlineRecAttr != NULL); - theNullFlag = theHeadInlineRecAttr->isNULL(); - assert(theNullFlag != -1); + int flag = theHeadInlineRecAttr->isNULL(); + if (flag == -1) { + DBG("getHeadFromRecAttr [no data]"); + return -1; + } + theNullFlag = flag; theLength = ! theNullFlag ? theHead->length : 0; DBG("getHeadFromRecAttr [out]"); + return 0; } int @@ -1362,7 +1372,8 @@ } } if (isReadOp()) { - getHeadFromRecAttr(); + if (getHeadFromRecAttr() == -1) + return -1; if (setPos(0) == -1) return -1; if (theGetFlag) { @@ -1375,7 +1386,8 @@ } if (isUpdateOp()) { assert(anExecType == NoCommit); - getHeadFromRecAttr(); + if (getHeadFromRecAttr() == -1) + return -1; if (theSetFlag) { // setValue overwrites everything if (theSetBuf != NULL) { @@ -1392,7 +1404,8 @@ } if (isWriteOp() && isTableOp()) { assert(anExecType == NoCommit); - if (theHeadInlineReadOp->theError.code == 0) { + // error codes are useless + if (theHeadInlineRecAttr->isNULL() != -1) { int tNullFlag = theNullFlag; Uint64 tLength = theLength; Uint64 tPos = thePos; @@ -1406,7 +1419,8 @@ theLength = tLength; thePos = tPos; } else { - if (theHeadInlineReadOp->theError.code != 626) { + if (theHeadInlineReadOp->theError.code != 0 && + theHeadInlineReadOp->theError.code != 626) { setErrorCode(theHeadInlineReadOp); return -1; } @@ -1443,7 +1457,8 @@ } if (isDeleteOp()) { assert(anExecType == NoCommit); - getHeadFromRecAttr(); + if (getHeadFromRecAttr() == -1) + return -1; if (deleteParts(0, getPartCount()) == -1) return -1; } @@ -1518,7 +1533,8 @@ return -1; } } - getHeadFromRecAttr(); + if (getHeadFromRecAttr() == -1) + return -1; if (setPos(0) == -1) return -1; if (theGetFlag) {