19 #include "HugoTransactions.hpp"
20 #include <NDBT_Stats.hpp>
29 m_defaultScanUpdateMethod = 3;
37 HugoTransactions::~HugoTransactions(){
56 if (retryAttempt >= m_retryMax){
57 g_err << __LINE__ <<
" ERROR: has retried this operation "
58 << retryAttempt <<
" times, failing!" << endl;
68 NdbSleep_MilliSleep(50);
76 pOp = getScanOperation(pTrans);
79 closeTransaction(pNdb);
83 if( pOp ->readTuples(lm, scan_flags, parallelism) ) {
85 closeTransaction(pNdb);
90 if((row.attributeStore(a) =
93 closeTransaction(pNdb);
98 check = pTrans->
execute(NoCommit, AbortOnError);
103 closeTransaction(pNdb);
104 NdbSleep_MilliSleep(50);
109 closeTransaction(pNdb);
115 int abortCount = ranVal % (records == 0 ? 100 : records);
116 bool abortTrans =
false;
119 if (abortCount < abortPercent)
127 if (calc.verifyRowValues(&row) != 0){
128 closeTransaction(pNdb);
132 if (abortCount == rows && abortTrans ==
true){
133 ndbout <<
"Scan is aborted" << endl;
134 g_info <<
"Scan is aborted" << endl;
138 closeTransaction(pNdb);
142 closeTransaction(pNdb);
151 closeTransaction(pNdb);
152 NdbSleep_MilliSleep(50);
162 if (retryAttempt >= (m_retryMax / 10) &&
163 (parallelism == 0 || parallelism > 1))
169 ndbout_c(
"decrease parallelism");
177 closeTransaction(pNdb);
181 closeTransaction(pNdb);
183 g_info << rows <<
" rows have been read" << endl;
184 if (records != 0 && rows != records){
185 g_err <<
"Check expected number of records failed" << endl
186 <<
" expected=" << records <<
", " << endl
187 <<
" read=" << rows << endl;
206 int retryAttempt = 0;
212 if (retryAttempt >= m_retryMax){
213 g_err << __LINE__ <<
" ERROR: has retried this operation "
214 << retryAttempt <<
" times, failing!" << endl;
215 g_err <<
"lm: " << Uint32(lm) <<
" flags: H'" << hex << scan_flags
221 if (pTrans == NULL) {
226 NdbSleep_MilliSleep(50);
237 closeTransaction(pNdb);
241 if( pOp ->readTuples(lm, scan_flags, parallelism) ) {
243 closeTransaction(pNdb);
248 if((row.attributeStore(a) =
251 closeTransaction(pNdb);
256 check = pTrans->
execute(NoCommit, AbortOnError);
261 closeTransaction(pNdb);
262 NdbSleep_MilliSleep(50);
267 closeTransaction(pNdb);
273 int abortCount = ranVal % (records == 0 ? 100 : records);
274 bool abortTrans =
false;
277 if (abortCount < abortPercent)
285 if (calc.verifyRowValues(&row) != 0){
286 closeTransaction(pNdb);
290 if (abortCount == rows && abortTrans ==
true){
291 ndbout <<
"Scan is aborted" << endl;
292 g_info <<
"Scan is aborted" << endl;
296 closeTransaction(pNdb);
300 closeTransaction(pNdb);
309 closeTransaction(pNdb);
310 NdbSleep_MilliSleep(50);
320 if (retryAttempt >= (m_retryMax / 10) &&
321 (parallelism == 0 || parallelism > 1))
327 ndbout_c(
"decrease parallelism");
329 else if (retryAttempt >= (m_retryMax / 5) &&
333 ndbout_c(
"switch to LM_CommittedRead");
335 else if (retryAttempt >= (m_retryMax / 4) &&
339 scan_flags |= NdbScanOperation::SF_TupScan;
340 ndbout_c(
"switch to table-scan (SF_TupScan) form index-scan");
348 closeTransaction(pNdb);
352 closeTransaction(pNdb);
354 g_info << rows <<
" rows have been read" << endl;
355 if (records != 0 && rows != records){
356 g_err <<
"Check expected number of records failed" << endl
357 <<
" expected=" << records <<
", " << endl
358 <<
" read=" << rows << endl;
368 #define RESTART_SCAN 99
371 HugoTransactions::scanUpdateRecords(
Ndb* pNdb,
376 int retryAttempt = 0;
382 if (retryAttempt++ >= m_retryMax){
383 g_info <<
"ERROR: has retried this operation " << retryAttempt
384 <<
" times, failing!" << endl;
389 if (pTrans == NULL) {
393 NdbSleep_MilliSleep(50);
399 pOp = getScanOperation(pTrans);
402 closeTransaction(pNdb);
409 closeTransaction(pNdb);
417 closeTransaction(pNdb);
422 check = pTrans->
execute(NoCommit, AbortOnError);
426 closeTransaction(pNdb);
428 NdbSleep_MilliSleep(50);
436 int abortCount = ranVal % (records == 0 ? 100 : records);
437 bool abortTrans =
false;
440 if (abortCount < abortPercent)
451 closeTransaction(pNdb);
454 const int updates = calc.getUpdatesValue(&row) + 1;
455 const int r = calc.getIdValue(&row);
459 if(setValueForAttr(pUp, a, r, updates ) != 0){
461 closeTransaction(pNdb);
467 if (rows == abortCount && abortTrans ==
true){
468 g_info <<
"Scan is aborted" << endl;
470 closeTransaction(pNdb);
473 }
while((check = pOp->
nextResult(
false)) == 0);
476 check = pTrans->
execute(Commit, AbortOnError);
478 m_latest_gci = pTrans->
getGCI();
484 closeTransaction(pNdb);
487 NdbSleep_MilliSleep(50);
496 closeTransaction(pNdb);
499 NdbSleep_MilliSleep(50);
505 closeTransaction(pNdb);
507 g_info << rows <<
" rows have been updated" << endl;
514 HugoTransactions::scanUpdateRecords(
Ndb* pNdb,
519 return scanUpdateRecords(pNdb,
521 records, abortPercent, parallelism);
527 HugoTransactions::scanUpdateRecords1(
Ndb* pNdb,
531 return scanUpdateRecords(pNdb,
533 records, abortPercent, 1);
541 HugoTransactions::scanUpdateRecords2(
Ndb* pNdb,
546 records, abortPercent, parallelism);
550 HugoTransactions::scanUpdateRecords3(
Ndb* pNdb,
556 records, abortPercent, parallelism);
560 HugoTransactions::loadTable(
Ndb* pNdb,
563 bool allowConstraintViolation,
569 return loadTableStartFrom(pNdb, 0, records, batch, allowConstraintViolation,
570 doSleep, oneTrans, value, abort);
574 HugoTransactions::loadTableStartFrom(
Ndb* pNdb,
578 bool allowConstraintViolation,
584 int retryAttempt = 0;
586 bool first_batch =
true;
588 const int org = batch;
590 const int brow = tab.getRowSizeInBytes();
591 const int bytes = 12 + brow + 4 * cols;
592 batch = (batch * 256);
594 batch = batch == 0 ? 1 : batch;
597 g_info <<
"batch = " << org <<
" rowsize = " << bytes
598 <<
" -> rows/commit = " << batch << endl;
602 g_info <<
"|- Inserting records..." << endl;
603 for (
int c=0 ; c<records; ){
604 bool closeTrans =
true;
606 if(c + batch > records)
609 if (retryAttempt >= retryMax){
610 g_info <<
"Record " << c <<
" could not be inserted, has retried "
611 << retryAttempt <<
" times " << endl;
617 NdbSleep_MilliSleep(doSleep);
620 if (first_batch || !pTrans) {
623 if (pTrans == NULL) {
628 NdbSleep_MilliSleep(50);
637 if(pkInsertRecord(pNdb, c + startFrom, batch, value) != NDBT_OK)
640 closeTransaction(pNdb);
645 if (!oneTrans || (c + batch) >= records) {
650 check = pTrans->
execute(Commit, AbortOnError);
652 pTrans->
getGCI(&m_latest_gci);
657 check = pTrans->
execute(NoCommit, AbortOnError);
660 check = pTrans->
execute( Rollback );
661 closeTransaction(pNdb);
666 check = pTrans->
execute(NoCommit, AbortOnError);
670 closeTransaction(pNdb);
675 g_info <<
"ERROR: NdbError reports success when transcaction failed"
682 NdbSleep_MilliSleep(50);
694 if (allowConstraintViolation ==
true){
698 g_info << c <<
": " << err.
code <<
" " << err.
message << endl;
713 closeTransaction(pNdb);
724 closeTransaction(pNdb);
729 HugoTransactions::fillTable(
Ndb* pNdb,
731 return fillTableStartFrom(pNdb, 0, batch);
735 HugoTransactions::fillTableStartFrom(
Ndb* pNdb,
739 int retryAttempt = 0;
742 const int org = batch;
744 const int brow = tab.getRowSizeInBytes();
745 const int bytes = 12 + brow + 4 * cols;
746 batch = (batch * 256);
748 batch = batch == 0 ? 1 : batch;
751 g_info <<
"batch = " << org <<
" rowsize = " << bytes
752 <<
" -> rows/commit = " << batch << endl;
755 for (
int c=startFrom ; ; ){
757 if (retryAttempt >= retryMax){
758 g_info <<
"Record " << c <<
" could not be inserted, has retried "
759 << retryAttempt <<
" times " << endl;
766 if (pTrans == NULL) {
771 NdbSleep_MilliSleep(50);
779 if(pkInsertRecord(pNdb, c, batch) != NDBT_OK)
782 closeTransaction(pNdb);
787 check = pTrans->
execute(Commit, CommitAsMuchAsPossible);
789 if(check == -1 || err.
code != 0) {
790 closeTransaction(pNdb);
795 g_info <<
"ERROR: NdbError reports success when transcaction failed"
802 NdbSleep_MilliSleep(50);
842 pTrans->
getGCI(&m_latest_gci);
843 closeTransaction(pNdb);
861 int retryAttempt = 0;
865 g_info <<
"ERROR: Argument batch == 0 in pkReadRecords(). Not allowed." << endl;
870 if(r + batch > records)
873 if (retryAttempt >= m_retryMax){
874 g_info <<
"ERROR: has retried this operation " << retryAttempt
875 <<
" times, failing!" << endl;
880 if (pTrans == NULL) {
885 NdbSleep_MilliSleep(50);
896 m_stats_latency != 0 &&
898 r + batch != records;
901 NdbTick_getMicroTimer(&timer_start);
906 if(pkReadRecord(pNdb, r, batch, lm, &lmused) != NDBT_OK)
909 closeTransaction(pNdb);
915 if(pkReadRandRecord(pNdb, records, batch, lm, &lmused) != NDBT_OK)
918 closeTransaction(pNdb);
923 check = pTrans->
execute(Commit, AbortOnError);
943 closeTransaction(pNdb);
944 NdbSleep_MilliSleep(50);
950 g_info << r <<
": " << err.
code <<
" " << err.
message << endl;
956 closeTransaction(pNdb);
961 if(indexScans.size() > 0)
965 for (Uint32 scanOp=0; scanOp < indexScans.size(); scanOp++)
967 while((check = indexScans[scanOp]->nextResult()) == 0)
970 if (calc.verifyRowValues(rows[0]) != 0){
971 closeTransaction(pNdb);
976 if(check != 1 || rows_found > batch)
978 closeTransaction(pNdb);
981 else if(rows_found < batch)
984 g_info << r <<
": not found" << endl; abort(); }
986 g_info <<
"Found " << rows_found <<
" of "
987 << batch <<
" rows" << endl;
994 for (
int b=0; (b<batch) && (r+b<records); b++){
995 if (calc.verifyRowValues(rows[b]) != 0){
996 closeTransaction(pNdb);
1005 closeTransaction(pNdb);
1008 NdbTick_getMicroTimer(&timer_stop);
1009 NDB_TICKS ticks = NdbTick_getMicrosPassed(timer_start, timer_stop);
1010 m_stats_latency->addObservation((
double)ticks);
1015 g_info << reads <<
" records read" << endl;
1022 HugoTransactions::pkUpdateRecords(
Ndb* pNdb,
1028 int retryAttempt = 0;
1033 g_info <<
"|- Updating records (batch=" << batch <<
")..." << endl;
1035 while (r < records){
1036 if(r + batch > records)
1037 batch = records - r;
1039 if (m_thr_count != 0 && m_thr_no != batch_no % m_thr_count)
1046 if (retryAttempt >= m_retryMax){
1047 g_info <<
"ERROR: has retried this operation " << retryAttempt
1048 <<
" times, failing!" << endl;
1053 NdbSleep_MilliSleep(doSleep);
1056 if (pTrans == NULL) {
1061 NdbSleep_MilliSleep(50);
1072 closeTransaction(pNdb);
1076 check = pTrans->
execute(NoCommit, AbortOnError);
1082 closeTransaction(pNdb);
1083 NdbSleep_MilliSleep(50);
1088 closeTransaction(pNdb);
1095 m_stats_latency != 0 &&
1097 r + batch != records;
1100 NdbTick_getMicroTimer(&timer_start);
1104 if(indexScans.size() > 0)
1107 for (Uint32 scanOp=0; scanOp < indexScans.size(); scanOp++)
1109 while((check = indexScans[scanOp]->nextResult(
true)) == 0)
1113 if (calc.verifyRowValues(rows[0]) != 0){
1114 g_info <<
"Row validation failure" << endl;
1115 closeTransaction(pNdb);
1119 int updates = calc.getUpdatesValue(rows[0]) + 1;
1125 const Uint32 rowId= calc.getIdValue(rows[0]);
1126 if(pkUpdateRecord(pNdb, rowId, 1, updates) != NDBT_OK)
1129 closeTransaction(pNdb);
1133 }
while((check = indexScans[scanOp]->nextResult(
false)) == 0);
1137 if((check = pTrans->
execute(NoCommit, AbortOnError)) != 0)
1143 g_info <<
"Check failed" << endl;
1144 closeTransaction(pNdb);
1149 if (rows_found != batch)
1151 g_info <<
"Incorrect num of rows found. Expected "
1152 << batch <<
". Found " << rows_found << endl;
1153 closeTransaction(pNdb);
1159 for(b = 0; b<batch && (b+r)<records; b++)
1161 if (calc.verifyRowValues(rows[b]) != 0)
1163 closeTransaction(pNdb);
1167 int updates = calc.getUpdatesValue(rows[b]) + 1;
1169 if(pkUpdateRecord(pNdb, r+b, 1, updates) != NDBT_OK)
1172 closeTransaction(pNdb);
1176 check = pTrans->
execute(Commit, AbortOnError);
1183 closeTransaction(pNdb);
1184 NdbSleep_MilliSleep(50);
1189 ndbout <<
"r = " << r << endl;
1190 closeTransaction(pNdb);
1195 pTrans->
getGCI(&m_latest_gci);
1198 closeTransaction(pNdb);
1201 NdbTick_getMicroTimer(&timer_stop);
1202 NDB_TICKS ticks = NdbTick_getMicrosPassed(timer_start, timer_stop);
1203 m_stats_latency->addObservation((
double)ticks);
1212 g_info <<
"|- " << updated <<
" records updated" << endl;
1217 HugoTransactions::pkInterpretedUpdateRecords(
Ndb* pNdb,
1222 int retryAttempt = 0;
1225 while (r < records){
1227 if (retryAttempt >= m_retryMax){
1228 g_info <<
"ERROR: has retried this operation " << retryAttempt
1229 <<
" times, failing!" << endl;
1234 if (pTrans == NULL) {
1239 NdbSleep_MilliSleep(50);
1250 closeTransaction(pNdb);
1257 closeTransaction(pNdb);
1262 if (equalForRow(pOp, r) != 0)
1264 closeTransaction(pNdb);
1270 if (calc.isUpdateCol(a) ==
true){
1271 if((row.attributeStore(a) =
1274 closeTransaction(pNdb);
1280 check = pTrans->
execute(NoCommit, AbortOnError);
1286 closeTransaction(pNdb);
1287 NdbSleep_MilliSleep(50);
1292 closeTransaction(pNdb);
1296 int updates = calc.getUpdatesValue(&row) + 1;
1300 if (pUpdOp == NULL) {
1302 closeTransaction(pNdb);
1309 closeTransaction(pNdb);
1314 if (equalForRow(pUpdOp, r) != 0)
1316 closeTransaction(pNdb);
1323 (calc.isUpdateCol(a) ==
true)){
1327 Uint32 valToIncWith = 1;
1331 closeTransaction(pNdb);
1340 (calc.isUpdateCol(a) ==
false)){
1341 if(setValueForAttr(pUpdOp, a, r, updates ) != 0){
1343 closeTransaction(pNdb);
1351 check = pTrans->
execute(Commit, AbortOnError);
1357 closeTransaction(pNdb);
1358 NdbSleep_MilliSleep(50);
1363 ndbout <<
"r = " << r << endl;
1364 closeTransaction(pNdb);
1369 pTrans->
getGCI(&m_latest_gci);
1373 closeTransaction(pNdb);
1379 g_info <<
"|- " << updated <<
" records updated" << endl;
1384 HugoTransactions::pkDelRecords(
Ndb* pNdb,
1387 bool allowConstraintViolation,
1392 int retryAttempt = 0;
1395 g_info <<
"|- Deleting records..." << endl;
1397 while (r < records){
1398 if(r + batch > records)
1399 batch = records - r;
1401 if (m_thr_count != 0 && m_thr_no != batch_no % m_thr_count)
1408 if (retryAttempt >= m_retryMax){
1409 g_info <<
"ERROR: has retried this operation " << retryAttempt
1410 <<
" times, failing!" << endl;
1415 NdbSleep_MilliSleep(doSleep);
1418 if (pTrans == NULL) {
1423 NdbSleep_MilliSleep(50);
1434 m_stats_latency != 0 &&
1436 r + batch != records;
1439 NdbTick_getMicroTimer(&timer_start);
1441 if(pkDeleteRecord(pNdb, r, batch) != NDBT_OK)
1444 closeTransaction(pNdb);
1448 check = pTrans->
execute(Commit, AbortOnError);
1455 closeTransaction(pNdb);
1456 NdbSleep_MilliSleep(50);
1462 if (allowConstraintViolation ==
true){
1466 g_info << r <<
": " << err.
code <<
" " << err.
message << endl;
1474 closeTransaction(pNdb);
1480 closeTransaction(pNdb);
1486 pTrans->
getGCI(&m_latest_gci);
1488 closeTransaction(pNdb);
1491 NdbTick_getMicroTimer(&timer_stop);
1492 NDB_TICKS ticks = NdbTick_getMicrosPassed(timer_start, timer_stop);
1493 m_stats_latency->addObservation((
double)ticks);
1500 g_info <<
"|- " << deleted <<
" records deleted" << endl;
1505 HugoTransactions::pkRefreshRecords(
Ndb* pNdb,
1511 int retryAttempt = 0;
1513 g_info <<
"|- Refreshing records..." << startFrom <<
"-" << (startFrom+count)
1514 <<
" (batch=" << batch <<
")" << endl;
1518 if(r + batch > count)
1521 if (retryAttempt >= m_retryMax)
1523 g_info <<
"ERROR: has retried this operation " << retryAttempt
1524 <<
" times, failing!" << endl;
1535 NdbSleep_MilliSleep(50);
1543 if (pkRefreshRecord(pNdb, r, batch) != NDBT_OK)
1546 closeTransaction(pNdb);
1550 if (pTrans->
execute(Commit, AbortOnError) == -1)
1557 closeTransaction(pNdb);
1558 NdbSleep_MilliSleep(50);
1565 closeTransaction(pNdb);
1570 closeTransaction(pNdb);
1578 HugoTransactions::pkReadUnlockRecords(
Ndb* pNdb,
1585 int retryAttempt = 0;
1589 g_info <<
"ERROR: Argument batch == 0 in pkReadRecords(). Not allowed." << endl;
1594 g_info <<
"ERROR: Cannot call pkReadUnlockRecords for index" << endl;
1598 while (r < records){
1599 if(r + batch > records)
1600 batch = records - r;
1602 if (retryAttempt >= m_retryMax){
1603 g_info <<
"ERROR: has retried this operation " << retryAttempt
1604 <<
" times, failing!" << endl;
1609 if (pTrans == NULL) {
1614 NdbSleep_MilliSleep(50);
1625 m_stats_latency != 0 &&
1627 r + batch != records;
1630 NdbTick_getMicroTimer(&timer_start);
1635 if(pkReadRecordLockHandle(pNdb, lockHandles, r, batch, lm, &lmused) != NDBT_OK)
1638 closeTransaction(pNdb);
1642 check = pTrans->
execute(NoCommit, AbortOnError);
1649 closeTransaction(pNdb);
1650 NdbSleep_MilliSleep(50);
1656 g_info << r <<
": " << err.
code <<
" " << err.
message << endl;
1662 closeTransaction(pNdb);
1667 for (
int b=0; (b<batch) && (r+b<records); b++){
1668 if (calc.verifyRowValues(rows[b]) != 0){
1669 closeTransaction(pNdb);
1676 if (pkUnlockRecord(pNdb,
1677 lockHandles) != NDBT_OK)
1679 closeTransaction(pNdb);
1683 check = pTrans->
execute(Commit, AbortOnError);
1691 closeTransaction(pNdb);
1692 NdbSleep_MilliSleep(50);
1697 closeTransaction(pNdb);
1702 closeTransaction(pNdb);
1705 NdbTick_getMicroTimer(&timer_stop);
1706 NDB_TICKS ticks = NdbTick_getMicrosPassed(timer_start, timer_stop);
1707 m_stats_latency->addObservation((
double)ticks);
1711 g_info << reads <<
" records read" << endl;
1717 HugoTransactions::lockRecords(
Ndb* pNdb,
1725 int retryAttempt = 0;
1730 if (percentToLock <= 0)
1732 double percentVal = (double)percentToLock / 100;
1733 int lockBatch = (int)(records * percentVal);
1737 allocRows(lockBatch);
1739 while (r < records){
1740 if(r + lockBatch > records)
1741 lockBatch = records - r;
1743 g_info <<
"|- Locking " << lockBatch <<
" records..." << endl;
1745 if (retryAttempt >= m_retryMax){
1746 g_info <<
"ERROR: has retried this operation " << retryAttempt
1747 <<
" times, failing!" << endl;
1752 if (pTrans == NULL) {
1757 NdbSleep_MilliSleep(50);
1765 if(pkReadRecord(pNdb, r, lockBatch, lm) != NDBT_OK)
1768 closeTransaction(pNdb);
1773 int sleepInterval = 50;
1774 int lockCount = lockTime / sleepInterval;
1775 int commitCount = 0;
1776 bool tempErr =
false;
1778 check = pTrans->
execute(NoCommit, AbortOnError);
1784 closeTransaction(pNdb);
1785 NdbSleep_MilliSleep(50);
1791 closeTransaction(pNdb);
1794 for (
int b=0; (b<lockBatch) && (r+b<records); b++){
1795 if (calc.verifyRowValues(rows[b]) != 0){
1796 closeTransaction(pNdb);
1801 NdbSleep_MilliSleep(sleepInterval);
1802 }
while (commitCount < lockCount);
1808 check = pTrans->
execute(Commit, AbortOnError);
1814 closeTransaction(pNdb);
1815 NdbSleep_MilliSleep(50);
1820 closeTransaction(pNdb);
1824 for (
int b=0; (b<lockBatch) && (r<records); b++){
1825 if (calc.verifyRowValues(rows[b]) != 0){
1826 closeTransaction(pNdb);
1833 closeTransaction(pNdb);
1837 g_info <<
"|- Record locking completed" << endl;
1843 const char * idxName,
1848 int retryAttempt = 0;
1859 g_info <<
"ERROR: Argument batch == 0 in indexReadRecords(). "
1860 <<
"Not allowed." << endl;
1870 while (r < records){
1871 if (retryAttempt >= m_retryMax){
1872 g_info <<
"ERROR: has retried this operation " << retryAttempt
1873 <<
" times, failing!" << endl;
1878 if (pTrans == NULL) {
1883 NdbSleep_MilliSleep(50);
1891 for(
int b=0; (b<batch) && (r+b < records); b++){
1896 closeTransaction(pNdb);
1904 closeTransaction(pNdb);
1912 closeTransaction(pNdb);
1917 if (equalForRow(pOp, r+b) != 0)
1919 closeTransaction(pNdb);
1925 if((rows[b]->attributeStore(a) =
1928 closeTransaction(pNdb);
1934 check = pTrans->
execute(Commit, AbortOnError);
1935 check = (check == -1 ? -1 : !ordered ? check : sOp->
nextResult(
true));
1941 closeTransaction(pNdb);
1942 NdbSleep_MilliSleep(50);
1948 g_info << r <<
": " << err.
code <<
" " << err.
message << endl;
1954 closeTransaction(pNdb);
1958 for (
int b=0; (b<batch) && (r+b<records); b++){
1959 if (calc.verifyRowValues(rows[b]) != 0){
1960 closeTransaction(pNdb);
1967 ndbout <<
"Error when comparing records "
1968 <<
" - index op next_result to many" << endl;
1969 closeTransaction(pNdb);
1973 closeTransaction(pNdb);
1976 g_info << reads <<
" records read" << endl;
1983 HugoTransactions::indexUpdateRecords(
Ndb* pNdb,
1984 const char * idxName,
1990 int retryAttempt = 0;
2005 while (r < records){
2006 if (retryAttempt >= m_retryMax){
2007 g_info <<
"ERROR: has retried this operation " << retryAttempt
2008 <<
" times, failing!" << endl;
2013 if (pTrans == NULL) {
2018 NdbSleep_MilliSleep(50);
2026 for(b = 0; b<batch && (b+r)<records; b++){
2031 closeTransaction(pNdb);
2038 closeTransaction(pNdb);
2045 closeTransaction(pNdb);
2050 sOp->readTuplesExclusive();
2054 if (equalForRow(pOp, r+b) != 0)
2056 closeTransaction(pNdb);
2062 if((rows[b]->attributeStore(a) =
2065 closeTransaction(pNdb);
2071 check = pTrans->
execute(NoCommit, AbortOnError);
2072 check = (check == -1 ? -1 : !ordered ? check : sOp->
nextResult(
true));
2076 closeTransaction(pNdb);
2079 NdbSleep_MilliSleep(50);
2086 if(ordered && check != 0){
2087 g_err << check <<
" - Row: " << r <<
" not found!!" << endl;
2088 closeTransaction(pNdb);
2092 for(b = 0; b<batch && (b+r)<records; b++){
2093 if (calc.verifyRowValues(rows[b]) != 0){
2094 closeTransaction(pNdb);
2098 int updates = calc.getUpdatesValue(rows[b]) + 1;
2103 check = (pUpdOp == 0 ? -1 : pUpdOp->
updateTuple());
2108 if (pUpdOp == NULL) {
2110 closeTransaction(pNdb);
2116 closeTransaction(pNdb);
2122 if (equalForRow(pUpdOp, r+b) != 0)
2124 closeTransaction(pNdb);
2131 if(setValueForAttr(pUpdOp, a, r+b, updates ) != 0){
2133 closeTransaction(pNdb);
2140 check = pTrans->
execute(Commit, AbortOnError);
2144 closeTransaction(pNdb);
2147 NdbSleep_MilliSleep(50);
2151 ndbout <<
"r = " << r << endl;
2155 pTrans->
getGCI(&m_latest_gci);
2158 closeTransaction(pNdb);
2163 g_info <<
"|- " << updated <<
" records updated" << endl;