MCPcopy Create free account
hub / github.com/baidu/tera / UnloadTablet

Method UnloadTablet

src/tabletnode/remote_tabletnode.cc:263–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263void RemoteTabletNode::UnloadTablet(google::protobuf::RpcController* controller,
264 const UnloadTabletRequest* request,
265 UnloadTabletResponse* response,
266 google::protobuf::Closure* done) {
267 uint64_t id = request->sequence_id();
268 response->set_sequence_id(id);
269 LOG(INFO) << "accept RPC (UnloadTablet) id: " << id
270 << ", src: " << tera::utils::GetRemoteAddress(controller);
271 if (request->has_path()) {
272 std::lock_guard<std::mutex> lock(tablets_ctrl_mutex_);
273 const std::string& tablet_path = request->path();
274 if (tablets_ctrl_status_.find(tablet_path) != tablets_ctrl_status_.end()) {
275 ThreadPool::Task query_task = std::bind(&RemoteTabletNode::DoQueryTabletUnloadStatus, this,
276 controller, request, response, done);
277 lightweight_ctrl_thread_pool_->AddTask(query_task);
278 return;
279 }
280 }
281
282 if (ctrl_thread_pool_->PendingNum() > FLAGS_tera_tabletnode_ctrl_thread_num) {
283 response->set_status(kTabletNodeIsBusy);
284 done->Run();
285 return;
286 }
287 if (request->has_path()) {
288 tablets_ctrl_status_[request->path()] = TabletCtrlStatus::kCtrlWaitUnload;
289 }
290
291 ThreadPool::Task callback =
292 std::bind(&RemoteTabletNode::DoUnloadTablet, this, controller, request, response, done);
293 ctrl_thread_pool_->AddTask(callback);
294}
295
296void RemoteTabletNode::ReadTablet(google::protobuf::RpcController* controller,
297 const ReadTabletRequest* request, ReadTabletResponse* response,

Callers 1

DoUnloadTabletMethod · 0.45

Calls 4

GetRemoteAddressFunction · 0.85
AddTaskMethod · 0.80
PendingNumMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected