1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge mysql.com:/home/jonas/src/mysql-4.1-ndb

into mysql.com:/home/jonas/src/wl1873


ndb/include/ndbapi/NdbScanOperation.hpp:
  Auto merged
ndb/src/ndbapi/NdbResultSet.cpp:
  Auto merged
ndb/src/ndbapi/NdbScanOperation.cpp:
  Auto merged
ndb/test/ndbapi/testScan.cpp:
  Auto merged
This commit is contained in:
unknown
2004-07-06 11:34:26 +02:00
5 changed files with 195 additions and 0 deletions

View File

@@ -881,6 +881,93 @@ int runCheckInactivityBeforeClose(NDBT_Context* ctx, NDBT_Step* step){
}
int runScanRestart(NDBT_Context* ctx, NDBT_Step* step){
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
Ndb * pNdb = GETNDB(step);
const NdbDictionary::Table* pTab = ctx->getTab();
HugoCalculator calc(* pTab);
NDBT_ResultRow tmpRow(* pTab);
int i = 0;
while (i<loops && !ctx->isTestStopped()) {
g_info << i++ << ": ";
const int record = (rand() % records);
g_info << " row=" << record;
NdbConnection* pCon = pNdb->startTransaction();
NdbScanOperation* pOp = pCon->getNdbScanOperation(pTab->getName());
if (pOp == NULL) {
ERR(pCon->getNdbError());
return NDBT_FAILED;
}
NdbResultSet* rs = pOp->readTuples();
if( rs == 0 ) {
ERR(pCon->getNdbError());
return NDBT_FAILED;
}
int check = pOp->interpret_exit_ok();
if( check == -1 ) {
ERR(pCon->getNdbError());
return NDBT_FAILED;
}
// Define attributes to read
for(int a = 0; a<pTab->getNoOfColumns(); a++){
if((tmpRow.attributeStore(a) =
pOp->getValue(pTab->getColumn(a)->getName())) == 0) {
ERR(pCon->getNdbError());
return NDBT_FAILED;
}
}
check = pCon->execute(NoCommit);
if( check == -1 ) {
ERR(pCon->getNdbError());
return NDBT_FAILED;
}
int res;
int row = 0;
while(row < record && (res = rs->nextResult()) == 0) {
if(calc.verifyRowValues(&tmpRow) != 0){
abort();
return NDBT_FAILED;
}
row++;
}
if(row != record){
ERR(pCon->getNdbError());
abort();
return NDBT_FAILED;
}
g_info << " restarting" << endl;
if((res = rs->restart()) != 0){
ERR(pCon->getNdbError());
abort();
return NDBT_FAILED;
}
row = 0;
while((res = rs->nextResult()) == 0) {
if(calc.verifyRowValues(&tmpRow) != 0){
abort();
return NDBT_FAILED;
}
row++;
}
if(res != 1 || row != records){
ERR(pCon->getNdbError());
abort();
return NDBT_FAILED;
}
pCon->close();
}
return NDBT_OK;
}
NDBT_TESTSUITE(testScan);
@@ -1304,6 +1391,12 @@ TESTCASE("ScanReadWhileNodeIsDown",
STEP(runStopAndStartNode);
FINALIZER(runClearTable);
}
TESTCASE("ScanRestart",
"Verify restart functionallity"){
INITIALIZER(runLoadTable);
STEP(runScanRestart);
FINALIZER(runClearTable);
}
NDBT_TESTSUITE_END(testScan);
int main(int argc, const char** argv){