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

Method GetLeader

src/nameserver/name_server_impl.cc:6357–6373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6355}
6356
6357int NameServerImpl::GetLeader(std::shared_ptr<::fedb::nameserver::TableInfo> table_info, uint32_t pid,
6358 std::string& leader_endpoint) {
6359 for (int idx = 0; idx < table_info->table_partition_size(); idx++) {
6360 if (table_info->table_partition(idx).pid() != pid) {
6361 continue;
6362 }
6363 for (int meta_idx = 0; meta_idx < table_info->table_partition(idx).partition_meta_size(); meta_idx++) {
6364 if (table_info->table_partition(idx).partition_meta(meta_idx).is_leader() &&
6365 table_info->table_partition(idx).partition_meta(meta_idx).is_alive()) {
6366 leader_endpoint = table_info->table_partition(idx).partition_meta(meta_idx).endpoint();
6367 return 0;
6368 }
6369 }
6370 break;
6371 }
6372 return -1;
6373}
6374
6375int NameServerImpl::CreateReAddReplicaSimplifyOP(const std::string& name, const std::string& db, uint32_t pid,
6376 const std::string& endpoint, uint64_t offset_delta, uint64_t parent_id,

Callers 1

operator==Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected