You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by ch...@apache.org on 2023/04/22 02:25:34 UTC
[bookkeeper] branch master updated: Fix ReclaimedSpaceViaDeletes stats incorrect problem. (#3906)
This is an automated email from the ASF dual-hosted git repository.
chenhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new cad1436375 Fix ReclaimedSpaceViaDeletes stats incorrect problem. (#3906)
cad1436375 is described below
commit cad143637547a556a25bab4950c78e630e9b38f8
Author: Yan Zhao <ho...@apache.org>
AuthorDate: Sat Apr 22 10:25:27 2023 +0800
Fix ReclaimedSpaceViaDeletes stats incorrect problem. (#3906)
Descriptions of the changes in this PR:
https://github.com/apache/bookkeeper/blob/a6387d191f28a59af72f6613b633d6898980a0b0/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java#L487-L517
At line 501, increases getReclaimedSpaceViaDeletes stats.
https://github.com/apache/bookkeeper/blob/a6387d191f28a59af72f6613b633d6898980a0b0/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java#L734-L767
But at line 755, it didn't increase getReclaimedSpaceViaDeletes stats.
---
.../org/apache/bookkeeper/bookie/GarbageCollectorThread.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
index 5de2292263..ab66f03e09 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
@@ -751,11 +751,12 @@ public class GarbageCollectorThread implements Runnable {
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);
}