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/10 23:14:34 UTC

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

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


##########
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:
   When do we release it?



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