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){ ...@@ -448,6 +448,8 @@ NdbScanOperation::executeCursor(int nodeId){
return -1; return -1;
} }
#define DEBUG_NEXT_RESULT 0
int NdbScanOperation::nextResult(bool fetchAllowed) int NdbScanOperation::nextResult(bool fetchAllowed)
{ {
if(m_ordered) if(m_ordered)
...@@ -460,6 +462,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed) ...@@ -460,6 +462,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
Uint32 idx = m_current_api_receiver; Uint32 idx = m_current_api_receiver;
Uint32 last = m_api_receivers_count; Uint32 last = m_api_receivers_count;
if(DEBUG_NEXT_RESULT)
ndbout_c("nextResult(%d) idx=%d last=%d", fetchAllowed, idx, last);
/** /**
* Check next buckets * Check next buckets
*/ */
...@@ -498,6 +503,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed) ...@@ -498,6 +503,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
Uint32 cnt = m_conf_receivers_count; Uint32 cnt = m_conf_receivers_count;
Uint32 sent = m_sent_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){ if(cnt > 0){
/** /**
* Just move completed receivers * Just move completed receivers
...@@ -527,6 +535,7 @@ int NdbScanOperation::nextResult(bool fetchAllowed) ...@@ -527,6 +535,7 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
theNdb->theWaiter.m_state = WAIT_SCAN; theNdb->theWaiter.m_state = WAIT_SCAN;
int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) { if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) {
theError.code = -1; // make sure user gets error if he tries again
return 1; return 1;
} }
retVal = -1; //return_code; retVal = -1; //return_code;
...@@ -1193,8 +1202,6 @@ NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols, ...@@ -1193,8 +1202,6 @@ NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols,
return 0; return 0;
} }
#define DEBUG_NEXT_RESULT 0
int int
NdbIndexScanOperation::next_result_ordered(bool fetchAllowed){ NdbIndexScanOperation::next_result_ordered(bool fetchAllowed){
......
...@@ -79,9 +79,9 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -79,9 +79,9 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
const int retryMax = 100; const int retryMax = 100;
int sleepTime = 10; int sleepTime = 10;
int check; int check;
NdbConnection *pTrans; NdbConnection *pTrans = 0;
NdbScanOperation *pOp; NdbScanOperation *pOp = 0;
NdbResultSet *rs; NdbResultSet *rs = 0;
while (true){ while (true){
if (retryAttempt >= retryMax){ if (retryAttempt >= retryMax){
...@@ -104,8 +104,6 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -104,8 +104,6 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
} }
// Execute the scan without defining a scan operation // Execute the scan without defining a scan operation
if(action != ExecuteScanWithOutOpenScan){
pOp = pTrans->getNdbScanOperation(tab.getName()); pOp = pTrans->getNdbScanOperation(tab.getName());
if (pOp == NULL) { if (pOp == NULL) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
...@@ -158,7 +156,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -158,7 +156,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
} }
}
check = pTrans->execute(NoCommit); check = pTrans->execute(NoCommit);
if( check == -1 ) { if( check == -1 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
...@@ -166,7 +164,6 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -166,7 +164,6 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
int abortCount = records / 10; int abortCount = records / 10;
bool abortTrans = (action==CloseWithoutStop); bool abortTrans = (action==CloseWithoutStop);
int eof; int eof;
......
...@@ -805,26 +805,9 @@ int runOnlyOneOpInScanTrans(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -805,26 +805,9 @@ int runOnlyOneOpInScanTrans(NDBT_Context* ctx, NDBT_Step* step){
} }
int runExecuteScanWithoutOpenScan(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){ int runOnlyOneOpBeforeOpenScan(NDBT_Context* ctx, NDBT_Step* step){
const NdbDictionary::Table* pTab = ctx->getTab(); const NdbDictionary::Table* pTab = ctx->getTab();
int records = ctx->getNumRecords(); 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