From e98e3f31b410f018ae8f8b5ea91c68d998e5871e Mon Sep 17 00:00:00 2001 From: teamconfx Date: Tue, 12 Sep 2023 00:01:18 +0800 Subject: [PATCH 1/2] check that logRollSize must be positive when calculating max log files --- .../org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java index b3445ab42423..eafd526351ee 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java @@ -462,6 +462,8 @@ protected long getFileNumFromFileName(Path fileName) { } private int calculateMaxLogFiles(Configuration conf, long logRollSize) { + checkArgument(logRollSize > 0, + "The log roll size cannot be zero or negative when calculating max log files."); Pair globalMemstoreSize = MemorySizeUtil.getGlobalMemStoreSize(conf); return (int) ((globalMemstoreSize.getFirst() * 2) / logRollSize); } From 366c5fcaf5914bac2c3e1a25dab99acbcfd4cb7f Mon Sep 17 00:00:00 2001 From: teamconfx Date: Wed, 20 Mar 2024 16:44:54 -0500 Subject: [PATCH 2/2] include logRollSize value in the error message --- .../apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java index eafd526351ee..fc452404979b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java @@ -463,7 +463,8 @@ protected long getFileNumFromFileName(Path fileName) { private int calculateMaxLogFiles(Configuration conf, long logRollSize) { checkArgument(logRollSize > 0, - "The log roll size cannot be zero or negative when calculating max log files."); + "The log roll size cannot be zero or negative when calculating max log files, " + + "current value is " + logRollSize); Pair globalMemstoreSize = MemorySizeUtil.getGlobalMemStoreSize(conf); return (int) ((globalMemstoreSize.getFirst() * 2) / logRollSize); }