MCPcopy Create free account
hub / github.com/apache/impala / RemoveNode

Method RemoveNode

be/src/scheduling/hash-ring.cc:71–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void HashRing::RemoveNode(const IpAddr& node) {
72 // This node must be in the set. Keep the iterator to erase it later.
73 NodeIterator node_it = nodes_.find(node);
74 DCHECK(node_it != nodes_.end());
75
76 // Walk the map and remove any entries that have a NodeIterator pointing to this node.
77 size_t num_removed = 0;
78 auto hash_to_node_it = hash_to_node_.begin();
79 while (hash_to_node_it != hash_to_node_.end()) {
80 if (hash_to_node_it->second == node_it) {
81 hash_to_node_it = hash_to_node_.erase(hash_to_node_it);
82 num_removed++;
83 } else {
84 hash_to_node_it++;
85 }
86 }
87 DCHECK_GT(num_removed, 0);
88 nodes_.erase(node_it);
89}
90
91const IpAddr* HashRing::GetNode(uint32_t hash_value) const {
92 if (hash_to_node_.empty()) return nullptr;

Callers 2

RemoveExecutorMethod · 0.80
TEST_FFunction · 0.80

Calls 4

eraseMethod · 0.80
findMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by 1

TEST_FFunction · 0.64