本文整理汇总了C++中ObRootServer2::regist_server方法的典型用法代码示例。如果您正苦于以下问题:C++ ObRootServer2::regist_server方法的具体用法?C++ ObRootServer2::regist_server怎么用?C++ ObRootServer2::regist_server使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObRootServer2
的用法示例。
在下文中一共展示了ObRootServer2::regist_server方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: server
TEST(ObRootServer2LogTest, do_server_down)
{
int32_t port = 1001;
ObServer server(ObServer::IPV4, "10.10.10.1", port);
int32_t status = 1;
int64_t ts = 123456;
ObRootServer2 master;
ObRootWorkerForTest master_worker;
ASSERT_TRUE(master.init("./root_server.conf", 100, &master_worker));
ObRootServer2 slave;
ObRootWorkerForTest slave_worker;
ASSERT_TRUE(slave.init("./root_server.conf", 100, &slave_worker));
ObRootServerTester wrapper(&slave);
wrapper.stop_thread();
int ret = master.regist_server(server, false, status, ts);
ASSERT_EQ(OB_SUCCESS, ret);
ObRootLogWorker log_worker = wrapper.get_log_worker();
log_worker.do_cs_regist(server, ts); // up server
ObChunkServerManager& server_manager = wrapper.get_server_manager();
ObChunkServerManager::iterator it = server_manager.find_by_ip(server);
ASSERT_TRUE(it != server_manager.end());
ASSERT_NE(ObServerStatus::STATUS_DEAD, it->status_);
log_worker.do_server_down(server, ts); // down server
it = server_manager.find_by_ip(server);
ASSERT_TRUE(it != server_manager.end());
ASSERT_EQ(ObServerStatus::STATUS_DEAD, it->status_);
}
示例2: register_cs
void ObBalanceTest::register_cs(int32_t cs_num)
{
for (int i = 0; i < cs_num; ++i)
{
int32_t status = 0;
ASSERT_EQ(OB_SUCCESS, server_->regist_server(get_addr(i), false, status));
TBSYS_LOG(INFO, "register cs, id=%d status=%d", i, status);
}
}
示例3: setup
void MigrateTestEnv::setup()
{
// 1. init
ObRootServer2* rs = worker_.get_root_server();
ASSERT_TRUE(rs->init("./root_server.conf", 100, &worker_));
rs->start_threads();
sleep(1);
// 2. cs register
int status;
ASSERT_EQ(OB_SUCCESS, rs->regist_server(cs1_, false, status));
ASSERT_EQ(OB_SUCCESS, rs->regist_server(cs2_, false, status));
// 3. cs1 report tablets replicas
ObTabletReportInfoList report_list1;
ObTabletReportInfoList report_list2;
ObTabletReportInfo report_info;
ObTabletLocation location;
location.tablet_version_ = tablet_version_;
info1_.range_.table_id_ = 10001;
info1_.range_.border_flag_.set_inclusive_end();
info1_.range_.border_flag_.unset_inclusive_start();
info1_.range_.border_flag_.set_min_value();
info1_.range_.border_flag_.unset_max_value();
info1_.range_.start_key_.assign_buffer(buf1[0], 30);
info1_.range_.end_key_.assign_buffer(buf2[0], 30);
info1_.range_.start_key_.write("aa1", 3);
info1_.range_.end_key_.write("ba1", 3);
location.chunkserver_ = cs1_;
report_info.tablet_info_ = info1_;
report_info.tablet_location_ = location;
report_list1.add_tablet(report_info);
info1_.range_.border_flag_.unset_min_value();
info1_.range_.border_flag_.set_max_value();
info1_.range_.start_key_.assign_buffer(buf1[1], 30);
info1_.range_.end_key_.assign_buffer(buf2[1], 30);
info1_.range_.start_key_.write("ba1", 3);
info1_.range_.end_key_.write("ca1", 3);
report_info.tablet_info_ = info1_;
report_info.tablet_location_ = location;
report_list1.add_tablet(report_info);
int64_t now = tbsys::CTimeUtil::getTime();
ASSERT_EQ(OB_SUCCESS, rs->report_tablets(cs1_, report_list1, now));
ASSERT_EQ(OB_SUCCESS, rs->report_tablets(cs2_, report_list2, now));
// wait init finish
sleep(5);
}