Beispiel #1
0
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);
}
void ObBalanceTest::SetUp()
{
  server_ = worker_.get_root_server();
  worker_.set_config_file_name("ob_new_balance_test.conf");
  ASSERT_EQ(OB_SUCCESS, worker_.initialize());
  server_->config_.flag_migrate_wait_seconds_.set(20);
  server_->config_.flag_enable_rereplication_.set(0); // disable
  server_->start_threads();
  sleep(1);
  worker_.get_role_manager()->set_role(ObRoleMgr::STANDALONE); // for testing
  worker_.get_test_stub().set_server(server_);
  worker_.get_test_stub().start();
}
void ObDeleteReplicasTest::SetUp()
{
  server_ = worker_.get_root_server();
  common::ObSystemConfig sys_config;
  sys_config.init();
  //worker_.set_config_file_name("ob_delete_replicas_test.conf");
  worker_.rs_config_.init(sys_config);
  worker_.rs_config_.port = 1110;
  worker_.rs_config_.io_thread_count = 2;
  worker_.create_eio();
  worker_.rs_config_.read_queue_size = 2;
  worker_.rs_config_.root_server_ip.set_value("10.232.35.40");
  worker_.rs_config_.schema_filename.set_value("ob_delete_replicas_test_schema.ini");
  ASSERT_EQ(OB_SUCCESS, worker_.initialize());
  worker_.get_role_manager()->set_role(ObRoleMgr::STANDALONE); // for testing

  server_->start_threads();
  sleep(5);
}