Example #1
0
int main(int argc, char **argv)
{
  CmdLine clp;
  parse_cmd_line(argc, argv, clp);

  TBSYS_LOGGER.rotateLog("multi_write.log");
  TBSYS_LOGGER.setFileName("multi_write.log");
  TBSYS_LOGGER.setLogLevel("info");
  clp.log_all();

  ob_init_memory_pool();

  ObSchemaManager schema_mgr;
  if (NULL != clp.schema_file)
  {
    tbsys::CConfig config;
    if (!schema_mgr.parse_from_file(clp.schema_file, config))
    {
      TBSYS_LOG(WARN, "parse schema fail");
      exit(-1);
    }
  }
  else if (OB_SUCCESS != fetch_schema(clp.root_addr, clp.root_port, schema_mgr))
  {
    TBSYS_LOG(WARN, "fetch schema fail");
    exit(-1);
  }
  schema_mgr.print_info();

  MutatorBuilder mb;
  mb.init(schema_mgr,
          clp.prefix_start, clp.suffix_length,
          clp.merge_addr, clp.merge_port, clp.table_start_version,
          clp.max_cell, clp.max_row, clp.max_suffix);
  if (OB_SUCCESS != mb.init_prefix_end(clp.prefix_end))
  {
    TBSYS_LOG(WARN, "init prerfix end fail");
    exit(-1);
  }

  ObServer dst_host;
  dst_host.set_ipv4_addr(clp.serv_addr, clp.serv_port);
  MockClient client;
  client.init(dst_host);
  for (int64_t i = 0; i < clp.mutator_num; i++)
  {
    ObMutator mutator;
    PageArena<char> allocer;
    int ret = OB_SUCCESS;
    if (OB_SUCCESS != (ret = mb.build_mutator(mutator, allocer, clp.using_id)))
    {
      TBSYS_LOG(WARN, "build_mutator fail ret=%d\n", ret);
      break;
    }
    int64_t timeu = tbsys::CTimeUtil::getTime();
    ret = client.ups_apply(mutator, TIMEOUT_MS);
    TBSYS_LOG(INFO, "apply ret=%d timeu=%ld\n", ret, tbsys::CTimeUtil::getTime() - timeu);
  }
  client.destroy();
}
Example #2
0
int main(int argc, char **argv)
{
  CmdLine clp;
  parse_cmd_line(argc, argv, clp);

  TBSYS_LOGGER.rotateLog("total_scan.log");
  TBSYS_LOGGER.setFileName("total_scan.log");
  TBSYS_LOGGER.setLogLevel("info");
  clp.log_all();

  ob_init_memory_pool();

  ObSchemaManager schema_mgr;
  if (NULL != clp.schema_file)
  {
    tbsys::CConfig config;
    if (!schema_mgr.parse_from_file(clp.schema_file, config))
    {
      TBSYS_LOG(WARN, "parse schema fail");
      exit(-1);
    }
  }
  else if (OB_SUCCESS != fetch_schema(clp.root_addr, clp.root_port, schema_mgr))
  {
    TBSYS_LOG(WARN, "fetch schema fail");
    exit(-1);
  }
  schema_mgr.print_info();

  MutatorBuilder mb;
  mb.init(schema_mgr, clp.prefix_start, clp.suffix_length, clp.serv_addr, clp.serv_port, clp.table_start_version, clp.max_cell);

  ObServer dst_host;
  dst_host.set_ipv4_addr(clp.serv_addr, clp.serv_port);
  MockClient client;
  client.init(dst_host);
  scan_check_all(mb, client, clp.table_start_version, clp.using_id, clp.check);
  client.destroy();
}