Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
aceforeverd committed Oct 26, 2023
1 parent 5d32ca7 commit f4b478e
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/nameserver/name_server_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4996,8 +4996,6 @@ void NameServerImpl::SchedMakeSnapshot() {

void NameServerImpl::UpdateTableStatus() {
std::map<std::string, std::shared_ptr<TabletInfo>> tablet_ptr_map;
std::unordered_map<std::string, ::openmldb::api::TableStatus> pos_response;
pos_response.reserve(16);
{
std::lock_guard<std::mutex> lock(mu_);
for (const auto& kv : tablets_) {
Expand All @@ -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<std::string, ::openmldb::api::TableStatus> 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()) {
Expand Down

0 comments on commit f4b478e

Please sign in to comment.