当前位置: 首页>>代码示例>>C++>>正文


C++ ObRootServer2::update_capacity_info方法代码示例

本文整理汇总了C++中ObRootServer2::update_capacity_info方法的典型用法代码示例。如果您正苦于以下问题:C++ ObRootServer2::update_capacity_info方法的具体用法?C++ ObRootServer2::update_capacity_info怎么用?C++ ObRootServer2::update_capacity_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObRootServer2的用法示例。


在下文中一共展示了ObRootServer2::update_capacity_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: server

TEST(ObRootServer2LogTest, do_load_report)
{
  int32_t port = 1001;
  ObServer server(ObServer::IPV4, "10.10.10.1", port);
  int32_t status = 1;
  int64_t ts = 123456;

  int64_t cap = 12345;
  int64_t used = 1234;

  ObRootServer2 master;
  ObRootWorkerForTest master_worker;
  ASSERT_TRUE(master.init("./root_server.conf", 100, &master_worker));
  ObRootServerTester master_wrapper(&master);
  master_wrapper.stop_thread();

  ObRootServer2 slave;
  ObRootWorkerForTest slave_worker;
  ASSERT_TRUE(slave.init("./root_server.conf", 100, &slave_worker));
  ObRootServerTester slave_wrapper(&slave);
  slave_wrapper.stop_thread();

  int ret = master.regist_server(server, false, status, ts);
  ASSERT_EQ(OB_SUCCESS, ret);
  ret = master.update_capacity_info(server, cap, used);
  ASSERT_EQ(OB_SUCCESS, ret);

  ObRootLogWorker log_worker = slave_wrapper.get_log_worker();
  log_worker.do_cs_regist(server, ts);
  log_worker.do_cs_load_report(server, cap, used);

  ObChunkServerManager& master_server_manager = master_wrapper.get_server_manager();
  ObChunkServerManager::iterator it = master_server_manager.find_by_ip(server);
  ASSERT_TRUE(it != master_server_manager.end());

  int64_t master_cap = it->disk_info_.get_capacity();
  int32_t master_used = it->disk_info_.get_used();

  ObChunkServerManager& slave_server_manager = slave_wrapper.get_server_manager();
  it = slave_server_manager.find_by_ip(server);
  ASSERT_TRUE(it != slave_server_manager.end());

  int64_t slave_cap = it->disk_info_.get_capacity();
  int32_t slave_used = it->disk_info_.get_used();

  ASSERT_EQ(cap, master_cap);
  ASSERT_EQ(used, master_used);
  ASSERT_EQ(master_cap, slave_cap);
  ASSERT_EQ(master_used, slave_used);
}
开发者ID:Abioy,项目名称:oceanbase,代码行数:50,代码来源:root_server_log_test.cpp


注:本文中的ObRootServer2::update_capacity_info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。