You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/04/11 01:08:57 UTC

[GitHub] [bookkeeper] hangc0276 commented on a diff in pull request #3192: Fix compaction throttle imprecise

hangc0276 commented on code in PR #3192:
URL: https://github.com/apache/bookkeeper/pull/3192#discussion_r846881714


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java:
##########
@@ -1014,10 +1041,18 @@ public void scanEntryLog(long entryLogId, EntryLogScanner scanner) throws IOExce
                 if (pos >= bc.size()) {
                     break;
                 }
-                if (readFromLogChannel(entryLogId, bc, headerBuffer, pos) != headerBuffer.capacity()) {
+
+                Pair<Integer, Integer> readBytesPair =
+                    readFromLogChannelWithPrefetchBytes(entryLogId, bc, headerBuffer, pos);
+                if (readBytesPair.getLeft() != headerBuffer.capacity()) {
                     LOG.warn("Short read for entry size from entrylog {}", entryLogId);
                     return;
                 }
+
+                if (throttler != null) {
+                    throttler.acquire(readBytesPair.getRight());

Review Comment:
   The release operation controlled by `RateLimiter` library in guava



-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org