From 5134eedce686b1f2d4f64c3a29e57e6bbf261dd6 Mon Sep 17 00:00:00 2001 From: ConfX <114765570+teamconfx@users.noreply.github.com> Date: Thu, 28 Mar 2024 23:04:02 +0800 Subject: [PATCH] HBASE-27993 AbstractFSWAL causes ArithmeticException due to improper logRollSize value checking (#5390) Signed-off-by: Duo Zhang Signed-off-by: Wei-Chiu Chuang (cherry picked from commit 8be9e51fdf474a94b12aab63332f8bb0344854f6) --- .../apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java | 3 +++ 1 file changed, 3 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 dbeb66f8ae3e..79033607deb5 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 @@ -378,6 +378,9 @@ 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, " + + "current value is " + logRollSize); Pair globalMemstoreSize = MemorySizeUtil.getGlobalMemStoreSize(conf); return (int) ((globalMemstoreSize.getFirst() * 2) / logRollSize); }