Exemplo n.º 1
0
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();
}
Exemplo n.º 2
0
void ObBalanceTest::TearDown()
{
  sleep(1);
  worker_.get_test_stub().stop();
  worker_.get_test_stub().wait();
  server_->stop_threads();
  // test after balance thread stopped
  ASSERT_EQ(0, worker_.get_test_stub().get_migrate_msg_count());
  ASSERT_TRUE(server_->balancer_->nb_is_all_tables_balanced(balance_except_cs_));
}
void ObDeleteReplicasTest::TearDown()
{
  server_->stop_threads();
}