Apache9 commented on code in PR #5388:
URL: https://github.com/apache/hbase/pull/5388#discussion_r1334930414


##########
hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java:
##########
@@ -171,11 +171,19 @@ public static ByteBuffAllocator create(Configuration 
conf, boolean reservoirEnab
       // that by the time a handler originated response is actually done 
writing to socket and so
       // released the BBs it used, the handler might have processed one more 
read req. On an avg 2x
       // we consider and consider that also for the max buffers to pool
+      if (poolBufSize <= 0) {
+        throw new IllegalArgumentException(BUFFER_SIZE_KEY + " must be 
positive. Please disable "
+          + "the reservoir rather than setting the size of the buffer to zero 
or negative.");
+      }
       int bufsForTwoMB = (2 * 1024 * 1024) / poolBufSize;
       int maxBuffCount =
         conf.getInt(MAX_BUFFER_COUNT_KEY, 
conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT,
           HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT) * bufsForTwoMB * 2);
       int minSizeForReservoirUse = conf.getInt(MIN_ALLOCATE_SIZE_KEY, 
poolBufSize / 6);
+      if (minSizeForReservoirUse == 0) {

Review Comment:
   What if minSizeForReservoirUse < 0 here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to