Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused change matches the intended metric behavior, with regression coverage for success, duplicate purges, and failure.
0 open findings
What changed in this PR
Keeps OM’s NumSnapshotDeleted metric accurate by decrementing it when deleted snapshots are successfully purged.
Changes:
- Adds a bulk decrement method to
OMMetrics. - Counts deleted snapshots purged and updates the metric after request success.
- Tests mixed snapshot states, duplicate purges, and partial failure.
| File | Description |
|---|---|
| hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/snapshot/TestOMSnapshotPurgeRequestAndResponse.java | Adds metric regression coverage. |
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotPurgeRequest.java | Decrements the metric after successful purges. |
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java | Adds the bulk decrement method. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed?
Follow-up to HDDS-16719.
NumSnapshotDeletedgoes up when a snapshot is deleted, but nothing brings it down whenSnapshotDeletingServicepurges that snapshot. On a long-running OM it keeps growing until a restart recountssnapshotInfoTable.This PR decrements it in
OMSnapshotPurgeRequestby the number ofSNAPSHOT_DELETEDsnapshots actually purged, once the request succeeds. Snapshots already gone from the table are skipped, and a failed request leaves the metric unchanged.JIRA
https://issues.apache.org/jira/browse/HDDS-16753
How was this patch tested?
https://github.com/chihsuan/ozone/actions/runs/38748302479
testValidateAndUpdateCachekeeps one active snapshot and checks only deleted ones are subtracted.testDuplicateSnapshotPurgechecks a repeated purge does not decrement twice.testNumSnapshotDeletedUnchangedOnPartialPurgeFailure, which fails if the decrement happens inside the loop.Generated-by: Claude Code (Claude Opus 5.5)