示例#1
0
int BigqueryTest::start()
{
  int ret                     = OB_SUCCESS; 
  int64_t write_thread_count  = 0;
  int64_t read_thread_count   = 0;

  ret = ob_init_memory_pool();
  if (OB_SUCCESS == ret)
  {
    ret = init();
  }

  if (OB_SUCCESS == ret)
  {
    write_thread_count = bigquerytest_param_.get_write_thread_count();
    read_thread_count = bigquerytest_param_.get_read_thread_count();

    if (write_thread_count > 0)
    {
      write_worker_.setThreadCount(write_thread_count);
      write_worker_.start();
    }

    if (read_thread_count > 0)
    {
      read_worker_.setThreadCount(read_thread_count);
      read_worker_.start();
    }

    if (OB_SUCCESS == ret)
    {
      ret = wait();
    }
  }

  return ret;
}
示例#2
0
int main(int argc, char** argv)
{
  setlocale(LC_ALL, "");
  TBSYS_LOGGER.setFileName("ups_admin.log", true);
  TBSYS_LOG(INFO, "ups_admin start==================================================");
  ob_init_memory_pool();

  CmdLineParam clp;
  parse_cmd_line(argc, argv, clp);

  timeout = clp.timeout?: timeout;

  MockClient client;
  init_mock_client(clp.serv_addr, clp.serv_port, clp.login_type, client);

  PageArena<char> allocer;
  int rc = 0;

  if (0 == strcmp("apply", clp.cmd_type))
  {
    apply(clp.ini_fname, allocer, client);
  }
  else if (0 == strcmp("get_clog_status", clp.cmd_type))
  {
    get_clog_status(client);
  }
  else if (0 == strcmp("get_max_log_seq", clp.cmd_type))
  {
    get_max_log_seq(client);
  }
  else if (0 == strcmp("get_clog_cursor", clp.cmd_type))
  {
    get_clog_cursor(client);
  }
  else if (0 == strcmp("get_clog_master", clp.cmd_type))
  {
    get_clog_master(client);
  }
  else if (0 == strcmp("get_log_sync_delay_stat", clp.cmd_type))
  {
    get_log_sync_delay_stat(client);
  }
  else if (0 == strcmp("get", clp.cmd_type))
  {
    get(clp.ini_fname, allocer, client, clp.version_range,clp.expected_result_fname,
      clp.schema_fname);
  }
  else if (0 == strcmp("param_get", clp.cmd_type))
  {
    param_get(clp.ini_fname, client);
  }
  else if (0 == strcmp("scan", clp.cmd_type))
  {
    scan(clp.ini_fname, allocer, client, clp.version_range,clp.expected_result_fname,
      clp.schema_fname);
  }
  else if (0 == strcmp("total_scan", clp.cmd_type))
  {
    total_scan(clp.ini_fname, allocer, client, clp.version_range);
  }
  else if (0 == strcmp("minor_freeze", clp.cmd_type))
  {
    minor_freeze(client);
  }
  else if (0 == strcmp("major_freeze", clp.cmd_type))
  {
    major_freeze(client);
  }
  else if (0 == strcmp("fetch_schema", clp.cmd_type))
  {
    fetch_schema(client, clp.timestamp);
  }
  else if (0 == strcmp("get_sstable_range_list", clp.cmd_type))
  {
    get_sstable_range_list(client, clp.timestamp, clp.session_id);
  }
  else if (0 == strcmp("drop", clp.cmd_type))
  {
    drop(client);
  }
  else if (0 == strcmp("dump_memtable", clp.cmd_type))
  {
    dump_memtable(clp.ini_fname, client);
  }
  else if (0 == strcmp("dump_schemas", clp.cmd_type))
  {
    dump_schemas(client);
  }
  else if (0 == strcmp("force_fetch_schema", clp.cmd_type))
  {
    force_fetch_schema(client);
  }
  else if (0 == strcmp("reload_conf", clp.cmd_type))
  {
    reload_conf(clp.ini_fname, client);
  }
  else if (0 == strcmp("memory_watch", clp.cmd_type))
  {
    memory_watch(client);
  }
  else if (0 == strcmp("memory_limit", clp.cmd_type))
  {
    memory_limit(clp.memory_limit, clp.memtable_limit, client);
  }
  else if (0 == strcmp("priv_queue_conf", clp.cmd_type))
  {
    priv_queue_conf(clp.priv_queue_conf, client);
  }
  else if (0 == strcmp("clear_active_memtable", clp.cmd_type))
  {
    clear_active_memtable(client);
  }
  else if (0 == strcmp("get_last_frozen_version", clp.cmd_type))
  {
    get_last_frozen_version(client);
  }
  else if (0 == strcmp("fetch_ups_stat_info", clp.cmd_type))
  {
    fetch_ups_stat_info(client);
  }
  else if (0 == strcmp("get_bloomfilter", clp.cmd_type))
  {
    get_bloomfilter(client, clp.timestamp);
  }
  else if (0 == strcmp("store_memtable", clp.cmd_type))
  {
    store_memtable(client, clp.timestamp);
  }
  else if (0 == strcmp("erase_sstable", clp.cmd_type))
  {
    erase_sstable(client);
  }
  else if (0 == strcmp("load_new_store", clp.cmd_type))
  {
    load_new_store(client);
  }
  else if (0 == strcmp("reload_all_store", clp.cmd_type))
  {
    reload_all_store(client);
  }
  else if (0 == strcmp("reload_store", clp.cmd_type))
  {
    reload_store(client, clp.timestamp);
  }
  else if (0 == strcmp("umount_store", clp.cmd_type))
  {
    umount_store(client, clp.ini_fname);
  }
  else if (0 == strcmp("force_report_frozen_version", clp.cmd_type))
  {
    force_report_frozen_version(client);
  }
  else if (0 == strcmp("switch_commit_log", clp.cmd_type))
  {
    switch_commit_log(client);
  }
  else if (0 == strcmp("get_table_time_stamp", clp.cmd_type))
  {
    get_table_time_stamp(client, clp.timestamp);
  }
  else if (0 == strcmp("disable_memtable_checksum", clp.cmd_type))
  {
    disable_memtable_checksum(client);
  }
  else if (0 == strcmp("enable_memtable_checksum", clp.cmd_type))
  {
    enable_memtable_checksum(client);
  }
  else if (0 == strcmp("immediately_drop_memtable", clp.cmd_type))
  {
    immediately_drop_memtable(client);
  }
  else if (0 == strcmp("delay_drop_memtable", clp.cmd_type))
  {
    delay_drop_memtable(client);
  }
  else if (0 == strcmp("minor_load_bypass", clp.cmd_type))
  {
    rc = minor_load_bypass(client);
  }
  else if (0 == strcmp("major_load_bypass", clp.cmd_type))
  {
    rc = major_load_bypass(client);
  }
  else if(0 == strcmp("list_sessions", clp.cmd_type))
  {
    client.list_sessions(timeout);
  }
  else if(0 == strcmp("kill_session", clp.cmd_type))
  {
    client.kill_session(timeout, clp.session_id);
  }
  else if (0 == strcmp("change_log_level", clp.cmd_type))
  {
    change_log_level(client, clp.log_level);
  }
  else if (0 == strcmp("get_slave_ups_info", clp.cmd_type))
  {
    get_slave_ups_info(client);
  }
  else if (0 == strcmp("print_scanner", clp.cmd_type))
  {
    print_scanner(clp.ini_fname);
  }
  else if (0 == strcmp("print_schema", clp.cmd_type))
  {
    print_schema(clp.ini_fname);
  }
  else if (0 == strcmp("sql_query", clp.cmd_type))
  {
    execute_sql(client, clp.sql_query);
  }
  else if (0 == strcmp("ups_show_sessions", clp.cmd_type))
  {
    ups_show_sessions(client);
  }
  else if (0 == strcmp("ups_kill_session", clp.cmd_type))
  {
    ups_kill_session(static_cast<uint32_t>(clp.session_id), client);
  }
  else
  {
    print_usage();
  }

  if (!clp.quickly_exit)
  {
    client.destroy();
    TBSYS_LOG(INFO, "ups_admin end==================================================");
    return rc;
  }
  else
  {
    TBSYS_LOG(INFO, "ups_admin killed==================================================");
    fflush(stdout);
    fflush(stderr);
    _exit(rc);
  }
}