Commit 4915b228 authored by joreland@mysql.com's avatar joreland@mysql.com

wl1671 - bug fixes for negative tests

parent 84883229
...@@ -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)
...@@ -459,6 +461,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed) ...@@ -459,6 +461,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
int retVal = 2; int retVal = 2;
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
...@@ -497,6 +502,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed) ...@@ -497,6 +502,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){
/** /**
...@@ -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,78 +104,75 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -104,78 +104,75 @@ 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());
if (pOp == NULL) {
pOp = pTrans->getNdbScanOperation(tab.getName()); ERR(pTrans->getNdbError());
if (pOp == NULL) { 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()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
} }
}
rs = pOp->readTuples(exclusive ? if (action==EqualAfterOpenScan){
NdbScanOperation::LM_Exclusive : check = pOp->equal(tab.getColumn(0)->getName(), 10);
NdbScanOperation::LM_Read); if( check == -1 ) {
if( rs == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
} }
}
if (action == OnlyOpenScanOnce){ check = pOp->interpret_exit_ok();
// Call openScan one more time when it's already defined if( check == -1 ) {
NdbResultSet* rs2 = pOp->readTuples(NdbScanOperation::LM_Read); ERR(pTrans->getNdbError());
if( rs2 == 0 ) { pNdb->closeTransaction(pTrans);
ERR(pTrans->getNdbError()); return NDBT_FAILED;
pNdb->closeTransaction(pTrans); }
return NDBT_FAILED;
} for(int a = 0; a<tab.getNoOfColumns(); a++){
} if(pOp->getValue(tab.getColumn(a)->getName()) == NULL) {
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 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; 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); check = pTrans->execute(NoCommit);
if( check == -1 ) { if( check == -1 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
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;
int rows = 0; int rows = 0;
eof = rs->nextResult(); eof = rs->nextResult();
while(eof == 0){ while(eof == 0){
rows++; rows++;
if (abortCount == rows && abortTrans == true){ if (abortCount == rows && abortTrans == true){
g_info << "Scan is aborted after "<<abortCount<<" rows" << endl; g_info << "Scan is aborted after "<<abortCount<<" rows" << endl;
......
...@@ -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(); return NDBT_OK;
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;
} }
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