19 #include <ndb_global.h> 
   26 #include <NDBT_Thread.hpp> 
   27 #include <NDBT_Stats.hpp> 
   31 #include <HugoTransactions.hpp> 
   33 static NDBT_ThreadFunc hugoPkDelete;
 
   46 int main(
int argc, 
const char** argv){
 
   54   const char* _tabname = NULL;
 
   58     { 
"loops", 
'l', arg_integer, &_loops, 
"number of times to run this program(0=infinite loop)", 
"loops" },
 
   59     { 
"threads", 
't', arg_integer, &_threads, 
"number of threads (default 1)", 
"threads" },
 
   60     { 
"stats", 
's', arg_flag, &_stats, 
"report latency per batch", 
"stats" },
 
   62     { 
"records", 
'r', arg_integer, &_records, 
"Number of records", 
"records" },
 
   63     { 
"usage", 
'?', arg_flag, &_help, 
"Print help", 
"" }
 
   65   int num_args = 
sizeof(args) / 
sizeof(args[0]);
 
   69     "This program will delete all records in a table using PK \n";
 
   71   if(getarg(args, num_args, argc, argv, &optind) ||
 
   72      argv[optind] == NULL || _records == 0 || _help) {
 
   73     arg_printusage(args, num_args, argv[0], desc);
 
   74     return NDBT_ProgramExit(NDBT_WRONGARGS);
 
   76   _tabname = argv[optind];
 
   82     return NDBT_ProgramExit(NDBT_FAILED);
 
   87     ndbout << 
"Cluster nodes not ready in 30 seconds." << endl;
 
   88     return NDBT_ProgramExit(NDBT_FAILED);
 
   92   Ndb MyNdb(&con, 
"TEST_DB" );
 
   94   if(MyNdb.init() != 0){
 
   95     ERR(MyNdb.getNdbError());
 
   96     return NDBT_ProgramExit(NDBT_FAILED);
 
  102     ndbout << 
" Table " << _tabname << 
" does not exist!" << endl;
 
  103     return NDBT_ProgramExit(NDBT_WRONGARGS);
 
  110   if (ths.connect(&con, 
"TEST_DB") == -1) {
 
  111     ndbout << 
"connect failed: err=" << ths.get_err() << endl;
 
  112     return NDBT_ProgramExit(NDBT_FAILED);
 
  117   ths.set_input(&input);
 
  119   input.records = _records;
 
  120   input.batch = _batch;
 
  121   input.stats = _stats;
 
  128   while (i < _loops || _loops == 0) {
 
  131     ths.set_func(hugoPkDelete);
 
  136       NDBT_ProgramExit(NDBT_FAILED);
 
  143       for (n = 0; n < ths.get_count(); n++) {
 
  146         latency += output->latency;
 
  150         << 
"latency per batch (us): " 
  151         << 
" samples=" << latency.getCount()
 
  152         << 
" min=" << (int)latency.getMin()
 
  153         << 
" max=" << (int)latency.getMax()
 
  154         << 
" mean=" << (int)latency.getMean()
 
  155         << 
" stddev=" << (int)latency.getStddev()
 
  161   return NDBT_ProgramExit(NDBT_OK);
 
  170   output->latency.reset();
 
  172     hugoTrans.setStatsLatency(&output->latency);
 
  175   hugoTrans.setThrInfo(ths.get_count(), thr.get_thread_no());
 
  178   ret = hugoTrans.pkDelRecords(thr.get_ndb(),