本文整理汇总了C++中ObRootServer2::migrate_over方法的典型用法代码示例。如果您正苦于以下问题:C++ ObRootServer2::migrate_over方法的具体用法?C++ ObRootServer2::migrate_over怎么用?C++ ObRootServer2::migrate_over使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObRootServer2
的用法示例。
在下文中一共展示了ObRootServer2::migrate_over方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tester
TEST(ObRootServer2Test2, migrate_over2_1)
{
MigrateTestEnv env;
env.setup();
ObRootServer2* rs = env.worker_.get_root_server();
ObRootServerTester tester(rs);
ObChunkServerManager& csmgr = tester.get_server_manager();
ObRootTable2* roottable = tester.get_root_table_for_query();
/// case 1
// 4. target cs2 down
ObChunkServerManager::iterator it = csmgr.find_by_ip(env.cs2_);
ASSERT_TRUE(csmgr.end() != it);
csmgr.set_server_down(it);
int64_t now = tbsys::CTimeUtil::getTime();
roottable->server_off_line(it - csmgr.begin(), now);
// 5. report migrate over
rs->migrate_over(env.info1_.range_, env.cs1_, env.cs2_, true, env.tablet_version_);
// 6. verify
ObRootTable2::const_iterator it1, it2;
ASSERT_EQ(OB_SUCCESS, roottable->find_range(env.info1_.range_, it1, it2));
ASSERT_EQ(it1, it2);
ASSERT_EQ(0, it1->server_info_indexes_[0]);
ASSERT_EQ(OB_INVALID_INDEX, it1->server_info_indexes_[1]);
ASSERT_EQ(OB_INVALID_INDEX, it1->server_info_indexes_[2]);
rs->stop_threads();
}
示例2: run
void BalanceTestRpc::run(tbsys::CThread *thread, void *arg)
{
UNUSED(thread);
UNUSED(arg);
TBSYS_LOG(INFO, "balance test rpc thread begin");
while(!_stop)
{
TBSYS_LOG(DEBUG, "balance test rpc thread running");
MigrateMsg *msg = NULL;
int ret = pop_migrate_msg(msg);
if (OB_SUCCESS == ret)
{
assert(server_);
if (blocked_cs_ == msg->src_cs_)
{
char addr_buf1[OB_IP_STR_BUFF];
blocked_cs_.to_string(addr_buf1, OB_IP_STR_BUFF);
TBSYS_LOG(DEBUG, "drop migrate msg, src_cs=%s", addr_buf1);
}
else if (blocked_dest_cs_ == msg->dest_cs_)
{
char addr_buf1[OB_IP_STR_BUFF];
blocked_dest_cs_.to_string(addr_buf1, OB_IP_STR_BUFF);
TBSYS_LOG(DEBUG, "drop migrate msg, dest_cs=%s", addr_buf1);
}
else
{
server_->migrate_over(msg->range_, msg->src_cs_, msg->dest_cs_, msg->keep_src_, 2);
}
delete_migrate_msg(msg);
}
else
{
usleep(500*1000);
}
}
TBSYS_LOG(INFO, "balance test rpc thread finished");
}