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(); }
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"); }