Skip to content

Commit 5a0c4de

Browse files
authored
HBASE-27990 BucketCache causes ArithmeticException due to improper blockSize value checking (apache#5389)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
1 parent 298c550 commit 5a0c4de

File tree

1 file changed

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

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ 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, "BucketCache capacity is set to " + blockSize + ", can not be less than 0");
286287
boolean useStrongRef = conf.getBoolean(STRONG_REF_KEY, STRONG_REF_DEFAULT);
287288
if (useStrongRef) {
288289
this.offsetLock = new IdReadWriteLockStrongRef<>();

0 commit comments

Comments
 (0)