diff --git a/src/nameserver/name_server_impl.cc b/src/nameserver/name_server_impl.cc index 631906d044a..2fd8336b352 100644 --- a/src/nameserver/name_server_impl.cc +++ b/src/nameserver/name_server_impl.cc @@ -622,6 +622,7 @@ bool NameServerImpl::Recover() { } RecoverOfflineTablet(); } + UpdateRealEpMapToTablet(false); if (FLAGS_use_name) { UpdateRemoteRealEpMap(); } @@ -1137,7 +1138,7 @@ void NameServerImpl::UpdateTablets(const std::vector& endpoints) { } } thread_pool_.AddTask(boost::bind(&NameServerImpl::DistributeTabletMode, this)); - thread_pool_.AddTask(boost::bind(&NameServerImpl::UpdateRealEpMapToTablet, this)); + thread_pool_.AddTask(boost::bind(&NameServerImpl::UpdateRealEpMapToTablet, this, true)); } void NameServerImpl::OnTabletOffline(const std::string& endpoint, bool startup_flag) { @@ -9651,8 +9652,8 @@ void NameServerImpl::SetSdkEndpoint(RpcController* controller, const SetSdkEndpo response->set_msg("ok"); } -void NameServerImpl::UpdateRealEpMapToTablet() { - if (!running_.load(std::memory_order_acquire)) { +void NameServerImpl::UpdateRealEpMapToTablet(bool check_running) { + if (check_running && !running_.load(std::memory_order_acquire)) { return; } decltype(tablets_) tmp_tablets; @@ -9727,7 +9728,7 @@ void NameServerImpl::UpdateRemoteRealEpMap() { remote_real_ep_map_.swap(tmp_map); } if (old_map != tmp_map) { - thread_pool_.AddTask(boost::bind(&NameServerImpl::UpdateRealEpMapToTablet, this)); + thread_pool_.AddTask(boost::bind(&NameServerImpl::UpdateRealEpMapToTablet, this, true)); } } while (false); task_thread_pool_.DelayTask(FLAGS_get_replica_status_interval, diff --git a/src/nameserver/name_server_impl.h b/src/nameserver/name_server_impl.h index 910c642dfa6..fedfcaa0465 100644 --- a/src/nameserver/name_server_impl.h +++ b/src/nameserver/name_server_impl.h @@ -720,7 +720,7 @@ class NameServerImpl : public NameServer { const std::map>& table_info_map, const std::unordered_map& pos_response); - void UpdateRealEpMapToTablet(); + void UpdateRealEpMapToTablet(bool check_running); void UpdateRemoteRealEpMap(); diff --git a/src/tablet/tablet_impl.cc b/src/tablet/tablet_impl.cc index b6b8e0c264c..bf96bbc14e8 100644 --- a/src/tablet/tablet_impl.cc +++ b/src/tablet/tablet_impl.cc @@ -4711,6 +4711,9 @@ void TabletImpl::UpdateRealEndpointMap(RpcController* controller, } std::atomic_store_explicit(&real_ep_map_, tmp_real_ep_map, std::memory_order_release); DLOG(INFO) << "real_ep_map size is " << tmp_real_ep_map->size(); + for (const auto& kv : *tmp_real_ep_map) { + LOG(INFO) << "update real endpoint: " << kv.first << " : " << kv.second; + } catalog_->UpdateClient(*tmp_real_ep_map); response->set_code(::openmldb::base::ReturnCode::kOk); response->set_msg("ok");