mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
Test prg update
- make test node restart test harder
This commit is contained in:
parent
07359aef31
commit
46b2eae096
11 changed files with 180 additions and 137 deletions
|
@ -3379,8 +3379,6 @@ void Dbtc::releaseSimpleRead(Signal* signal,
|
|||
(state == CS_START_COMMITTING ? CS_CONNECTED : state);
|
||||
setApiConTimer(regApiPtr.i, 0, __LINE__);
|
||||
|
||||
if(state != regApiPtr.p->apiConnectstate)
|
||||
ndbout_c("resettting state from %d to %d", state, regApiPtr.p->apiConnectstate);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,16 +38,8 @@ public:
|
|||
|
||||
int pkReadRecord(Ndb*,
|
||||
int recordNo,
|
||||
bool exclusive = false,
|
||||
int numRecords = 1);
|
||||
|
||||
int pkSimpleReadRecord(Ndb*,
|
||||
int recordNo,
|
||||
int numRecords = 1);
|
||||
|
||||
int pkDirtyReadRecord(Ndb*,
|
||||
int recordNo,
|
||||
int numRecords = 1);
|
||||
int numRecords = 1,
|
||||
NdbOperation::LockMode lm = NdbOperation::LM_Read);
|
||||
|
||||
int pkUpdateRecord(Ndb*,
|
||||
int recordNo,
|
||||
|
|
|
@ -48,8 +48,8 @@ public:
|
|||
int pkReadRecords(Ndb*,
|
||||
int records,
|
||||
int batchsize = 1,
|
||||
bool dirty = false);
|
||||
|
||||
NdbOperation::LockMode = NdbOperation::LM_Read);
|
||||
|
||||
int scanUpdateRecords(Ndb*,
|
||||
int records,
|
||||
int abort = 0,
|
||||
|
|
|
@ -160,8 +160,8 @@ int runPkDirtyRead(NDBT_Context* ctx, NDBT_Step* step){
|
|||
HugoTransactions hugoTrans(*ctx->getTab());
|
||||
while (i<loops) {
|
||||
g_info << i << ": ";
|
||||
if (hugoTrans.pkReadRecords(GETNDB(step), records,
|
||||
batchSize, dirty) != NDBT_OK){
|
||||
if (hugoTrans.pkReadRecords(GETNDB(step), records, batchSize,
|
||||
NdbOperation::LM_CommittedRead) != NDBT_OK){
|
||||
g_info << endl;
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ int runCheckRollbackUpdate(NDBT_Context* ctx, NDBT_Step* step){
|
|||
|
||||
// Read value and save it for later
|
||||
CHECK(hugoOps.startTransaction(pNdb) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 1, false, numRecords) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 1, numRecords) == 0);
|
||||
CHECK(hugoOps.execute_Commit(pNdb) == 0);
|
||||
CHECK(hugoOps.verifyUpdatesValue(0) == NDBT_OK); // Update value 0
|
||||
CHECK(hugoOps.closeTransaction(pNdb) == 0);
|
||||
|
@ -747,7 +747,7 @@ int runCheckRollbackUpdate(NDBT_Context* ctx, NDBT_Step* step){
|
|||
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
|
||||
|
||||
// Check record is updated
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 1, true, numRecords) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 1, numRecords, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
|
||||
CHECK(hugoOps.verifyUpdatesValue(5) == NDBT_OK); // Updates value 5
|
||||
CHECK(hugoOps.execute_Rollback(pNdb) == 0);
|
||||
|
@ -756,7 +756,7 @@ int runCheckRollbackUpdate(NDBT_Context* ctx, NDBT_Step* step){
|
|||
|
||||
// Check record is back to original value
|
||||
CHECK(hugoOps.startTransaction(pNdb) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 1, true, numRecords) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 1, numRecords, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_Commit(pNdb) == 0);
|
||||
CHECK(hugoOps.verifyUpdatesValue(0) == NDBT_OK); // Updates value 0
|
||||
|
||||
|
@ -775,7 +775,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
|
|||
do{
|
||||
// Read value and save it for later
|
||||
CHECK(hugoOps.startTransaction(pNdb) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, false, 10) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, 10) == 0);
|
||||
CHECK(hugoOps.execute_Commit(pNdb) == 0);
|
||||
CHECK(hugoOps.verifyUpdatesValue(0) == NDBT_OK);
|
||||
CHECK(hugoOps.closeTransaction(pNdb) == 0);
|
||||
|
@ -785,7 +785,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
|
|||
for(Uint32 i = 0; i<1; i++){
|
||||
// Read record 5 - 10
|
||||
CHECK(hugoOps.startTransaction(pNdb) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
|
||||
|
||||
for(j = 0; j<10; j++){
|
||||
|
@ -794,7 +794,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
|
|||
CHECK(hugoOps.pkUpdateRecord(pNdb, 5, 10, updatesValue) == 0);
|
||||
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
|
||||
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
|
||||
CHECK(hugoOps.verifyUpdatesValue(updatesValue) == 0);
|
||||
}
|
||||
|
@ -806,7 +806,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
|
|||
|
||||
#if 0
|
||||
// Check records are deleted
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_NoCommit(pNdb) == 626);
|
||||
#endif
|
||||
|
||||
|
@ -814,7 +814,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
|
|||
CHECK(hugoOps.pkInsertRecord(pNdb, 5, 10, updatesValue) == 0);
|
||||
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
|
||||
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
|
||||
CHECK(hugoOps.verifyUpdatesValue(updatesValue) == 0);
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
|
|||
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
|
||||
|
||||
// Check records are deleted
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_NoCommit(pNdb) == 626);
|
||||
CHECK(hugoOps.execute_Rollback(pNdb) == 0);
|
||||
|
||||
|
@ -833,7 +833,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
|
|||
// Check records are not deleted
|
||||
// after rollback
|
||||
CHECK(hugoOps.startTransaction(pNdb) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_Commit(pNdb) == 0);
|
||||
CHECK(hugoOps.verifyUpdatesValue(0) == NDBT_OK);
|
||||
|
||||
|
@ -889,7 +889,7 @@ int runCheckCommitDelete(NDBT_Context* ctx, NDBT_Step* step){
|
|||
do{
|
||||
// Read 10 records
|
||||
CHECK(hugoOps.startTransaction(pNdb) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
|
||||
|
||||
// Update 10 records
|
||||
|
@ -905,7 +905,7 @@ int runCheckCommitDelete(NDBT_Context* ctx, NDBT_Step* step){
|
|||
|
||||
// Check record's are deleted
|
||||
CHECK(hugoOps.startTransaction(pNdb) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_Commit(pNdb) == 626);
|
||||
|
||||
}while(false);
|
||||
|
@ -930,7 +930,7 @@ int runRollbackNothing(NDBT_Context* ctx, NDBT_Step* step){
|
|||
|
||||
// Check records are not deleted
|
||||
CHECK(hugoOps.startTransaction(pNdb) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0);
|
||||
CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0);
|
||||
CHECK(hugoOps.execute_Commit(pNdb) == 0);
|
||||
CHECK(hugoOps.closeTransaction(pNdb) == 0);
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ int runTestMaxOperations(NDBT_Context* ctx, NDBT_Step* step){
|
|||
int i = 0;
|
||||
while (errors < maxErrors){
|
||||
|
||||
if(hugoOps.pkReadRecord(pNdb,1, false, 1) != NDBT_OK){
|
||||
if(hugoOps.pkReadRecord(pNdb,1, 1) != NDBT_OK){
|
||||
errors++;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -100,11 +100,16 @@ int runScanReadUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
|
|||
int runPkReadUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
|
||||
int result = NDBT_OK;
|
||||
int records = ctx->getNumRecords();
|
||||
NdbOperation::LockMode lm =
|
||||
(NdbOperation::LockMode)ctx->getProperty("ReadLockMode",
|
||||
(Uint32)NdbOperation::LM_Read);
|
||||
int i = 0;
|
||||
HugoTransactions hugoTrans(*ctx->getTab());
|
||||
while (ctx->isTestStopped() == false) {
|
||||
g_info << i << ": ";
|
||||
if (hugoTrans.pkReadRecords(GETNDB(step), records, 128) != 0){
|
||||
int rows = (rand()%records)+1;
|
||||
int batch = (rand()%rows)+1;
|
||||
if (hugoTrans.pkReadRecords(GETNDB(step), rows, batch, lm) != 0){
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
i++;
|
||||
|
@ -119,7 +124,9 @@ int runPkUpdateUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
|
|||
HugoTransactions hugoTrans(*ctx->getTab());
|
||||
while (ctx->isTestStopped() == false) {
|
||||
g_info << i << ": ";
|
||||
if (hugoTrans.pkUpdateRecords(GETNDB(step), records) != 0){
|
||||
int rows = (rand()%records)+1;
|
||||
int batch = (rand()%rows)+1;
|
||||
if (hugoTrans.pkUpdateRecords(GETNDB(step), rows, batch) != 0){
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
i++;
|
||||
|
@ -127,6 +134,60 @@ int runPkUpdateUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
|
|||
return result;
|
||||
}
|
||||
|
||||
int runPkReadPkUpdateUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
|
||||
int result = NDBT_OK;
|
||||
int records = ctx->getNumRecords();
|
||||
Ndb* pNdb = GETNDB(step);
|
||||
int i = 0;
|
||||
HugoOperations hugoOps(*ctx->getTab());
|
||||
while (ctx->isTestStopped() == false) {
|
||||
g_info << i++ << ": ";
|
||||
int rows = (rand()%records)+1;
|
||||
int batch = (rand()%rows)+1;
|
||||
int row = (records - rows) ? rand() % (records - rows) : 0;
|
||||
|
||||
int j,k;
|
||||
for(j = 0; j<rows; j += batch)
|
||||
{
|
||||
k = batch;
|
||||
if(j+k > rows)
|
||||
k = rows - j;
|
||||
|
||||
if(hugoOps.startTransaction(pNdb) != 0)
|
||||
goto err;
|
||||
|
||||
if(hugoOps.pkReadRecord(pNdb, row+j, k, NdbOperation::LM_Exclusive) != 0)
|
||||
goto err;
|
||||
|
||||
if(hugoOps.execute_NoCommit(pNdb) != 0)
|
||||
goto err;
|
||||
|
||||
if(hugoOps.pkUpdateRecord(pNdb, row+j, k, rand()) != 0)
|
||||
goto err;
|
||||
|
||||
if(hugoOps.execute_Commit(pNdb) != 0)
|
||||
goto err;
|
||||
|
||||
if(hugoOps.closeTransaction(pNdb) != 0)
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
continue;
|
||||
err:
|
||||
NdbConnection* pCon = hugoOps.getTransaction();
|
||||
if(pCon == 0)
|
||||
continue;
|
||||
NdbError error = pCon->getNdbError();
|
||||
hugoOps.closeTransaction(pNdb);
|
||||
if (error.status == NdbError::TemporaryError){
|
||||
NdbSleep_MilliSleep(50);
|
||||
continue;
|
||||
}
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
return NDBT_OK;
|
||||
}
|
||||
|
||||
int runScanUpdateUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
|
||||
int result = NDBT_OK;
|
||||
int records = ctx->getNumRecords();
|
||||
|
@ -178,7 +239,7 @@ int runRestarter(NDBT_Context* ctx, NDBT_Step* step){
|
|||
int id = lastId % restarter.getNumDbNodes();
|
||||
int nodeId = restarter.getDbNodeId(id);
|
||||
ndbout << "Restart node " << nodeId << endl;
|
||||
if(restarter.restartOneDbNode(nodeId) != 0){
|
||||
if(restarter.restartOneDbNode(nodeId, false, false, true) != 0){
|
||||
g_err << "Failed to restartNextDbNode" << endl;
|
||||
result = NDBT_FAILED;
|
||||
break;
|
||||
|
@ -246,6 +307,27 @@ TESTCASE("NoLoad",
|
|||
TESTCASE("PkRead",
|
||||
"Test that one node at a time can be stopped and then restarted "\
|
||||
"perform pk read while restarting. Do this loop number of times"){
|
||||
TC_PROPERTY("ReadLockMode", NdbOperation::LM_Read);
|
||||
INITIALIZER(runCheckAllNodesStarted);
|
||||
INITIALIZER(runLoadTable);
|
||||
STEP(runRestarter);
|
||||
STEP(runPkReadUntilStopped);
|
||||
FINALIZER(runClearTable);
|
||||
}
|
||||
TESTCASE("PkReadCommitted",
|
||||
"Test that one node at a time can be stopped and then restarted "\
|
||||
"perform pk read while restarting. Do this loop number of times"){
|
||||
TC_PROPERTY("ReadLockMode", NdbOperation::LM_CommittedRead);
|
||||
INITIALIZER(runCheckAllNodesStarted);
|
||||
INITIALIZER(runLoadTable);
|
||||
STEP(runRestarter);
|
||||
STEP(runPkReadUntilStopped);
|
||||
FINALIZER(runClearTable);
|
||||
}
|
||||
TESTCASE("MixedPkRead",
|
||||
"Test that one node at a time can be stopped and then restarted "\
|
||||
"perform pk read while restarting. Do this loop number of times"){
|
||||
TC_PROPERTY("ReadLockMode", -1);
|
||||
INITIALIZER(runCheckAllNodesStarted);
|
||||
INITIALIZER(runLoadTable);
|
||||
STEP(runRestarter);
|
||||
|
@ -255,14 +337,31 @@ TESTCASE("PkRead",
|
|||
TESTCASE("PkReadPkUpdate",
|
||||
"Test that one node at a time can be stopped and then restarted "\
|
||||
"perform pk read and pk update while restarting. Do this loop number of times"){
|
||||
TC_PROPERTY("ReadLockMode", NdbOperation::LM_Read);
|
||||
INITIALIZER(runCheckAllNodesStarted);
|
||||
INITIALIZER(runLoadTable);
|
||||
STEP(runRestarter);
|
||||
STEP(runPkReadUntilStopped);
|
||||
STEP(runPkReadUntilStopped);
|
||||
STEP(runPkReadUntilStopped);
|
||||
STEP(runPkUpdateUntilStopped);
|
||||
STEP(runPkReadPkUpdateUntilStopped);
|
||||
STEP(runPkReadUntilStopped);
|
||||
STEP(runPkUpdateUntilStopped);
|
||||
STEP(runPkReadPkUpdateUntilStopped);
|
||||
FINALIZER(runClearTable);
|
||||
}
|
||||
TESTCASE("MixedPkReadPkUpdate",
|
||||
"Test that one node at a time can be stopped and then restarted "\
|
||||
"perform pk read and pk update while restarting. Do this loop number of times"){
|
||||
TC_PROPERTY("ReadLockMode", -1);
|
||||
INITIALIZER(runCheckAllNodesStarted);
|
||||
INITIALIZER(runLoadTable);
|
||||
STEP(runRestarter);
|
||||
STEP(runPkReadUntilStopped);
|
||||
STEP(runPkUpdateUntilStopped);
|
||||
STEP(runPkReadPkUpdateUntilStopped);
|
||||
STEP(runPkReadUntilStopped);
|
||||
STEP(runPkUpdateUntilStopped);
|
||||
STEP(runPkReadPkUpdateUntilStopped);
|
||||
FINALIZER(runClearTable);
|
||||
}
|
||||
TESTCASE("ReadUpdateScan",
|
||||
|
@ -273,6 +372,21 @@ TESTCASE("ReadUpdateScan",
|
|||
STEP(runRestarter);
|
||||
STEP(runPkReadUntilStopped);
|
||||
STEP(runPkUpdateUntilStopped);
|
||||
STEP(runPkReadPkUpdateUntilStopped);
|
||||
STEP(runScanReadUntilStopped);
|
||||
STEP(runScanUpdateUntilStopped);
|
||||
FINALIZER(runClearTable);
|
||||
}
|
||||
TESTCASE("MixedReadUpdateScan",
|
||||
"Test that one node at a time can be stopped and then restarted "\
|
||||
"perform pk read, pk update and scan reads while restarting. Do this loop number of times"){
|
||||
TC_PROPERTY("ReadLockMode", -1);
|
||||
INITIALIZER(runCheckAllNodesStarted);
|
||||
INITIALIZER(runLoadTable);
|
||||
STEP(runRestarter);
|
||||
STEP(runPkReadUntilStopped);
|
||||
STEP(runPkUpdateUntilStopped);
|
||||
STEP(runPkReadPkUpdateUntilStopped);
|
||||
STEP(runScanReadUntilStopped);
|
||||
STEP(runScanUpdateUntilStopped);
|
||||
FINALIZER(runClearTable);
|
||||
|
|
|
@ -110,13 +110,13 @@ runOp(HugoOperations & hugoOps,
|
|||
return NDBT_FAILED; }}
|
||||
|
||||
if(strcmp(op, "READ") == 0){
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, false, 1), 0);
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Read), 0);
|
||||
} else if(strcmp(op, "READ-EX") == 0){
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, true, 1), 0);
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive), 0);
|
||||
} else if(strcmp(op, "S-READ") == 0){
|
||||
C2(hugoOps.pkSimpleReadRecord(pNdb, 1, 1), 0);
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Read), 0);
|
||||
} else if(strcmp(op, "D-READ") == 0){
|
||||
C2(hugoOps.pkDirtyReadRecord(pNdb, 1, 1), 0);
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_CommittedRead), 0);
|
||||
} else if(strcmp(op, "INSERT") == 0){
|
||||
C2(hugoOps.pkInsertRecord(pNdb, 1, 1, value), 0);
|
||||
} else if(strcmp(op, "UPDATE") == 0){
|
||||
|
|
|
@ -190,13 +190,13 @@ runOp(HugoOperations & hugoOps,
|
|||
return NDBT_FAILED; }
|
||||
|
||||
if(strcmp(op, "READ") == 0){
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, false, 1) == 0);
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Read) == 0);
|
||||
} else if(strcmp(op, "READ-EX") == 0){
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, true, 1) == 0);
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0);
|
||||
} else if(strcmp(op, "S-READ") == 0){
|
||||
C2(hugoOps.pkSimpleReadRecord(pNdb, 1, 1) == 0);
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Read) == 0);
|
||||
} else if(strcmp(op, "D-READ") == 0){
|
||||
C2(hugoOps.pkDirtyReadRecord(pNdb, 1, 1) == 0);
|
||||
C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_CommittedRead) == 0);
|
||||
} else if(strcmp(op, "INSERT") == 0){
|
||||
C2(hugoOps.pkInsertRecord(pNdb, 1, 1, value) == 0);
|
||||
} else if(strcmp(op, "UPDATE") == 0){
|
||||
|
|
|
@ -63,15 +63,15 @@ args: -n NoLoad T6 T8 T13
|
|||
|
||||
max-time: 2500
|
||||
cmd: testNodeRestart
|
||||
args: -n PkRead T6 T8 T13
|
||||
args: -n MixedPkRead T6 T8 T13
|
||||
|
||||
max-time: 2500
|
||||
cmd: testNodeRestart
|
||||
args: -l 1 -n PkReadPkUpdate
|
||||
args: -l 1 -n MixedPkReadPkUpdate
|
||||
|
||||
max-time: 2500
|
||||
cmd: testNodeRestart
|
||||
args: -l 1 -n ReadUpdateScan
|
||||
args: -l 1 -n MixedReadUpdateScan
|
||||
|
||||
max-time: 2500
|
||||
cmd: testNodeRestart
|
||||
|
|
|
@ -52,8 +52,8 @@ NdbConnection* HugoOperations::getTransaction(){
|
|||
|
||||
int HugoOperations::pkReadRecord(Ndb* pNdb,
|
||||
int recordNo,
|
||||
bool exclusive,
|
||||
int numRecords){
|
||||
int numRecords,
|
||||
NdbOperation::LockMode lm){
|
||||
int a;
|
||||
allocRows(numRecords);
|
||||
int check;
|
||||
|
@ -64,94 +64,22 @@ int HugoOperations::pkReadRecord(Ndb* pNdb,
|
|||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
if (exclusive == true)
|
||||
check = pOp->readTupleExclusive();
|
||||
else
|
||||
rand_lock_mode:
|
||||
switch(lm){
|
||||
case NdbOperation::LM_Read:
|
||||
check = pOp->readTuple();
|
||||
if( check == -1 ) {
|
||||
ERR(pTrans->getNdbError());
|
||||
return NDBT_FAILED;
|
||||
break;
|
||||
case NdbOperation::LM_Exclusive:
|
||||
check = pOp->readTupleExclusive();
|
||||
break;
|
||||
case NdbOperation::LM_CommittedRead:
|
||||
check = pOp->dirtyRead();
|
||||
break;
|
||||
default:
|
||||
lm = (NdbOperation::LockMode)((rand() >> 16) & 3);
|
||||
goto rand_lock_mode;
|
||||
}
|
||||
|
||||
// Define primary keys
|
||||
for(a = 0; a<tab.getNoOfColumns(); a++){
|
||||
if (tab.getColumn(a)->getPrimaryKey() == true){
|
||||
if(equalForAttr(pOp, a, r+recordNo) != 0){
|
||||
ERR(pTrans->getNdbError());
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Define attributes to read
|
||||
for(a = 0; a<tab.getNoOfColumns(); a++){
|
||||
if((rows[r]->attributeStore(a) =
|
||||
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
|
||||
ERR(pTrans->getNdbError());
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NDBT_OK;
|
||||
}
|
||||
|
||||
int HugoOperations::pkDirtyReadRecord(Ndb* pNdb,
|
||||
int recordNo,
|
||||
int numRecords){
|
||||
int a;
|
||||
allocRows(numRecords);
|
||||
int check;
|
||||
for(int r=0; r < numRecords; r++){
|
||||
NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
|
||||
if (pOp == NULL) {
|
||||
ERR(pTrans->getNdbError());
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
check = pOp->dirtyRead();
|
||||
|
||||
if( check == -1 ) {
|
||||
ERR(pTrans->getNdbError());
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
// Define primary keys
|
||||
for(a = 0; a<tab.getNoOfColumns(); a++){
|
||||
if (tab.getColumn(a)->getPrimaryKey() == true){
|
||||
if(equalForAttr(pOp, a, r+recordNo) != 0){
|
||||
ERR(pTrans->getNdbError());
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Define attributes to read
|
||||
for(a = 0; a<tab.getNoOfColumns(); a++){
|
||||
if((rows[r]->attributeStore(a) =
|
||||
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
|
||||
ERR(pTrans->getNdbError());
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NDBT_OK;
|
||||
}
|
||||
|
||||
int HugoOperations::pkSimpleReadRecord(Ndb* pNdb,
|
||||
int recordNo,
|
||||
int numRecords){
|
||||
int a;
|
||||
allocRows(numRecords);
|
||||
int check;
|
||||
for(int r=0; r < numRecords; r++){
|
||||
NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
|
||||
if (pOp == NULL) {
|
||||
ERR(pTrans->getNdbError());
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
check = pOp->simpleRead();
|
||||
|
||||
if( check == -1 ) {
|
||||
ERR(pTrans->getNdbError());
|
||||
return NDBT_FAILED;
|
||||
|
|
|
@ -1230,7 +1230,7 @@ int
|
|||
HugoTransactions::pkReadRecords(Ndb* pNdb,
|
||||
int records,
|
||||
int batchsize,
|
||||
bool dirty){
|
||||
NdbOperation::LockMode lm){
|
||||
int reads = 0;
|
||||
int r = 0;
|
||||
int retryAttempt = 0;
|
||||
|
@ -1275,11 +1275,22 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
|
|||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
if (dirty == true){
|
||||
check = pOp->dirtyRead();
|
||||
} else {
|
||||
rand_lock_mode:
|
||||
switch(lm){
|
||||
case NdbOperation::LM_Read:
|
||||
check = pOp->readTuple();
|
||||
break;
|
||||
case NdbOperation::LM_Exclusive:
|
||||
check = pOp->readTupleExclusive();
|
||||
break;
|
||||
case NdbOperation::LM_CommittedRead:
|
||||
check = pOp->dirtyRead();
|
||||
break;
|
||||
default:
|
||||
lm = (NdbOperation::LockMode)((rand() >> 16) & 3);
|
||||
goto rand_lock_mode;
|
||||
}
|
||||
|
||||
if( check == -1 ) {
|
||||
ERR(pTrans->getNdbError());
|
||||
pNdb->closeTransaction(pTrans);
|
||||
|
|
Loading…
Reference in a new issue