-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ReclaimedSpaceViaDeletes stats incorrect problem. #3906
Fix ReclaimedSpaceViaDeletes stats incorrect problem. #3906
Conversation
rerun failure checks |
// 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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to update the stats because the entryLogMeta is empty and the entryLogMeta.getTotalSize()
will be 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogMetadata.java
Lines 94 to 102 in ceba605
public void removeLedgerIf(LongPredicate predicate) { | |
ledgersMap.removeIf((ledgerId, size) -> { | |
boolean shouldRemove = predicate.test(ledgerId); | |
if (shouldRemove) { | |
remainingSize -= size; | |
} | |
return shouldRemove; | |
}); | |
} |
it only reduces the remainingSize, the totalSize won't be reduce to 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, it's my mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Catch!
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 cad1436)
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 cad1436)
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 cad1436)
Descriptions of the changes in this PR:
bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
Lines 487 to 517 in a6387d1
At line 501, increases getReclaimedSpaceViaDeletes stats.
bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
Lines 734 to 767 in a6387d1
But at line 755, it didn't increases getReclaimedSpaceViaDeletes stats.