junegunn commented on code in PR #7076:
URL: https://github.com/apache/hbase/pull/7076#discussion_r2146746804
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HeapMemoryManager.java:
##########
@@ -241,6 +238,15 @@ public float getHeapOccupancyPercent() {
: this.heapOccupancyPercent;
}
+ private boolean isHeapMemoryUsageExceedingLimit(float memStoreFraction,
+ float blockCacheFraction) {
+ int memStorePercent = (int) (memStoreFraction * CONVERT_TO_PERCENTAGE);
+ int blockCachePercent = (int) (blockCacheFraction * CONVERT_TO_PERCENTAGE);
+ int minFreeHeapPercent = (int) (this.minFreeHeapFraction *
CONVERT_TO_PERCENTAGE);
+
+ return memStorePercent + blockCachePercent + minFreeHeapPercent >
CONVERT_TO_PERCENTAGE;
Review Comment:
Ah, another case of the [spacebar heating problem](https://xkcd.com/1172/).
By not converting to the percent values, we're effectively fixing a bug that
allowed slight misconfiguration due to truncation, but then we might break
existing setups that relied on that bug.
Though I don't think anyone will be affected by the change, the benefit of
simplifying the code and fixing that benign bug does not outweigh the risk,
however small the possibility is, so you can leave it as is.
But since you're introducing this method, people might wonder why you did it
this way in the future, so I suggest leaving a comment explaining the rationale
behind the decision.
--
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]