From f4b478e0bcc02c29e8a47538ef5f141663c3fedd Mon Sep 17 00:00:00 2001 From: aceforeverd Date: Thu, 26 Oct 2023 09:22:28 +0000 Subject: [PATCH] revert --- src/nameserver/name_server_impl.cc | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/nameserver/name_server_impl.cc b/src/nameserver/name_server_impl.cc index 85a9764d732..862ee42d320 100644 --- a/src/nameserver/name_server_impl.cc +++ b/src/nameserver/name_server_impl.cc @@ -4996,8 +4996,6 @@ void NameServerImpl::SchedMakeSnapshot() { void NameServerImpl::UpdateTableStatus() { std::map> tablet_ptr_map; - std::unordered_map pos_response; - pos_response.reserve(16); { std::lock_guard lock(mu_); for (const auto& kv : tablets_) { @@ -5006,21 +5004,19 @@ void NameServerImpl::UpdateTableStatus() { } tablet_ptr_map.insert(std::make_pair(kv.first, kv.second)); } - - for (const auto& kv : tablet_ptr_map) { - ::openmldb::api::GetTableStatusResponse tablet_status_response; - if(!kv.second->client_){ - LOG(WARNING) << "invalid tablet client??"; - } - if (!kv.second->client_->GetTableStatus(tablet_status_response)) { - PDLOG(WARNING, "get table status failed! endpoint[%s]", kv.first.c_str()); - continue; - } - for (int pos = 0; pos < tablet_status_response.all_table_status_size(); pos++) { - std::string key = absl::StrCat(tablet_status_response.all_table_status(pos).tid(), "_", - tablet_status_response.all_table_status(pos).pid(), "_", kv.first); - pos_response.emplace(key, tablet_status_response.all_table_status(pos)); - } + } + std::unordered_map pos_response; + pos_response.reserve(16); + for (const auto& kv : tablet_ptr_map) { + ::openmldb::api::GetTableStatusResponse tablet_status_response; + if (!kv.second->client_->GetTableStatus(tablet_status_response)) { + PDLOG(WARNING, "get table status failed! endpoint[%s]", kv.first.c_str()); + continue; + } + for (int pos = 0; pos < tablet_status_response.all_table_status_size(); pos++) { + std::string key = absl::StrCat(tablet_status_response.all_table_status(pos).tid(), "_", + tablet_status_response.all_table_status(pos).pid(), "_", kv.first); + pos_response.emplace(key, tablet_status_response.all_table_status(pos)); } } if (pos_response.empty()) {