Commit df226fab authored by unknown's avatar unknown

wl1671 - bug fixes for negative tests


ndb/src/ndbapi/NdbScanOperation.cpp:
  Extra printout if DEBUG_NEXT_RESULT
  Set theError.code so one can't call nextResult after it has once returned 1
ndb/test/ndbapi/ScanFunctions.hpp:
  Update testcases
ndb/test/ndbapi/testScan.cpp:
  ScanWitoutOpenScan isn't really relevent anymore
parent 854fe530
......@@ -448,6 +448,8 @@ NdbScanOperation::executeCursor(int nodeId){
return -1;
}
#define DEBUG_NEXT_RESULT 0
int NdbScanOperation::nextResult(bool fetchAllowed)
{
if(m_ordered)
......@@ -459,6 +461,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
int retVal = 2;
Uint32 idx = m_current_api_receiver;
Uint32 last = m_api_receivers_count;
if(DEBUG_NEXT_RESULT)
ndbout_c("nextResult(%d) idx=%d last=%d", fetchAllowed, idx, last);
/**
* Check next buckets
......@@ -497,6 +502,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
Uint32 cnt = m_conf_receivers_count;
Uint32 sent = m_sent_receivers_count;
if(DEBUG_NEXT_RESULT)
ndbout_c("idx=%d last=%d cnt=%d sent=%d", idx, last, cnt, sent);
if(cnt > 0){
/**
......@@ -527,6 +535,7 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
theNdb->theWaiter.m_state = WAIT_SCAN;
int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) {
theError.code = -1; // make sure user gets error if he tries again
return 1;
}
retVal = -1; //return_code;
......@@ -1193,8 +1202,6 @@ NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols,
return 0;
}
#define DEBUG_NEXT_RESULT 0
int
NdbIndexScanOperation::next_result_ordered(bool fetchAllowed){
......
......@@ -79,9 +79,9 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
const int retryMax = 100;
int sleepTime = 10;
int check;
NdbConnection *pTrans;
NdbScanOperation *pOp;
NdbResultSet *rs;
NdbConnection *pTrans = 0;
NdbScanOperation *pOp = 0;
NdbResultSet *rs = 0;
while (true){
if (retryAttempt >= retryMax){
......@@ -104,78 +104,75 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
}
// Execute the scan without defining a scan operation
if(action != ExecuteScanWithOutOpenScan){
pOp = pTrans->getNdbScanOperation(tab.getName());
if (pOp == NULL) {
pOp = pTrans->getNdbScanOperation(tab.getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
rs = pOp->readTuples(exclusive ?
NdbScanOperation::LM_Exclusive :
NdbScanOperation::LM_Read);
if( rs == 0 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (action == OnlyOpenScanOnce){
// Call openScan one more time when it's already defined
NdbResultSet* rs2 = pOp->readTuples(NdbScanOperation::LM_Read);
if( rs2 == 0 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
rs = pOp->readTuples(exclusive ?
NdbScanOperation::LM_Exclusive :
NdbScanOperation::LM_Read);
if( rs == 0 ) {
}
if (action==EqualAfterOpenScan){
check = pOp->equal(tab.getColumn(0)->getName(), 10);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (action == OnlyOpenScanOnce){
// Call openScan one more time when it's already defined
NdbResultSet* rs2 = pOp->readTuples(NdbScanOperation::LM_Read);
if( rs2 == 0 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
}
if (action==EqualAfterOpenScan){
check = pOp->equal(tab.getColumn(0)->getName(), 10);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
}
check = pOp->interpret_exit_ok();
if( check == -1 ) {
}
}
check = pOp->interpret_exit_ok();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
for(int a = 0; a<tab.getNoOfColumns(); a++){
if(pOp->getValue(tab.getColumn(a)->getName()) == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
for(int a = 0; a<tab.getNoOfColumns(); a++){
if(pOp->getValue(tab.getColumn(a)->getName()) == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
}
}
}
check = pTrans->execute(NoCommit);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
int abortCount = records / 10;
bool abortTrans = (action==CloseWithoutStop);
int eof;
int rows = 0;
eof = rs->nextResult();
while(eof == 0){
rows++;
if (abortCount == rows && abortTrans == true){
g_info << "Scan is aborted after "<<abortCount<<" rows" << endl;
......
......@@ -805,26 +805,9 @@ int runOnlyOneOpInScanTrans(NDBT_Context* ctx, NDBT_Step* step){
}
int runExecuteScanWithoutOpenScan(NDBT_Context* ctx, NDBT_Step* step){
const NdbDictionary::Table* pTab = ctx->getTab();
int records = ctx->getNumRecords();
int numFailed = 0;
ScanFunctions scanF(*pTab);
if (scanF.scanReadFunctions(GETNDB(step),
records,
1,
ScanFunctions::ExecuteScanWithOutOpenScan,
false) == 0){
numFailed++;
}
if(numFailed > 0)
return NDBT_FAILED;
else
return NDBT_OK;
return NDBT_OK;
}
int runOnlyOneOpBeforeOpenScan(NDBT_Context* ctx, NDBT_Step* step){
const NdbDictionary::Table* pTab = ctx->getTab();
int records = ctx->getNumRecords();
......
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