#At file:///home/frazer/bzr/mysql-5.1-telco-6.3/
3170 Frazer Clement 2009-11-27 [merge]
Merge 6.2->6.3
modified:
storage/ndb/src/ndbapi/NdbOperationDefine.cpp
storage/ndb/src/ndbapi/NdbOperationSearch.cpp
storage/ndb/test/ndbapi/testBlobs.cpp
storage/ndb/test/run-test/daily-basic-tests.txt
=== modified file 'storage/ndb/src/ndbapi/NdbOperationDefine.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp 2009-05-27 12:11:46 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp 2009-11-27 13:29:31 +0000
@@ -703,6 +703,26 @@ NdbOperation::getBlobHandle(NdbTransacti
return NULL;
}
+ /* Check key fully defined for key operations */
+ switch (theStatus)
+ {
+ case TupleKeyDefined:
+ case GetValue:
+ case SetValue:
+ case FinalGetValue:
+ case ExecInterpretedValue:
+ case SetValueInterpreted:
+ /* All ok states to create a Blob Handle in */
+ break;
+ default:
+ {
+ /* Unexpected state to be obtaining Blob handle */
+ /* Invalid usage of blob attribute */
+ setErrorCodeAbort(4264);
+ return NULL;
+ }
+ }
+
tBlob = theNdb->getNdbBlob();
if (tBlob == NULL)
return NULL;
=== modified file 'storage/ndb/src/ndbapi/NdbOperationSearch.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2009-05-27 12:11:46 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2009-11-27 13:29:31 +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'
--- a/storage/ndb/test/ndbapi/testBlobs.cpp 2009-10-26 20:40:34 +0000
+++ b/storage/ndb/test/ndbapi/testBlobs.cpp 2009-11-27 13:29:31 +0000
@@ -4170,6 +4170,87 @@ bugtest_27370()
return 0;
}
+static int
+bugtest_28116()
+{
+ DBG("bug test 28116 - Crash in getBlobHandle() when called without full key");
+
+ if (g_opt.m_pk2chr.m_len == 0)
+ {
+ DBG(" ... skipped, requires multi-column primary key.");
+ return 0;
+ }
+
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_opr = g_con->getNdbOperation(g_opt.m_tname)) != 0);
+ int reqType = urandom(4);
+ switch(reqType) {
+ case 0:
+ {
+ DBG("Read");
+ CHK(g_opr->readTuple() == 0);
+ break;
+ }
+ case 1:
+ {
+ DBG("Insert");
+ CHK(g_opr->insertTuple() == 0);
+ break;
+ }
+ case 2:
+ {
+ DBG("Update");
+ CHK(g_opr->updateTuple() == 0);
+ break;
+ }
+ case 3:
+ default:
+ {
+ DBG("Delete");
+ CHK(g_opr->deleteTuple() == 0);
+ break;
+ }
+ }
+ switch (urandom(3)) {
+ case 0:
+ {
+ DBG(" No keys");
+ break;
+ }
+ case 1:
+ {
+ DBG(" Pk1 only");
+ CHK(g_opr->equal("PK1", tup.m_pk1) == 0);
+ break;
+ }
+ case 2:
+ default:
+ {
+ DBG(" Pk2/3 only");
+ if (g_opt.m_pk2chr.m_len != 0)
+ {
+ CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
+ CHK(g_opr->equal("PK3", tup.m_pk3) == 0);
+ }
+ break;
+ }
+ }
+ /* Deliberately no equal() on rest of primary key, to provoke error. */
+ CHK(g_opr->getBlobHandle("BL1") == 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)();
@@ -4179,7 +4260,8 @@ static struct {
{ 27370, bugtest_27370 },
{ 36756, bugtest_36756 },
{ 45768, bugtest_45768 },
- { 48040, bugtest_48040 }
+ { 48040, bugtest_48040 },
+ { 28116, bugtest_28116 }
};
NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt 2009-11-02 17:09:12 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt 2009-11-27 13:29:31 +0000
@@ -1414,3 +1414,7 @@ max-time: 300
cmd: testBasic
args: -n DDInsertFailUpdateBatch
+max-time: 300
+cmd: testBlobs
+args: -skip hp -bug 28116
+
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-6.3 branch (frazer:3170) | Frazer Clement | 27 Nov |