Skip to content

HDDS-15201. Record lastDefragTime when snapshot defrag is successfully run#10210

Open
smengcl wants to merge 2 commits intoapache:masterfrom
smengcl:HDDS-15201-lastDefragTime
Open

HDDS-15201. Record lastDefragTime when snapshot defrag is successfully run#10210
smengcl wants to merge 2 commits intoapache:masterfrom
smengcl:HDDS-15201-lastDefragTime

Conversation

@smengcl
Copy link
Copy Markdown
Contributor

@smengcl smengcl commented May 7, 2026

What changes were proposed in this pull request?

Right now we have lastDefragTime field in each snapshot yaml but not used. Make it actually useful by informing users/debuggers of last successful defrag time of that snapshot DB.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15201

How was this patch tested?

  • Added unit test

@smengcl smengcl added the snapshot https://issues.apache.org/jira/browse/HDDS-6517 label May 7, 2026
Copy link
Copy Markdown
Contributor

@sadanand48 sadanand48 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@smengcl smengcl marked this pull request as ready for review May 8, 2026 18:16
Copilot AI review requested due to automatic review settings May 8, 2026 18:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the lastDefragTime field in OM snapshot local YAML metadata meaningful by recording the time (epoch millis) of the last successful snapshot-defrag version commit, and updates parsing/tests/docs accordingly.

Changes:

  • Record lastDefragTime when a new snapshot version is added during snapshot defrag.
  • Make YAML loading default lastDefragTime to 0 when absent, and add unit coverage for legacy YAML.
  • Update snapshot defragmentation documentation to clarify lastDefragTime semantics.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOmSnapshotLocalDataYaml.java Makes tests deterministic for lastDefragTime and adds legacy YAML coverage (missing field defaults to 0).
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOmSnapshotLocalDataManager.java Adds assertion that lastDefragTime is set during snapshot version addition flow.
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotLocalDataManager.java Records lastDefragTime when adding a snapshot version (defrag output).
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotLocalDataYaml.java Defaults missing lastDefragTime to 0 and simplifies numeric handling.
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotLocalData.java Changes setter signature to primitive long for lastDefragTime.
hadoop-hdds/docs/content/feature/SnapshotDefragmentation.md Updates docs to describe lastDefragTime as the wall-clock time of committing a new defragged version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

snapshot https://issues.apache.org/jira/browse/HDDS-6517

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants