wchevreuil commented on code in PR #4799:
URL: https://github.com/apache/hbase/pull/4799#discussion_r1107232429
##########
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/BalancerClusterState.java:
##########
@@ -553,6 +558,61 @@ enum LocalityType {
RACK
}
+ public float getOrComputeWeightedPrefetchRatio(int region, int server) {
+ return getRegionSizeMB(region) *
getOrComputeRegionPrefetchRatio()[region][server];
+ }
+
+ private float[][] getOrComputeRegionPrefetchRatio() {
+ if (regionServerWithBestPrefetchRatio == null || regionServerPrefetchRatio
== null) {
+ computeRegionServerPrefetchRatio();
+ }
+ return regionServerPrefetchRatio;
+ }
+
+ public int[] getOrComputeServerWithBestPrefetchRatio() {
+ if (regionServerWithBestPrefetchRatio == null || regionServerPrefetchRatio
== null) {
+ computeRegionServerPrefetchRatio();
+ }
+ return regionServerWithBestPrefetchRatio;
+ }
+
+ private void computeRegionServerPrefetchRatio() {
+ regionServerPrefetchRatio = new float[numRegions][numServers];
+ regionServerWithBestPrefetchRatio = new int[numRegions];
+
+ for (int region = 0; region < numRegions; region++) {
+ float bestPrefetchRatio = 0.0f;
+ int serverWithBestPrefetchRatio = 0;
+ for (int server = 0; server < numServers; server++) {
Review Comment:
Thanks for the explanation, makes sense to me now.
--
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]