ndb -

  ndbapi test of bug#20252
parent 7f307660
...@@ -1151,70 +1151,76 @@ runScanVariants(NDBT_Context* ctx, NDBT_Step* step) ...@@ -1151,70 +1151,76 @@ runScanVariants(NDBT_Context* ctx, NDBT_Step* step)
{ {
for(int flags = 0; flags < 4; flags++) for(int flags = 0; flags < 4; flags++)
{ {
for (int par = 0; par < 16; par += 1 + (rand() % 3)) for (int batch = 0; batch < 100; batch += (1 + batch + (batch >> 3)))
{ {
bool disk = flags & 1; for (int par = 0; par < 16; par += 1 + (rand() % 3))
bool tups = flags & 2;
g_info << "lm: " << lm
<< " disk: " << disk
<< " tup scan: " << tups
<< " par: " << par
<< endl;
NdbConnection* pCon = pNdb->startTransaction();
NdbScanOperation* pOp = pCon->getNdbScanOperation(pTab->getName());
if (pOp == NULL) {
ERR(pCon->getNdbError());
return NDBT_FAILED;
}
if( pOp->readTuples((NdbOperation::LockMode)lm,
tups ? NdbScanOperation::SF_TupScan : 0,
par) != 0)
{ {
ERR(pCon->getNdbError()); bool disk = flags & 1;
return NDBT_FAILED; bool tups = flags & 2;
} g_info << "lm: " << lm
<< " disk: " << disk
int check = pOp->interpret_exit_ok(); << " tup scan: " << tups
if( check == -1 ) { << " par: " << par
ERR(pCon->getNdbError()); << " batch: " << batch
return NDBT_FAILED; << endl;
}
NdbConnection* pCon = pNdb->startTransaction();
// Define attributes to read NdbScanOperation* pOp = pCon->getNdbScanOperation(pTab->getName());
bool found_disk = false; if (pOp == NULL) {
for(int a = 0; a<pTab->getNoOfColumns(); a++){ ERR(pCon->getNdbError());
if (pTab->getColumn(a)->getStorageType() == NdbDictionary::Column::StorageTypeDisk) return NDBT_FAILED;
{
found_disk = true;
if (!disk)
continue;
} }
if((pOp->getValue(pTab->getColumn(a)->getName())) == 0) { if( pOp->readTuples((NdbOperation::LockMode)lm,
tups ? NdbScanOperation::SF_TupScan : 0,
par,
batch) != 0)
{
ERR(pCon->getNdbError()); ERR(pCon->getNdbError());
return NDBT_FAILED; return NDBT_FAILED;
} }
}
int check = pOp->interpret_exit_ok();
if (! (disk && !found_disk))
{
check = pCon->execute(NoCommit);
if( check == -1 ) { if( check == -1 ) {
ERR(pCon->getNdbError()); ERR(pCon->getNdbError());
return NDBT_FAILED; return NDBT_FAILED;
} }
int res; // Define attributes to read
int row = 0; bool found_disk = false;
while((res = pOp->nextResult()) == 0); for(int a = 0; a<pTab->getNoOfColumns(); a++){
if (pTab->getColumn(a)->getStorageType() ==
NdbDictionary::Column::StorageTypeDisk)
{
found_disk = true;
if (!disk)
continue;
}
if((pOp->getValue(pTab->getColumn(a)->getName())) == 0) {
ERR(pCon->getNdbError());
return NDBT_FAILED;
}
}
if (! (disk && !found_disk))
{
check = pCon->execute(NoCommit);
if( check == -1 ) {
ERR(pCon->getNdbError());
return NDBT_FAILED;
}
int res;
int row = 0;
while((res = pOp->nextResult()) == 0);
}
pCon->close();
} }
pCon->close();
} }
} }
} }
return NDBT_OK; return NDBT_OK;
} }
......
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