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


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:
##########
@@ -751,11 +751,12 @@ protected void extractMetaFromEntryLogs() throws 
EntryLogMetadataMapException {
                 EntryLogMetadata entryLogMeta = 
entryLogger.getEntryLogMetadata(entryLogId, throttler);
                 removeIfLedgerNotExists(entryLogMeta);
                 if (entryLogMeta.isEmpty()) {
-                    LOG.info("Entry log file {} is empty, delete it from 
disk.", Long.toHexString(entryLogId));
-                    entryLogger.removeEntryLog(entryLogId);
-                    // remove it from entrylogmetadata-map if it is present in
-                    // the map
-                    entryLogMetaMap.remove(entryLogId);
+                    // This means the entry log is not associated with any 
active
+                    // ledgers anymore.
+                    // We can remove this entry log file now.
+                    LOG.info("Deleting entryLogId {} as it has no active 
ledgers!", entryLogId);
+                    removeEntryLog(entryLogId);
+                    
gcStats.getReclaimedSpaceViaDeletes().addCount(entryLogMeta.getTotalSize());

Review Comment:
   We don't need to update the stats because the entryLogMeta is empty and the 
`entryLogMeta.getTotalSize()` will be `0`



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