19 #include <ndb_global.h>
29 #include <HugoTransactions.hpp>
31 int main(
int argc,
const char** argv){
38 const char* _tabname = NULL, *db = 0;
43 {
"loops",
'l', arg_integer, &_loops,
"number of times to run this program(0=infinite loop)",
"loops" },
44 {
"parallelism",
'p', arg_integer, &_parallelism,
"parallelism(1-240)",
"para" },
45 {
"records",
'r', arg_integer, &_records,
"Number of records",
"recs" },
46 {
"ver2",
'2', arg_flag, &_ver2,
"Use version 2 of scanUpdateRecords",
"" },
47 {
"ver2",
'1', arg_negative_flag, &_ver2,
"Use version 1 of scanUpdateRecords (default)",
"" },
48 {
"abort",
'a', arg_integer, &abort,
"Abort probability",
"" },
49 {
"usage",
'?', arg_flag, &_help,
"Print help",
"" },
50 {
"database",
'd', arg_string, &db,
"Database",
"" }
52 int num_args =
sizeof(args) /
sizeof(args[0]);
56 "This program will scan update all records in one table in Ndb\n";
58 if(getarg(args, num_args, argc, argv, &optind) ||
59 argv[optind] == NULL || _help) {
60 arg_printusage(args, num_args, argv[0], desc);
61 return NDBT_ProgramExit(NDBT_WRONGARGS);
63 _tabname = argv[optind];
69 return NDBT_ProgramExit(NDBT_FAILED);
74 ndbout <<
"Cluster nodes not ready in 30 seconds." << endl;
75 return NDBT_ProgramExit(NDBT_FAILED);
78 Ndb MyNdb( &con, db ? db :
"TEST_DB" );
80 if(MyNdb.init() != 0){
81 ERR(MyNdb.getNdbError());
82 return NDBT_ProgramExit(NDBT_FAILED);
88 ndbout <<
" Table " << _tabname <<
" does not exist!" << endl;
89 return NDBT_ProgramExit(NDBT_WRONGARGS);
94 int res = NDBT_FAILED;
95 while (i<_loops || _loops==0) {
98 res = hugoTrans.scanUpdateRecords(&MyNdb,
103 res = hugoTrans.scanUpdateRecords2(&MyNdb,
108 if (res != NDBT_OK ){
109 return NDBT_ProgramExit(NDBT_FAILED);
115 return NDBT_ProgramExit(NDBT_OK);