rmdmattingly commented on code in PR #6651:
URL: https://github.com/apache/hbase/pull/6651#discussion_r1959646133
##########
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/BalancerClusterState.java:
##########
@@ -123,6 +128,14 @@ class BalancerClusterState {
// Maps regionName -> oldServerName -> cache ratio of the region on the old
server
Map<String, Pair<ServerName, Float>> regionCacheRatioOnOldServerMap;
+ private Supplier<List<Integer>> shuffledServerIndicesSupplier =
+ Suppliers.memoizeWithExpiration(() -> {
+ Collection<Integer> serverIndices = serversToIndex.values();
+ List<Integer> shuffledServerIndices = new ArrayList<>(serverIndices);
+ Collections.shuffle(shuffledServerIndices);
+ return shuffledServerIndices;
+ }, 5, TimeUnit.SECONDS);
Review Comment:
There's no magic here — we run candidate generation often, and the value in
reshuffling constantly is pretty low. But we _do_ want to reshuffle regularly
because it provides the stochastic-y nature that helps us avoid deadlocks. I
suppose we could wire this up to something in the balancer so that the TTL has
something more balancer-centric. ~I suppose it could be bad if the cache
somehow lived across >1 balancer run when server indices changed~ This would
actually never happen because BalancerClusterState objects are unique to their
balancer run
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]