Skip to content

Commit e2d7ec9

Browse files
teamconfxApache9
authored andcommitted
HBASE-27990 BucketCache causes ArithmeticException due to improper blockSize value checking (#5389)
Signed-off-by: Duo Zhang <[email protected]> (cherry picked from commit 5a0c4de)
1 parent 63ffb6c commit e2d7ec9

File tree

1 file changed

+2
-0
lines changed
  • hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket

1 file changed

+2
-0
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ public BucketCache(String ioEngineName, long capacity, int blockSize, int[] buck
283283
public BucketCache(String ioEngineName, long capacity, int blockSize, int[] bucketSizes,
284284
int writerThreadNum, int writerQLen, String persistencePath, int ioErrorsTolerationDuration,
285285
Configuration conf) throws IOException {
286+
Preconditions.checkArgument(blockSize > 0,
287+
"BucketCache capacity is set to " + blockSize + ", can not be less than 0");
286288
boolean useStrongRef = conf.getBoolean(STRONG_REF_KEY, STRONG_REF_DEFAULT);
287289
if (useStrongRef) {
288290
this.offsetLock = new IdReadWriteLockStrongRef<>();

0 commit comments

Comments
 (0)