MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / UpdateRealEndpointMap

Method UpdateRealEndpointMap

src/tablet/tablet_impl.cc:5093–5117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5091}
5092
5093void TabletImpl::UpdateRealEndpointMap(RpcController* controller,
5094 const fedb::api::UpdateRealEndpointMapRequest* request,
5095 fedb::api::GeneralResponse* response, Closure* done) {
5096 DLOG(INFO) << "UpdateRealEndpointMap";
5097 brpc::ClosureGuard done_guard(done);
5098 if (FLAGS_zk_cluster.empty()) {
5099 response->set_code(-1);
5100 response->set_msg("tablet is not run in cluster mode");
5101 PDLOG(WARNING, "tablet is not run in cluster mode");
5102 return;
5103 }
5104 decltype(real_ep_map_) tmp_real_ep_map =
5105 std::make_shared<std::map<std::string, std::string>>();
5106 for (int i = 0; i < request->real_endpoint_map_size(); i++) {
5107 auto& pair = request->real_endpoint_map(i);
5108 tmp_real_ep_map->insert(
5109 std::make_pair(pair.name(), pair.real_endpoint()));
5110 }
5111 std::atomic_store_explicit(&real_ep_map_, tmp_real_ep_map,
5112 std::memory_order_release);
5113 DLOG(INFO) << "real_ep_map size is " << tmp_real_ep_map->size();
5114 catalog_->UpdateClient(*tmp_real_ep_map);
5115 response->set_code(::fedb::base::ReturnCode::kOk);
5116 response->set_msg("ok");
5117}
5118
5119bool TabletImpl::GetRealEp(uint64_t tid, uint64_t pid,
5120 std::map<std::string, std::string>* real_ep_map) {

Callers 1

Calls 4

insertMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
UpdateClientMethod · 0.45

Tested by

no test coverage detected