19 #include <ndb_global.h>
29 #include <HugoTransactions.hpp>
31 int main(
int argc,
const char** argv){
38 const char* _tabname = NULL, *db = 0;
44 {
"aborts",
'a', arg_integer, &_abort,
"percent of transactions that are aborted",
"abort%" },
45 {
"loops",
'l', arg_integer, &_loops,
"number of times to run this program(0=infinite loop)",
"loops" },
46 {
"parallelism",
'p', arg_integer, &_parallelism,
"parallelism(1-240)",
"para" },
47 {
"records",
'r', arg_integer, &_records,
"Number of records",
"recs" },
48 {
"usage",
'?', arg_flag, &_help,
"Print help",
"" },
49 {
"lock",
'm', arg_integer, &lock,
"lock mode",
"" },
50 {
"sorted",
's', arg_flag, &sorted,
"sorted",
"" },
51 {
"database",
'd', arg_string, &db,
"Database",
"" }
53 int num_args =
sizeof(args) /
sizeof(args[0]);
57 "This program will scan read all records in one table in Ndb.\n"\
58 "It will verify every column read by calculating the expected value.\n";
60 if(getarg(args, num_args, argc, argv, &optind) || argv[optind] == NULL || _help) {
61 arg_printusage(args, num_args, argv[0], desc);
62 return NDBT_ProgramExit(NDBT_WRONGARGS);
64 _tabname = argv[optind];
70 return NDBT_ProgramExit(NDBT_FAILED);
72 Ndb MyNdb( &con, db ? db :
"TEST_DB" );
74 if(MyNdb.init() != 0){
75 ERR(MyNdb.getNdbError());
76 return NDBT_ProgramExit(NDBT_FAILED);
79 while(MyNdb.waitUntilReady() != 0)
80 ndbout <<
"Waiting for ndb to become ready..." << endl;
85 ndbout <<
" Table " << _tabname <<
" does not exist!" << endl;
86 return NDBT_ProgramExit(NDBT_WRONGARGS);
92 pIdx = MyNdb.getDictionary()->getIndex(argv[optind+1], _tabname);
94 ndbout <<
" Index " << argv[optind+1] <<
" not found" << endl;
98 ndbout <<
" Index " << argv[optind+1] <<
" is not scannable" << endl;
105 while (i<_loops || _loops==0) {
109 if(hugoTrans.scanReadRecords(&MyNdb,
115 return NDBT_ProgramExit(NDBT_FAILED);
120 if(hugoTrans.scanReadRecords(&MyNdb, pIdx,
127 return NDBT_ProgramExit(NDBT_FAILED);
133 return NDBT_ProgramExit(NDBT_OK);