Skip to content

Conversation

@swamirishi
Copy link
Contributor

@swamirishi swamirishi commented Oct 28, 2025

What changes were proposed in this pull request?

Snapshot Rocks DB directory path needs to be computed based on local version of snapshot. Currently snapshot rocksdb path is /db.snapshot/om.db-<snapshotId> however whenever a snapshot gets defragged the snapshot would be written to a new path and the version in the yaml file would be updated to atomically point the snapshot to the newly created rocksdb instance atomically.

Thus snapshot rocksdb path would become /db.snapshot/om.db-<snapshotId>-<version>

What is the link to the Apache JIRA

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

How was this patch tested?

Adding additional unit test for the getSnapshotPath function

Change-Id: Iba47aeb21663dfa407ab71339cef02c0d74b49f2
Change-Id: Ifd2feca1fddb144e4955db025f0b15a2ab1f3bfe
Change-Id: I34536ff06efb7d5a4942853f0fd83942ab398b5f
…otLocalDataManager

Change-Id: I34536ff06efb7d5a4942853f0fd83942ab398b5f
Change-Id: I32bcaf2a1fb290f1790c02872a0230cd65586636
Change-Id: I105a2e8178c0444d52de41b99801f4ceb6d57ffd

# Conflicts:
#	hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/util/Checksum.java
#	hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/util/ObjectSerializer.java
#	hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/util/YamlSerializer.java
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotLocalDataYaml.java
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotLocalDataManager.java
#	hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOmSnapshotLocalDataYaml.java
Change-Id: I985170e38fb8beeb784048e85a08a4c79e1aec97
Change-Id: I33e6e6e825bf23c323ad7ed593d800a11720fa4f
Change-Id: If30b2c766db82adde72145c8ecd3e590ef54cc2d
Change-Id: Id3f2c49050bc3476b9e0f5f51dacb6d9acc4c2f7
Change-Id: I432960725b4c6c55aa906b5780cc3027e41e10db
Change-Id: I3c5514e5bbd251a2b5297d8f074cfde5c71fa543
Change-Id: Ib5a9e6c91bdccba17820263c47eaf2c8400e930d
Change-Id: Ica36e0615c7bc6aa9b6a7f6fafafd0f830d4bafb
Change-Id: I26b66f266bb7677e4b1078f5fcd9f2ce3a651a70

# Conflicts:
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotLocalDataManager.java
Change-Id: I1d93dbc048a42cc55ff1f8ffa420e52f967527b8
Change-Id: I34202928a7a367dd0a1e57219317ff34de352b78
Change-Id: Iad6f26cb71ec921c51ee2d138745df1a2663533f
Change-Id: Ic5f7e249cfb9cb3973cbcd4abd36b22a6ff8f5aa
…calDataProvider

Change-Id: I3a004b4b435075a4348960aeed642e8da71e7e72
Change-Id: I06990bc9ab8fc7e1eb7bec255646a650bd8c35fe
Change-Id: I4c6c61c83aa9fadab8ecef854b99dcc0a89a2208
Change-Id: I0e476322372a302572f1fe79cbf2e874bfeac2ed
Change-Id: I3849387d064e093634e69cdaf870d27c1934cda5

# Conflicts:
#	hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/util/ObjectSerializer.java
#	hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/util/YamlSerializer.java
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotLocalData.java
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotLocalDataYaml.java
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotLocalDataManager.java
Change-Id: Ie5e5f3dab4324103e8855dd15619d7755f0422e6
Change-Id: I55bd5c3ef7fc32910a9111328638de2edffcd541
Change-Id: I880997d3eebdf378f14c203c61c2d63b2d17552e
Change-Id: I20812cdf61886e55b4ead6003566e1d72db77f4a
Change-Id: I02de81771c9102f1212bf1962e65095910ab8207
Change-Id: I8360183ef8ac68a95a05a6a2b00bb7ede5d57d12
Change-Id: I1bb9832e7e8c40deeccb9d0868eaf5772f39b7f9
Change-Id: I59bd793796f77e88f44e7333fbb01ffabd477f67
Change-Id: Iec8a011ac2b2dc369be5ec1d659be3a0f580890a

# Conflicts:
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SnapshotDefragService.java
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotLocalDataManager.java
#	hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOmSnapshotLocalDataManager.java
Change-Id: Idb8e173737fd496d2d36e2b9409e5b7e1f45e995
@smengcl
Copy link
Contributor

smengcl commented Nov 1, 2025

The PR description looks incomplete to me. Can you check?

@smengcl
Copy link
Contributor

smengcl commented Nov 1, 2025

In the SDS PR I actually was dealing with a similar problem. Tho I simply appended local defrag version to the DB checkpoitn dir name. A slight change in OmMetadataManagerImpl: https://github.com/apache/ozone/pull/9227/files

@swamirishi
Copy link
Contributor Author

In the SDS PR I actually was dealing with a similar problem. Tho I simply appended local defrag version to the DB checkpoitn dir name. A slight change in OmMetadataManagerImpl: https://github.com/apache/ozone/pull/9227/files

I wanted this to be a more structural fix thus made the change in the path computation path itself so that it automatically reflects everywhere

Change-Id: I39e1d4a1f504241a2ebbfb5b36c84e887512c8ed
@swamirishi
Copy link
Contributor Author

The PR description looks incomplete to me. Can you check?

Fixed the issue < character had to be escaped

@swamirishi swamirishi marked this pull request as ready for review November 1, 2025 03:59
Change-Id: I88f541c712d847515f6ef5b1d094cc5168936966
Change-Id: I71e2210c6398aa9b64f93137bb5655e1c41026e3
@swamirishi
Copy link
Contributor Author

@smengcl are you good with the changes can this be merged?

Change-Id: I5541c7f931bb0b60af238102b5afc8086be53a6c
@swamirishi swamirishi marked this pull request as draft November 1, 2025 11:33
Change-Id: I7077460d4b9d87d460244e3df51d51f078a83970
Change-Id: If9cd8e82083f90997d7ce052408b33648d9b2c2a
Copy link
Contributor

@jojochuang jojochuang left a comment

Choose a reason for hiding this comment

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

Looks good. How does it handle backward compatibility? (i.e. snapshots created before the snapshot defrag is implemented, and the checkpoint dir does not include version id)

@jojochuang jojochuang marked this pull request as ready for review November 2, 2025 09:16
@swamirishi
Copy link
Contributor Author

swamirishi commented Nov 2, 2025

Looks good. How does it handle backward compatibility? (i.e. snapshots created before the snapshot defrag is implemented, and the checkpoint dir does not include version id)

We would be handling upgrade flow by adding a new layout version. For the older snapshots we can always implicitly create the yaml files for the entries which don't have the yaml file if and only if the upgrade is not finalized. When the upgrade is finalized that is when we should have the yaml file already present and we should throw an exception if it is not there. For the deleted snapshot we need not track the sst file since it could be the case that the snapshot could have been purged.

Change-Id: I011b0b80bc646c94b422ab808935de4fbee2bf30

# Conflicts:
#	hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServletInodeBasedXfer.java
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServletInodeBasedXfer.java
Change-Id: Ia02449ab5237ddb6021fa3a62ed66290c1dff83d
@swamirishi
Copy link
Contributor Author

@jojochuang can we merge this issue we can handle the upgrade scenario under a different jira

@swamirishi swamirishi requested a review from jojochuang November 2, 2025 21:48
Copy link
Contributor

@jojochuang jojochuang left a comment

Choose a reason for hiding this comment

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

LGTM

@jojochuang jojochuang merged commit 5c35ebb into apache:master Nov 3, 2025
43 checks passed
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