Commit d2f51fb7 authored by joreland@mysql.com's avatar joreland@mysql.com

Fix UtilTransaction::verifyIndex wrt to null handling

parent 29c5bfb2
...@@ -1138,19 +1138,33 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1138,19 +1138,33 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
*/ */
NdbIndexOperation* pIndexOp= NULL; NdbIndexOperation* pIndexOp= NULL;
NdbIndexScanOperation *pScanOp= NULL; NdbIndexScanOperation *pScanOp= NULL;
NdbOperation *pIOp= 0;
bool null_found= false;
for(a = 0; a<(int)pIndex->getNoOfColumns(); a++){
const NdbDictionary::Column * col = pIndex->getColumn(a);
if (row.attributeStore(col->getName())->isNULL())
{
null_found= true;
ndbout_c("null found");
break;
}
}
const char * tabName= tab.getName();
if(!null_found)
{ {
void* pOpCheck= NULL;
if (indexType == NdbDictionary::Index::UniqueHashIndex) { if (indexType == NdbDictionary::Index::UniqueHashIndex) {
pOpCheck= pIndexOp= pTrans1->getNdbIndexOperation(indexName, tab.getName()); pIOp= pIndexOp= pTrans1->getNdbIndexOperation(indexName, tabName);
} else { } else {
pOpCheck= pScanOp= pTrans1->getNdbIndexScanOperation(indexName, tab.getName()); pIOp= pScanOp= pTrans1->getNdbIndexScanOperation(indexName, tabName);
} }
if (pOpCheck == NULL) { if (pIOp == NULL) {
ERR(pTrans1->getNdbError()); ERR(pTrans1->getNdbError());
goto close_all; goto close_all;
} }
}
{ {
bool not_ok; bool not_ok;
...@@ -1174,20 +1188,13 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1174,20 +1188,13 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
const NdbDictionary::Column * col = pIndex->getColumn(a); const NdbDictionary::Column * col = pIndex->getColumn(a);
int r; int r;
if (pIndexOp)
r = pIndexOp->equal(col->getName(), row.attributeStore(col->getName())->aRef());
else {
// setBound not possible for null attributes
if ( !row.attributeStore(col->getName())->isNULL() ) { if ( !row.attributeStore(col->getName())->isNULL() ) {
r = pScanOp->setBound(col->getName(), if(pIOp->equal(col->getName(),
NdbIndexScanOperation::BoundEQ, row.attributeStore(col->getName())->aRef()) != 0){
row.attributeStore(col->getName())->aRef());
}
}
if (r != 0){
ERR(pTrans1->getNdbError()); ERR(pTrans1->getNdbError());
goto close_all; goto close_all;
} }
}
#if VERBOSE #if VERBOSE
printf("%s = %d: ", col->getName(), row.attributeStore(a)->aRef()); printf("%s = %d: ", col->getName(), row.attributeStore(a)->aRef());
#endif #endif
...@@ -1203,12 +1210,8 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1203,12 +1210,8 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
for(a = 0; a<tab.getNoOfColumns(); a++){ for(a = 0; a<tab.getNoOfColumns(); a++){
void* pCheck; void* pCheck;
if (pIndexOp)
pCheck= indexRow.attributeStore(a)=
pIndexOp->getValue(tab.getColumn(a)->getName());
else
pCheck= indexRow.attributeStore(a)= pCheck= indexRow.attributeStore(a)=
pScanOp->getValue(tab.getColumn(a)->getName()); pIOp->getValue(tab.getColumn(a)->getName());
if(pCheck == NULL) { if(pCheck == NULL) {
ERR(pTrans1->getNdbError()); ERR(pTrans1->getNdbError());
...@@ -1218,6 +1221,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1218,6 +1221,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
printf("%s ", tab.getColumn(a)->getName()); printf("%s ", tab.getColumn(a)->getName());
#endif #endif
} }
}
#if VERBOSE #if VERBOSE
printf("\n"); printf("\n");
#endif #endif
...@@ -1242,6 +1246,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1242,6 +1246,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
/** /**
* Compare the two rows * Compare the two rows
*/ */
if(!null_found){
if (pScanOp) { if (pScanOp) {
if (cursor->nextResult() != 0){ if (cursor->nextResult() != 0){
const NdbError err = pTrans1->getNdbError(); const NdbError err = pTrans1->getNdbError();
...@@ -1264,11 +1269,12 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1264,11 +1269,12 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
goto close_all; goto close_all;
} }
} }
}
return_code= NDBT_OK; return_code= NDBT_OK;
goto close_all; goto close_all;
} }
close_all: close_all:
if (cursor) if (cursor)
cursor->close(); cursor->close();
if (pTrans1) if (pTrans1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment