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

Method VerifyTotalAllocation

be/src/scheduling/hash-ring-test.cc:52–64  ·  view source on GitHub ↗

Verify that the allocations that GetDistributionMap() returns for each node sum to the size of the hash space (UINT_MAX + 1).

Source from the content-addressed store, hash-verified

50 // Verify that the allocations that GetDistributionMap() returns for each node
51 // sum to the size of the hash space (UINT_MAX + 1).
52 void VerifyTotalAllocation(const vector<IpAddr>& addresses,
53 const uint32_t replication) {
54 HashRing hash_ring(replication);
55 for (const IpAddr& addr : addresses) hash_ring.AddNode(addr);
56 std::map<IpAddr, uint64_t> dist_map;
57 hash_ring.GetDistributionMap(&dist_map);
58 uint64_t total_allocation = 0;
59 uint64_t total_uint32_range = static_cast<uint64_t>(UINT_MAX) + 1;
60 for (auto dist_map_it : dist_map) {
61 total_allocation += dist_map_it.second;
62 }
63 EXPECT_EQ(total_allocation, total_uint32_range);
64 }
65
66 // Verify that ratio of the maximum allocation to the minimum allocation is below
67 // the 'expected_ratio_limit'.

Callers

nothing calls this directly

Calls 2

AddNodeMethod · 0.80
GetDistributionMapMethod · 0.45

Tested by

no test coverage detected