rmdmattingly commented on code in PR #5654:
URL: https://github.com/apache/hbase/pull/5654#discussion_r1467092647


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/DefaultOperationQuota.java:
##########
@@ -132,16 +146,28 @@ public void addMutation(final Mutation mutation) {
     operationSize[OperationType.MUTATE.ordinal()] += 
QuotaUtil.calculateMutationSize(mutation);
   }
 
+  @Override
+  public void addBlockBytesScanned(long blockBytesScanned) {
+    this.blockBytesScanned += blockBytesScanned;
+  }
+
   /**
    * Update estimate quota(read/write size/capacityUnits) which will be 
consumed
    * @param numWrites the number of write requests
    * @param numReads  the number of read requests
    * @param numScans  the number of scan requests
    */
   protected void updateEstimateConsumeQuota(int numWrites, int numReads, int 
numScans) {
-    writeConsumed = estimateConsume(OperationType.MUTATE, numWrites, 100);
-    readConsumed = estimateConsume(OperationType.GET, numReads, 100);
-    readConsumed += estimateConsume(OperationType.SCAN, numScans, 1000);
+    if (useBlockBytesScanned) {
+      writeConsumed = estimateConsume(OperationType.MUTATE, numWrites, 100);
+      // assume 1 block required for reads. this is probably a low estimate, 
which is okay
+      readConsumed = numReads > 0 ? blockSizeBytes : 0;
+      readConsumed += numScans > 0 ? blockSizeBytes : 0;

Review Comment:
   We are on the fence about whether these estimates are any good, and think 
that it's probably better to err on the low side.
   
   It's worth noting that, while low, these are still _huge_ increases from the 
previous quota estimates (which will be maintained unless one overrides the new 
config gate)



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java:
##########
@@ -2047,6 +2049,16 @@ public Configuration getReadOnlyConfiguration() {
     return new ReadOnlyConfiguration(this.conf);
   }
 
+  @Override
+  public int getMinBlockSizeBytes() {
+    if (minBlockSizeBytes > 0) {
+      return minBlockSizeBytes;
+    }
+    minBlockSizeBytes = 
Arrays.stream(this.htableDescriptor.getColumnFamilies())
+      
.mapToInt(ColumnFamilyDescriptor::getBlocksize).min().orElse(HConstants.DEFAULT_BLOCKSIZE);
+    return minBlockSizeBytes;
+  }

Review Comment:
   This is lazily evaluated and cached because it will be used in the hot path 
of requests as they evaluate their quotas



-- 
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