AnonHxy commented on code in PR #4602: URL: https://github.com/apache/bookkeeper/pull/4602#discussion_r2085806272
########## bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/cli/commands/bookie/ReadLogMetadataCommand.java: ########## @@ -131,8 +131,7 @@ private void printEntryLogMetadata(ServerConfiguration conf, long logId) throws LOG.info("Print entryLogMetadata of entrylog {} ({}.log)", logId, Long.toHexString(logId)); initEntryLogger(conf); EntryLogMetadata entryLogMetadata = entryLogger.getEntryLogMetadata(logId); - LOG.info("entryLogId: {}, remaining size: {}, total size: {}, usage: {}", entryLogMetadata.getEntryLogId(), - entryLogMetadata.getRemainingSize(), entryLogMetadata.getTotalSize(), entryLogMetadata.getUsage()); + LOG.info("entryLogId: {}, total size: {}", entryLogMetadata.getEntryLogId(), entryLogMetadata.getTotalSize()); Review Comment: `entryLogger.getEntryLogMetadata(logId)` only add `totalSize` and `remainingSize` without reducing `remainingSize`: https://github.com/apache/bookkeeper/blob/22c45f925a174be3fde0c4ce86923a3751a54cc8/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogMetadata.java#L57-L60 DefaultEntryLogger#extractEntryLogMetadataFromIndex: https://github.com/apache/bookkeeper/blob/22c45f925a174be3fde0c4ce86923a3751a54cc8/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java#L1126-L1134 if we want to know the real `remainingSize`, we should traverse the metadata and call `EntryLogMetadata#removeLedgerIf`, and that is what `bin/bookkeeper shell activeledgers` do. https://github.com/apache/bookkeeper/blob/22c45f925a174be3fde0c4ce86923a3751a54cc8/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java#L570-L577 So I think if we want to know the usage of the entry log, we can call `bin/bookkeeper shell activeledgers` insteal of `bin/bookkeeper shell readlogmetadata` -- 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: commits-unsubscr...@bookkeeper.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org