You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by yo...@apache.org on 2023/12/06 07:43:02 UTC
(bookkeeper) 07/21: Fix ReclaimedSpaceViaDeletes stats incorrect problem. (#3906)
This is an automated email from the ASF dual-hosted git repository.
yong pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
commit 9bae71984136f9b62e0ef970807fd1a7e92b1dcd
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.
(cherry picked from commit cad143637547a556a25bab4950c78e630e9b38f8)
---
.../org/apache/bookkeeper/bookie/GarbageCollectorThread.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 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 73b4474adb..919853d5d2 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
@@ -763,10 +763,12 @@ public class GarbageCollectorThread extends SafeRunnable {
EntryLogMetadata entryLogMeta = entryLogger.getEntryLogMetadata(entryLogId, throttler);
removeIfLedgerNotExists(entryLogMeta);
if (entryLogMeta.isEmpty()) {
- 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().add(entryLogMeta.getTotalSize());
} else {
entryLogMetaMap.put(entryLogId, entryLogMeta);
}