| 129 | namespace master { |
| 130 | |
| 131 | MasterImpl::MasterImpl(const std::shared_ptr<auth::AccessEntry> &access_entry, |
| 132 | const std::shared_ptr<quota::MasterQuotaEntry> "a_entry) |
| 133 | : state_machine_(MasterStatus::kIsSecondary), |
| 134 | thread_pool_(new ThreadPool(FLAGS_tera_master_impl_thread_max_num)), |
| 135 | restored_(false), |
| 136 | tablet_manager_(new TabletManager(&this_sequence_id_, this, thread_pool_.get())), |
| 137 | tabletnode_manager_(new TabletNodeManager(this)), |
| 138 | user_manager_(new UserManager), |
| 139 | zk_adapter_(NULL), |
| 140 | size_scheduler_(new SizeScheduler), |
| 141 | load_scheduler_(new LoadScheduler), |
| 142 | release_cache_timer_id_(kInvalidTimerId), |
| 143 | query_enabled_(false), |
| 144 | query_thread_pool_(new ThreadPool(FLAGS_tera_master_impl_query_thread_num)), |
| 145 | start_query_time_(0), |
| 146 | query_tabletnode_timer_id_(kInvalidTimerId), |
| 147 | load_balance_scheduled_(false), |
| 148 | load_balance_enabled_(false), |
| 149 | gc_trash_clean_enabled_(false), |
| 150 | gc_trash_clean_timer_id_(kInvalidTimerId), |
| 151 | gc_enabled_(false), |
| 152 | gc_timer_id_(kInvalidTimerId), |
| 153 | gc_query_enable_(false), |
| 154 | executor_(new ProcedureExecutor), |
| 155 | tablet_availability_(new TabletAvailability(tablet_manager_)), |
| 156 | access_entry_(access_entry), |
| 157 | access_builder_(new auth::AccessBuilder(FLAGS_tera_auth_policy)), |
| 158 | quota_entry_(quota_entry), |
| 159 | abnormal_node_mgr_(new AbnormalNodeMgr()) { |
| 160 | if (FLAGS_tera_master_cache_check_enabled) { |
| 161 | EnableReleaseCacheTimer(); |
| 162 | } |
| 163 | if (FLAGS_tera_local_addr == "") { |
| 164 | local_addr_ = utils::GetLocalHostName() + ":" + FLAGS_tera_master_port; |
| 165 | } else { |
| 166 | local_addr_ = FLAGS_tera_local_addr + ":" + FLAGS_tera_master_port; |
| 167 | } |
| 168 | |
| 169 | executor_->Start(); |
| 170 | access_builder_->Login(auth::kInternalGroup, "", nullptr); |
| 171 | if (FLAGS_tera_stat_table_enabled) { |
| 172 | stat_table_.reset(new sdk::StatTable(thread_pool_.get(), access_builder_, |
| 173 | sdk::StatTableCustomer::kMaster, local_addr_)); |
| 174 | } |
| 175 | if (!!quota_entry_) { |
| 176 | quota_entry_->SetTabletManager(tablet_manager_); |
| 177 | quota_entry_->SetTabletNodeManager(tabletnode_manager_); |
| 178 | quota_entry_->SetDfsWriteSizeQuota(FLAGS_tera_master_dfs_write_bytes_quota_in_MB << 20); |
| 179 | quota_entry_->SetDfsQpsQuota(FLAGS_tera_master_dfs_qps_quota); |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | MasterImpl::~MasterImpl() { |
| 184 | LOG(INFO) << "begin destory impl"; |
nothing calls this directly
no test coverage detected