junegunn commented on code in PR #7076:
URL: https://github.com/apache/hbase/pull/7076#discussion_r2146750447


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HeapMemoryManager.java:
##########
@@ -184,26 +184,23 @@ private boolean doInit(Configuration conf) {
       tuningEnabled = false;
     }
 
-    int gml = (int) (globalMemStorePercentMaxRange * CONVERT_TO_PERCENTAGE);
-    int bcul = (int) ((blockCachePercentMinRange) * CONVERT_TO_PERCENTAGE);
-    if (CONVERT_TO_PERCENTAGE - (gml + bcul) < 
CLUSTER_MINIMUM_MEMORY_THRESHOLD) {
+    if (isHeapMemoryUsageExceedingLimit(globalMemStorePercentMaxRange, 
blockCachePercentMinRange)) {
       throw new RuntimeException("Current heap configuration for MemStore and 
BlockCache exceeds "
-        + "the threshold required for successful cluster operation. "
-        + "The combined value cannot exceed 0.8. Please check the settings for 
"
-        + MEMSTORE_SIZE_MAX_RANGE_KEY + " and " + 
BLOCK_CACHE_SIZE_MIN_RANGE_KEY
-        + " in your configuration. " + MEMSTORE_SIZE_MAX_RANGE_KEY + " is "
-        + globalMemStorePercentMaxRange + " and " + 
BLOCK_CACHE_SIZE_MIN_RANGE_KEY + " is "
+        + "the allowed heap usage. At least " + minFreeHeapFraction
+        + " of the heap must remain free to ensure stable RegionServer 
operation. "
+        + "Please check the settings for " + MEMSTORE_SIZE_MAX_RANGE_KEY + " 
and "
+        + BLOCK_CACHE_SIZE_MIN_RANGE_KEY + " in your configuration. " + 
MEMSTORE_SIZE_MAX_RANGE_KEY
+        + " is " + globalMemStorePercentMaxRange + " and " + 
BLOCK_CACHE_SIZE_MIN_RANGE_KEY + " is "
         + blockCachePercentMinRange);
     }
-    gml = (int) (globalMemStorePercentMinRange * CONVERT_TO_PERCENTAGE);
-    bcul = (int) ((blockCachePercentMaxRange) * CONVERT_TO_PERCENTAGE);
-    if (CONVERT_TO_PERCENTAGE - (gml + bcul) < 
CLUSTER_MINIMUM_MEMORY_THRESHOLD) {
+
+    if (isHeapMemoryUsageExceedingLimit(globalMemStorePercentMinRange, 
blockCachePercentMaxRange)) {
       throw new RuntimeException("Current heap configuration for MemStore and 
BlockCache exceeds "
-        + "the threshold required for successful cluster operation. "
-        + "The combined value cannot exceed 0.8. Please check the settings for 
"
-        + MEMSTORE_SIZE_MIN_RANGE_KEY + " and " + 
BLOCK_CACHE_SIZE_MAX_RANGE_KEY
-        + " in your configuration. " + MEMSTORE_SIZE_MIN_RANGE_KEY + " is "
-        + globalMemStorePercentMinRange + " and " + 
BLOCK_CACHE_SIZE_MAX_RANGE_KEY + " is "
+        + "the allowed heap usage. At least " + minFreeHeapFraction
+        + " of the heap must remain free to ensure stable RegionServer 
operation. "
+        + "Please check the settings for " + MEMSTORE_SIZE_MIN_RANGE_KEY + " 
and "
+        + BLOCK_CACHE_SIZE_MAX_RANGE_KEY + " in your configuration. " + 
MEMSTORE_SIZE_MIN_RANGE_KEY
+        + " is " + globalMemStorePercentMinRange + " and " + 
BLOCK_CACHE_SIZE_MAX_RANGE_KEY + " is "

Review Comment:
   Maybe a chance to refactor this?



-- 
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: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to