=== modified file 'storage/ndb/src/ndbapi/NdbOperationSearch.cpp' --- storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2009-05-26 18:53:34 +0000 +++ storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2009-11-24 17:49:02 +0000 @@ -473,7 +473,8 @@ NdbOperation::reorderKEYINFO() { Uint32 data[ NDB_MAX_KEYSIZE_IN_WORDS ]; Uint32 size = NDB_MAX_KEYSIZE_IN_WORDS; - getKeyFromTCREQ(data, size); + int rc = getKeyFromTCREQ(data, size); + assert(rc == 0); Uint32 pos = 1; Uint32 k; for (k = 0; k < m_accessTable->m_noOfKeys; k++) { @@ -505,7 +506,10 @@ NdbOperation::reorderKEYINFO() int NdbOperation::getKeyFromTCREQ(Uint32* data, Uint32 & size) { - assert(size >= theTupKeyLen && theTupKeyLen > 0); + /* Check that we can correctly return a valid key */ + if ((size < theTupKeyLen) || (theTupKeyLen == 0)) + return -1; + size = theTupKeyLen; unsigned pos = 0; while (pos < 8 && pos < size) { === modified file 'storage/ndb/test/ndbapi/testBlobs.cpp' --- storage/ndb/test/ndbapi/testBlobs.cpp 2009-10-26 20:02:17 +0000 +++ storage/ndb/test/ndbapi/testBlobs.cpp 2009-11-24 17:44:47 +0000 @@ -3997,6 +3997,31 @@ bugtest_27370() return 0; } +static int +bugtest_48973() +{ + DBG("bug test 48973 - Assertion failed at NdbOperationSearch.cpp line 509"); + + /* Attempt to insert tuple with Blob column, without setting the key at all */ + calcTups(true); + + Tup& tup = g_tups[0]; + CHK((g_con = g_ndb->startTransaction()) != 0); + CHK((g_opr = g_con->getNdbOperation(g_opt.m_tname)) != 0); + CHK(g_opr->insertTuple() ==0); + CHK(getBlobHandles(g_opr) != 0); + + /* 4264 == Invalid usage of Blob attribute */ + CHK(g_con->getNdbError().code == 4264); + CHK(g_opr->getNdbError().code == 4264); + + g_ndb->closeTransaction(g_con); + + g_opr = 0; + g_con = 0; + return 0; +} + static struct { int m_bug; int (*m_test)(); @@ -4006,7 +4031,8 @@ static struct { { 27370, bugtest_27370 }, { 36756, bugtest_36756 }, { 45768, bugtest_45768 }, - { 48040, bugtest_48040 } + { 48040, bugtest_48040 }, + { 48973, bugtest_48973 } }; NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535) === modified file 'storage/ndb/test/run-test/daily-basic-tests.txt' --- storage/ndb/test/run-test/daily-basic-tests.txt 2009-10-26 20:02:17 +0000 +++ storage/ndb/test/run-test/daily-basic-tests.txt 2009-11-24 17:46:50 +0000 @@ -1378,3 +1378,7 @@ max-time: 300 cmd: testBasic args: -n DDInsertFailUpdateBatch D1 D2 +max-time: 300 +cmd: testBlobs +args: -skip hp -bug 48973 +