19 #ifndef SCAN_INTERPRET_TEST_HPP
20 #define SCAN_INTERPRET_TEST_HPP
22 #include "ScanFilter.hpp"
37 int scanReadVerify(
Ndb*,
42 int addRowToInsert(
Ndb* pNdb,
44 int addRowToCheckTrans(
Ndb* pNdb,
56 ScanInterpretTest::addRowToInsert(
Ndb* pNdb,
128 ScanInterpretTest::addRowToCheckTrans(
Ndb* pNdb,
194 ScanInterpretTest::scanRead(
Ndb* pNdb,
198 int retryAttempt = 0;
206 if (retryAttempt >= retryMax){
207 ndbout <<
"ERROR: has retried this operation " << retryAttempt
208 <<
" times, failing!" << endl;
213 if (pTrans == NULL) {
217 NdbSleep_MilliSleep(50);
238 if (filter.filterOp(pOp) != 0){
246 if((row.attributeStore(a) =
253 check = pTrans->
execute(NoCommit);
266 if (addRowToInsert(pNdb, pTrans) != 0){
272 check = pTrans->
execute(Commit);
286 NdbSleep_MilliSleep(50);
297 g_info << rows <<
" rows have been scanned" << endl;
306 ScanInterpretTest::scanReadVerify(
Ndb* pNdb,
310 int retryAttempt = 0;
311 const int retryMax = 100;
318 if (retryAttempt >= retryMax){
319 ndbout <<
"ERROR: has retried this operation " << retryAttempt
320 <<
" times, failing!" << endl;
325 if (pTrans == NULL) {
329 NdbSleep_MilliSleep(50);
339 if (pOp == NULL) {
if (pOp->
getValue(
"KOL2") == 0){
358 if((row.attributeStore(a) =
365 check = pTrans->
execute(NoCommit);
376 int existingRecordsNotFound = 0;
377 int nonExistingRecordsFound = 0;
385 if (pExistTrans == NULL) {
391 if (pNoExistTrans == NULL) {
398 if (filter.verifyRecord(row) == NDBT_OK){
400 if (addRowToCheckTrans(pNdb, pExistTrans) != 0){
408 if (addRowToCheckTrans(pNdb, pNoExistTrans) != 0){
420 check = pExistTrans->
execute(Commit);
424 if (err.
code != 626){
432 existingRecordsNotFound = 1;
439 check = pNoExistTrans->
execute(Commit, CommitAsMuchAsPossible);
443 if (err.
code != 626){
454 if (err.
code != 626){
455 ndbout <<
"err.code = " << err.
code<< endl;
456 nonExistingRecordsFound = 1;
471 NdbSleep_MilliSleep(50);
480 int testResult = NDBT_OK;
483 if (utilTrans.selectCount(pNdb,
488 if (existingRecordsNotFound == 1){
489 ndbout <<
"!!! Expected records not found" << endl;
490 testResult = NDBT_FAILED;
492 if (nonExistingRecordsFound == 1){
493 ndbout <<
"!!! Unxpected records found" << endl;
494 testResult = NDBT_FAILED;
496 ndbout << rows <<
" rows scanned("
497 << rowsExist <<
" found, " << rowsResult<<
" expected)" << endl;
498 if (rowsResult != rowsExist){
499 ndbout <<
"!!! Number of rows in result table different from expected" << endl;
500 testResult = NDBT_FAILED;