| 9813 | } |
| 9814 | |
| 9815 | void NameServerImpl::UpdateRealEpMapToTablet() { |
| 9816 | if (!running_.load(std::memory_order_acquire)) { |
| 9817 | return; |
| 9818 | } |
| 9819 | decltype(tablets_) tmp_tablets; |
| 9820 | decltype(real_ep_map_) tmp_map; |
| 9821 | { |
| 9822 | std::lock_guard<std::mutex> lock(mu_); |
| 9823 | if (real_ep_map_.empty()) { |
| 9824 | return; |
| 9825 | } |
| 9826 | for (const auto& tablet : tablets_) { |
| 9827 | if (tablet.second->state_ != ::fedb::api::TabletState::kTabletHealthy) { |
| 9828 | continue; |
| 9829 | } |
| 9830 | tmp_tablets.insert(std::make_pair(tablet.first, tablet.second)); |
| 9831 | } |
| 9832 | tmp_map = real_ep_map_; |
| 9833 | for (auto& pair : remote_real_ep_map_) { |
| 9834 | auto it = tmp_map.find(pair.first); |
| 9835 | if (it == tmp_map.end()) { |
| 9836 | tmp_map.insert(std::make_pair(pair.first, pair.second)); |
| 9837 | } else { |
| 9838 | it->second = pair.second; |
| 9839 | } |
| 9840 | } |
| 9841 | } |
| 9842 | for (const auto& tablet : tmp_tablets) { |
| 9843 | if (!tablet.second->client_->UpdateRealEndpointMap(tmp_map)) { |
| 9844 | PDLOG(WARNING, "UpdateRealEndpointMap for tablet %s failed!", tablet.first.c_str()); |
| 9845 | } |
| 9846 | } |
| 9847 | } |
| 9848 | |
| 9849 | void NameServerImpl::UpdateRemoteRealEpMap() { |
| 9850 | do { |
nothing calls this directly
no test coverage detected