jinhyukify commented on code in PR #6422:
URL: https://github.com/apache/hbase/pull/6422#discussion_r1875479889
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/util/MemorySizeUtil.java:
##########
@@ -207,27 +228,27 @@ public static float getBlockCacheHeapPercent(final
Configuration conf) {
* @throws IllegalArgumentException if HFILE_BLOCK_CACHE_SIZE_KEY is > 1.0
*/
public static long getOnHeapCacheSize(final Configuration conf) {
- float cachePercentage =
conf.getFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY,
- HConstants.HFILE_BLOCK_CACHE_SIZE_DEFAULT);
+ final float cachePercentage = getBlockCacheHeapPercent(conf);
if (cachePercentage <= 0.0001f) {
return -1;
}
if (cachePercentage > 1.0) {
throw new IllegalArgumentException(
HConstants.HFILE_BLOCK_CACHE_SIZE_KEY + " must be between 0.0 and 1.0,
and not > 1.0");
}
- long max = -1L;
+
final MemoryUsage usage = safeGetHeapMemoryUsage();
- if (usage != null) {
- max = usage.getMax();
- }
+ final long heapMax = usage != null ? usage.getMax() : -1;
Review Comment:
What do you think of immediately returning `-1` in this case?
We expect this method to return a negative value when the cache is disabled.
https://github.com/apache/hbase/blob/1880cb3ab57f74ada8fd0161a400676a15b4012c/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheFactory.java#L117-L120
--
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]