Skip to content

Commit c057037

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 8ec5fb0 commit c057037

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
@@ -279,6 +279,8 @@ public BucketCache(String ioEngineName, long capacity, int blockSize, int[] buck
279279
public BucketCache(String ioEngineName, long capacity, int blockSize, int[] bucketSizes,
280280
int writerThreadNum, int writerQLen, String persistencePath, int ioErrorsTolerationDuration,
281281
Configuration conf) throws IOException {
282+
Preconditions.checkArgument(blockSize > 0,
283+
"BucketCache capacity is set to " + blockSize + ", can not be less than 0");
282284
this.algorithm = conf.get(FILE_VERIFY_ALGORITHM, DEFAULT_FILE_VERIFY_ALGORITHM);
283285
this.ioEngine = getIOEngineFromName(ioEngineName, capacity, persistencePath);
284286
this.writerThreads = new WriterThread[writerThreadNum];

0 commit comments

Comments
 (0)