Skip to content

Commit

Permalink
Fix ReclaimedSpaceViaDeletes stats incorrect problem. (apache#3906)
Browse files Browse the repository at this point in the history
  • Loading branch information
horizonzy committed Apr 22, 2023
1 parent ca33b31 commit cad1436
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
} else {
entryLogMetaMap.put(entryLogId, entryLogMeta);
}
Expand Down

0 comments on commit cad1436

Please sign in to comment.