コード例 #1
0
ファイル: multi_write.cpp プロジェクト: CCoder123/pproj
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();
}
コード例 #2
0
ファイル: multi_write.cpp プロジェクト: CCoder123/pproj
int fetch_schema(const char *root_addr, const int32_t root_port, ObSchemaManager &schema_mgr)
{
  int ret = OB_SUCCESS;
  ObServer dst_host;
  dst_host.set_ipv4_addr(root_addr, root_port);
  MockClient client;
  client.init(dst_host);
  ret = client.fetch_schema(0, schema_mgr, TIMEOUT_MS);
  client.destroy();
  return ret;
}
コード例 #3
0
ファイル: decorationtest.cpp プロジェクト: KDE/kdecoration
void DecorationTest::testSection()
{
    MockBridge bridge;
    auto decoSettings = QSharedPointer<KDecoration2::DecorationSettings>::create(&bridge);
    MockDecoration deco(&bridge);
    deco.setSettings(decoSettings);

    MockSettings *settings = bridge.lastCreatedSettings();
    settings->setLargeSpacing(0);

    MockClient *client = bridge.lastCreatedClient();
    client->setWidth(100);
    client->setHeight(100);
    QCOMPARE(deco.size(), QSize(100, 100));
    QCOMPARE(deco.borderLeft(), 0);
    QCOMPARE(deco.borderTop(), 0);
    QCOMPARE(deco.borderRight(), 0);
    QCOMPARE(deco.borderBottom(), 0);
    QCOMPARE(deco.titleBar(), QRect());
    QCOMPARE(deco.sectionUnderMouse(), Qt::NoSection);

    QFETCH(QRect, titleBar);
    QFETCH(QMargins, margins);
    deco.setBorders(margins);
    QCOMPARE(deco.borderLeft(), margins.left());
    QCOMPARE(deco.borderTop(), margins.top());
    QCOMPARE(deco.borderRight(), margins.right());
    QCOMPARE(deco.borderBottom(), margins.bottom());
    deco.setTitleBar(titleBar);
    QCOMPARE(deco.titleBar(), titleBar);
    QCOMPARE(deco.size(), QSize(100 + deco.borderLeft() + deco.borderRight(), 100 + deco.borderTop() + deco.borderBottom()));

    QSignalSpy spy(&deco, SIGNAL(sectionUnderMouseChanged(Qt::WindowFrameSection)));
    QVERIFY(spy.isValid());
    QFETCH(QPoint, pos);
    QHoverEvent event(QEvent::HoverMove, QPointF(pos), QPointF(pos));
    QCoreApplication::sendEvent(&deco, &event);
    QFETCH(Qt::WindowFrameSection, expected);
    QCOMPARE(deco.sectionUnderMouse(), expected);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.first().first().value<Qt::WindowFrameSection>(), expected);

    QHoverEvent event2(QEvent::HoverMove, QPointF(50, 50), QPointF(50, 50));
    QCoreApplication::sendEvent(&deco, &event2);
    QCOMPARE(deco.sectionUnderMouse(), Qt::NoSection);
    QCOMPARE(spy.count(), 2);
    QCOMPARE(spy.first().first().value<Qt::WindowFrameSection>(), expected);
    QCOMPARE(spy.last().first().value<Qt::WindowFrameSection>(), Qt::NoSection);
}
コード例 #4
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void total_scan(const char *fname, PageArena<char> &allocer, MockClient &client, const char *version_range)
{
  ObScanner scanner;
  ObScanParam scan_param;
  read_scan_param(fname, SCAN_PARAM_SECTION, allocer, scan_param);
  scan_param.set_version_range(str2range(version_range));
  scan_param.set_is_read_consistency(false);

  int64_t total_fullfilled_num = 0;
  int64_t total_row_counter = 0;
  int64_t total_timeu = 0;
  while (true)
  {
    int64_t timeu = tbsys::CTimeUtil::getTime();
    int err = client.ups_scan(scan_param, scanner, timeout);
    timeu = tbsys::CTimeUtil::getTime() - timeu;
    if (OB_SUCCESS != err)
    {
      fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
      break;
    }
    else
    {
      int64_t row_counter = 0;
      while (OB_SUCCESS == scanner.next_cell())
      {
        ObCellInfo *ci = NULL;
        bool is_row_changed = false;
        scanner.get_cell(&ci, &is_row_changed);
        //fprintf(stdout, "%s\n", updateserver::print_cellinfo(ci, "CLI_SCAN"));
        if (is_row_changed)
        {
          row_counter++;
        }
      }
      bool is_fullfilled = false;
      int64_t fullfilled_num = 0;
      ObRowkey last_rk;
      scanner.get_last_row_key(last_rk);
      scanner.get_is_req_fullfilled(is_fullfilled, fullfilled_num);
      fprintf(stdout, "[SINGLE_SCAN] is_fullfilled=%s fullfilled_num=%ld row_counter=%ld timeu=%ld last_row_key=[%s]\n",
              STR_BOOL(is_fullfilled), fullfilled_num, row_counter, timeu, to_cstring(last_rk));
      total_fullfilled_num += fullfilled_num;
      total_row_counter += row_counter;
      total_timeu += timeu;
      if (is_fullfilled)
      {
        break;
      }
      else
      {
        const_cast<ObNewRange*>(scan_param.get_range())->start_key_ = last_rk;
        const_cast<ObNewRange*>(scan_param.get_range())->border_flag_.unset_min_value();
        const_cast<ObNewRange*>(scan_param.get_range())->border_flag_.unset_inclusive_start();
      }
    }
  }
  fprintf(stdout, "[TOTAL_SCAN] total_fullfilled_num=%ld total_row_counter=%ld total_timeu=%ld\n",
          total_fullfilled_num, total_row_counter, total_timeu);
}
コード例 #5
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void apply(const char *fname, PageArena<char> &allocer, MockClient &client)
{
  ObMutator mutator;
  ObMutator result;
  read_cell_infos(fname, CELL_INFOS_SECTION, allocer, mutator, result);
  int err = client.ups_apply(mutator, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
}
コード例 #6
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
int major_load_bypass(MockClient &client)
{
  int64_t loaded_num = 0;
  int err = client.major_load_bypass(loaded_num, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  fprintf(stdout, "loaded_num=%ld\n", loaded_num);
  return err;
}
コード例 #7
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void get_clog_master(MockClient &client)
{
  ObServer server;
  int err = client.get_clog_master(server, timeout);
  char addr[256];
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  server.to_string(addr, sizeof(addr));
  fprintf(stdout, "%s\n", addr);
}
コード例 #8
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void dump_memtable(const char *dump_dir, MockClient &client)
{
  if (NULL == dump_dir)
  {
    dump_dir = "/tmp";
  }
  int err = client.dump_memtable(dump_dir, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  fprintf(stdout, "dump dest=[%s]\n", dump_dir);
}
コード例 #9
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void reload_conf(const char* fname, MockClient &client)
{
  if (NULL == fname)
  {
    fname = "./default.conf";
  }
  int err = client.reload_conf(fname, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  fprintf(stdout, "relaod fname=[%s]\n", fname);
}
コード例 #10
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void get_last_frozen_version(MockClient &client)
{
  int64_t version = 0;
  int err = client.get_last_frozen_version(version, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  if (OB_SUCCESS == err)
  {
    fprintf(stdout, "last_frozen_version=%ld\n", version);
  }
}
コード例 #11
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void fetch_ups_stat_info(MockClient &client)
{
  oceanbase::updateserver::UpsStatMgr stat_mgr;
  int err = client.fetch_ups_stat_info(stat_mgr, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  if (OB_SUCCESS == err)
  {
    stat_mgr.print_info();
  }
}
コード例 #12
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
int execute_sql(MockClient &client, const char* sql_query)
{
  int ret = OB_SUCCESS;
  ObString query;
  query.assign_ptr(const_cast<char*>(sql_query), static_cast<int32_t>(strlen(sql_query)));
  printf("execute_sql, query=[%.*s]...\n", query.length(), query.ptr());
  ret = client.execute_sql(query, timeout);
  printf("ret=%d\n", ret);
  return ret;
}
コード例 #13
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void switch_commit_log(MockClient &client)
{
  uint64_t new_log_file_id = 0;
  int err = client.switch_commit_log(new_log_file_id, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  if (OB_SUCCESS == err)
  {
    fprintf(stdout, "new_log_file_id=%lu\n", new_log_file_id);
  }
}
コード例 #14
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void get_table_time_stamp(MockClient &client, const uint64_t major_version)
{
  int64_t time_stamp = 0;
  int err = client.get_table_time_stamp(major_version, time_stamp, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  if (OB_SUCCESS == err)
  {
    fprintf(stdout, "major_version=%lu time_stamp=%ld %s\n", major_version, time_stamp, time2str(time_stamp));
  }
}
コード例 #15
0
ファイル: total_scan.cpp プロジェクト: CCoder123/pproj
bool get_check_row(const ObSchema &schema, const ObString &row_key, CellinfoBuilder &cb,
                  MockClient &client, const int64_t table_start_version, const bool using_id)
{
  bool bret = false;

  ObGetParam get_param;
  const ObColumnSchema *iter = NULL;
  for (iter = schema.column_begin(); iter != schema.column_end(); iter++)
  {
    ObCellInfo ci;
    ci.row_key_ = row_key;
    if (using_id) 
    {
      ci.table_id_ = schema.get_table_id();
      ci.column_id_ = iter->get_id();
    }
    else
    {
      ci.table_name_.assign_ptr(const_cast<char*>(schema.get_table_name()), strlen(schema.get_table_name()));
      ci.column_name_.assign_ptr(const_cast<char*>(iter->get_name()), strlen(iter->get_name()));
    }
    get_param.add_cell(ci);
  }
  ObVersionRange version_range;
  version_range.start_version_ = table_start_version;
  version_range.border_flag_.set_max_value();
  version_range.border_flag_.set_inclusive_start();
  get_param.set_version_range(version_range);

  ObScanner scanner;
  int ret = client.ups_get(get_param, scanner, TIMEOUT_MS);
  if (OB_SUCCESS == ret)
  {
    RowChecker rc;
    while (OB_SUCCESS == scanner.next_cell())
    {
      ObCellInfo *ci = NULL;
      if (OB_SUCCESS == scanner.get_cell(&ci))
      {
        if (!using_id)
        {
          trans_name2id(*ci, schema);
        }
        rc.add_cell(ci);
      }
    }
    bret = rc.check_row(cb, schema);
  }
  else
  {
    TBSYS_LOG(WARN, "get ret=%d", ret);
  }
  return bret;
  return true;
}
コード例 #16
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void get_clog_cursor(MockClient &client)
{
  int err = OB_SUCCESS;
  ObLogCursor log_cursor;
  if (OB_SUCCESS != (err = client.get_max_clog_id(log_cursor, timeout)))
  {
    TBSYS_LOG(ERROR, "client.get_max_clog_id()=>%d", err);
  }
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  fprintf(stdout, "log_file_id=%lu, log_seq_id=%lu, log_offset=%lu\n", log_cursor.file_id_, log_cursor.log_id_, log_cursor.offset_);
}
コード例 #17
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void get_max_log_seq(MockClient &client)
{
  int err = OB_SUCCESS;
  int64_t log_id = 0;
  if (OB_SUCCESS != (err = client.get_max_log_seq(log_id, timeout)))
  {
    TBSYS_LOG(ERROR, "client.get_max_log_id_replayable()=>%d", err);
  }
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  fprintf(stdout, "max_log_seq=%ld\n", log_id);
}
コード例 #18
0
ファイル: test_ups_client.cpp プロジェクト: CCoder123/pproj
int main(int argc, char **argv)
{
  int err = OB_SUCCESS;
  ob_init_memory_pool();
  CParam param;
  err = parse_cmd_args(argc,argv, param);
  MockClient client;
  if (OB_SUCCESS == err)
  {
    init_mock_client(param.server_addr_, param.server_port_, client);  
    err = apply(param, client);
    if (err != OB_SUCCESS)
    {
      TBSYS_LOG(ERROR, "check apply mutation failed:ret[%d]", err);
    }
  }
  client.destroy();
  delete param.schema_mgr_;
  return err;
}
コード例 #19
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void get_slave_ups_info(MockClient &client)
{
  char *buff = NULL;
  buff = new char[OB_MAX_PACKET_LENGTH];
  buff[OB_MAX_PACKET_LENGTH - 1] = '\0';
  if (NULL != buff)
  {
    int err = client.get_slave_ups_info(buff, OB_MAX_PACKET_LENGTH, timeout);
    fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
    delete [] buff;
  }
}
コード例 #20
0
ファイル: total_scan.cpp プロジェクト: CCoder123/pproj
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();
}
コード例 #21
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void get_log_sync_delay_stat(MockClient &client)
{
  ObLogSyncDelayStat delay_stat;
  int err = client.get_log_sync_delay_stat(delay_stat, timeout);

  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  time_t tm = delay_stat.get_last_replay_time_us()/1000000;
  char* str_time = ctime(&tm);
  str_time[strlen(str_time)-1] = 0;
  fprintf(stdout, "log_sync_delay: last_log_id=%ld, total_count=%ld, total_delay=%ldus, max_delay=%ldus, last_replay_time=%ldus [%s]\n",
          delay_stat.get_last_log_id(), delay_stat.get_mutator_count(), delay_stat.get_total_delay_us(),
          delay_stat.get_max_delay_us(), delay_stat.get_last_replay_time_us(),
          str_time);
}
コード例 #22
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void init_mock_client(const char *addr, int32_t port, const char *login_type, MockClient &client)
{
  ObServer dst_host;
  dst_host.set_ipv4_addr(addr, port);
  client.init(dst_host);
  if (0 == strcmp(login_type, "direct"))
  {
    // do nothing
  }
  else if (0 == strcmp(login_type, "master_ups"))
  {
    ObUpsList ups_list;
    if (OB_SUCCESS == client.get_ups_list(ups_list, timeout))
    {
      for (int64_t i = 0; i < ups_list.ups_count_; i++)
      {
        if (UPS_MASTER == ups_list.ups_array_[i].stat_)
        {
          client.set_server(ups_list.ups_array_[i].addr_);
          break;
        }
      }
    }
  }
  else if (0 == strcmp(login_type, "random_ms"))
  {
    MsList ms_list;
    ms_list.init(dst_host, client.get_rpc());
    ms_list.runTimerTask();
    client.set_server(ms_list.get_one());
  }
  else
  {
    fprintf(stdout, "Invalid login_type [%s]\n", login_type);
    exit(-1);
  }
}
コード例 #23
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void memory_watch(MockClient &client)
{
  UpsMemoryInfo memory_info;
  int err = client.memory_watch(memory_info, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  if (OB_SUCCESS == err)
  {
    fprintf(stdout, "memory_watch err=%d\n", err);
    fprintf(stdout, "memory_info_version=%ld\n", memory_info.version);
    fprintf(stdout, "total_size\t=% '15ld\n", memory_info.total_size);
    fprintf(stdout, "cur_limit_size\t=% '15ld\n", memory_info.cur_limit_size);
    fprintf(stdout, "memtable_used\t=% '15ld\n", memory_info.table_mem_info.memtable_used);
    fprintf(stdout, "memtable_total\t=% '15ld\n", memory_info.table_mem_info.memtable_total);
    fprintf(stdout, "memtable_limit\t=% '15ld\n", memory_info.table_mem_info.memtable_limit);
  }
}
コード例 #24
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void ups_show_sessions(MockClient &client)
{
  ObNewScanner scanner;
  int err = client.ups_show_sessions(scanner, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  if (OB_SUCCESS == err)
  {
    SessionMgr sm;
    ShowSessions ss(sm, scanner);
    scanner.set_default_row_desc(&(ss.get_row_desc()));
    ObRow row;
    while (OB_SUCCESS == scanner.get_next_row(row))
    {
      fprintf(stdout, "%s\n", to_cstring(row));
    }
  }
}
コード例 #25
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void get_sstable_range_list(MockClient &client, int64_t timestamp, int64_t session_id)
{
  IntArray<2> vt;
  vt.v[0] = timestamp;
  vt.v[1] = session_id;
  ObTabletInfoList ti_list;
  int err = client.get_sstable_range_list(vt, ti_list, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  if (OB_SUCCESS == err)
  {
    for (int64_t i = 0; i < ti_list.get_tablet_size(); i++)
    {
      const ObTabletInfo &ti = ti_list.get_tablet()[i];
      fprintf(stdout, "%s row_count=%ld occupy_size=%ld\n",
              scan_range2str(ti.range_), ti.row_count_, ti.occupy_size_);
    }
  }
}
コード例 #26
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void fetch_schema(MockClient &client, int64_t timestamp)
{
  ObSchemaManagerV2 *schema_mgr = new(std::nothrow) ObSchemaManagerV2();
  if (NULL == schema_mgr)
  {
    fprintf(stdout, "[%s] new ObSchemaManagerV2 fail\n", __FUNCTION__);
  }
  else
  {
    int err = client.fetch_schema(timestamp, *schema_mgr, timeout);
    fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
    if (OB_SUCCESS == err)
    {
      print_schema(*schema_mgr);
    }
    delete schema_mgr;
  }
}
コード例 #27
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
int get(const char *fname, PageArena<char> &allocer, MockClient &client, const char *version_range,
        const char * expect_result_fname, const char * schema_fname)
{
  ObScanner scanner;
  ObGetParam get_param;
  read_get_param(fname, GET_PARAM_SECTION, allocer, get_param);
  get_param.set_is_read_consistency(false);
  get_param.set_version_range(str2range(version_range));
  int err = client.ups_get(get_param, scanner, timeout);
  UNUSED(expect_result_fname);
  UNUSED(schema_fname);
  if (OB_SUCCESS == err)
  {
    print_scanner(scanner);
  }
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  return err;
}
コード例 #28
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void memory_limit(const char *memory_limit, const char *memtable_limit, MockClient &client)
{
  UpsMemoryInfo param;
  UpsMemoryInfo memory_info;
  param.cur_limit_size = (NULL == memory_limit) ?  0 : atoll(memory_limit);
  param.table_mem_info.memtable_limit = (NULL == memtable_limit) ? 0 : atoll(memtable_limit);
  int err = client.memory_limit(param, memory_info, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  if (OB_SUCCESS == err)
  {
    fprintf(stdout, "memory_limit err=%d\n", err);
    fprintf(stdout, "memory_info_version=%ld\n", memory_info.version);
    fprintf(stdout, "total_size\t=% '15ld\n", memory_info.total_size);
    fprintf(stdout, "cur_limit_size\t=% '15ld\n", memory_info.cur_limit_size);
    fprintf(stdout, "memtable_used\t=% '15ld\n", memory_info.table_mem_info.memtable_used);
    fprintf(stdout, "memtable_total\t=% '15ld\n", memory_info.table_mem_info.memtable_total);
    fprintf(stdout, "memtable_limit\t=% '15ld\n", memory_info.table_mem_info.memtable_limit);
  }
}
コード例 #29
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void priv_queue_conf(const char* conf_str, MockClient &client)
{
  UpsPrivQueueConf param;
  UpsPrivQueueConf priv_queue_conf;
  sscanf(conf_str, "%ld%ld%ld%ld", &param.low_priv_network_lower_limit,
      &param.low_priv_network_upper_limit, &param.low_priv_adjust_flag,
      &param.low_priv_cur_percent);

  int err = client.priv_queue_conf(param, priv_queue_conf, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
  if (OB_SUCCESS == err)
  {
    fprintf(stdout, "priv_queue_conf err=%d\n", err);
    fprintf(stdout, "low_priv_network_lower_limit=%ld\n", priv_queue_conf.low_priv_network_lower_limit);
    fprintf(stdout, "low_priv_network_upper_limit=%ld\n", priv_queue_conf.low_priv_network_upper_limit);
    fprintf(stdout, "low_priv_adjust_flag=%ld\n", priv_queue_conf.low_priv_adjust_flag);
    fprintf(stdout, "low_priv_cur_percent=%ld\n", priv_queue_conf.low_priv_cur_percent);
  }
}
コード例 #30
0
ファイル: ups_admin.cpp プロジェクト: mrunix/oceanbase
void change_log_level(MockClient &client, const char *sz_log_level)
{
  int log_level = -1;
  const int64_t timeout = 1000000;

  if (0 == strcmp(sz_log_level, "DEBUG"))
    log_level = TBSYS_LOG_LEVEL_DEBUG;
  else if (0 == strcmp(sz_log_level, "WARN"))
    log_level = TBSYS_LOG_LEVEL_WARN;
  else if (0 == strcmp(sz_log_level, "INFO"))
    log_level = TBSYS_LOG_LEVEL_INFO;
  else if (0 == strcmp(sz_log_level, "ERROR"))
    log_level = TBSYS_LOG_LEVEL_ERROR;
  else {
    printf("log_level can only set [DEBUG|WARN|INFO|ERROR]\n");
    return;
  }

  int err = client.change_log_level(log_level, timeout);
  fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
}