Skip to content

HDDS-13628. LocalSnapshotMetadata create should track snapshot from checkpoint instead of active object store#8982

Merged
swamirishi merged 18 commits intoapache:masterfrom
swamirishi:HDDS-13628
Sep 23, 2025
Merged

HDDS-13628. LocalSnapshotMetadata create should track snapshot from checkpoint instead of active object store#8982
swamirishi merged 18 commits intoapache:masterfrom
swamirishi:HDDS-13628

Conversation

@swamirishi
Copy link
Contributor

What changes were proposed in this pull request?

Currently Snapshot Create incorrectly tracks sst files from AOS db instead of the checkpoint creation. If there is a background compaction that got committed right after creation of checkpoint this could fetch wrong results.

What is the link to the Apache JIRA

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

How was this patch tested?

Existing unit tests

Change-Id: I822eb168408b65364bc9e009a5818d7f5dfd907f
Change-Id: I0462e1581ac928806ffc291aa6705c470d34fa71
…heckpoint instead of active object store

Change-Id: I9d74659323746afb78cba94e8f8c95d8028ecb50
@jojochuang jojochuang added the snapshot https://issues.apache.org/jira/browse/HDDS-6517 label Aug 29, 2025
Copy link
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 modifies the snapshot creation process to track SST files from the checkpoint database instead of the active object store (AOS) database. This prevents incorrect tracking when background compactions occur right after checkpoint creation.

  • Tracks SST files from snapshot checkpoint instead of active object store
  • Refactors data structures to use more structured metadata representation
  • Adds new SstFileInfo class to capture detailed SST file metadata

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
TestOmSnapshotManager.java Updates test to use new VersionMeta structure and checkpoint-based store
TestOmSnapshotLocalDataYaml.java Updates tests for new YAML structure with SstFileInfo objects
OmSnapshotManager.java Changes createNewOmSnapshotLocalDataFile to use snapshot store instead of AOS
OmSnapshotLocalDataYaml.java Adds support for new data structures and YAML serialization
OmSnapshotLocalData.java Replaces Map-based SST tracking with VersionMeta structure
SstFileInfo.java New class for SST file metadata
CompactionFileInfo.java Refactored to extend SstFileInfo
OzoneConsts.java Updates YAML field constants for new structure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


// Verify fields
assertEquals(42, snapshotData.getVersion());
assertEquals(44, snapshotData.getVersion());
Copy link

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

The test expects version 44 but the setup code sets version to 42. This causes a test assertion failure - the expected version should be 42 to match the setup.

Suggested change
assertEquals(44, snapshotData.getVersion());
assertEquals(42, snapshotData.getVersion());

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this would be 44 since version is going to be auto incremented every time a new version is added

throws IOException {
Path snapshotLocalDataPath = Paths.get(getSnapshotLocalPropertyYamlPath(omMetadataManager, snapshotInfo));
public static void createNewOmSnapshotLocalDataFile(RDBStore snapshotStore, SnapshotInfo snapshotInfo) throws IOException {
Path snapshotLocalDataPath = Paths.get(getSnapshotLocalPropertyYamlPath(snapshotStore.getDbLocation().toPath()));
Copy link

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

The method signature changed to accept snapshotStore.getDbLocation().toPath() but getSnapshotLocalPropertyYamlPath likely expects different parameters. This may cause a compilation error or runtime failure.

Suggested change
Path snapshotLocalDataPath = Paths.get(getSnapshotLocalPropertyYamlPath(snapshotStore.getDbLocation().toPath()));
Path snapshotLocalDataPath = getSnapshotLocalPropertyYamlPath(snapshotStore.getDbLocation().toPath());

Copilot uses AI. Check for mistakes.
Change-Id: I2bc385065589e2ea2ffde0c09ace3ab7d4efb5ce
Change-Id: I4c04ad1f9482b4a4cb26364ed1bcaa93061d62b3

# Conflicts:
#	pom.xml
Change-Id: I125db7402f1df9ff7dadc1251d07c0f1908f38c9

# Conflicts:
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java
#	hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOmSnapshotManager.java
Change-Id: Icf245ff856f13ffab73beefc84b743f0de69ef58
Change-Id: Ic61bf54ba6a37952b33ff7613f4ca88d88cad4a0
Change-Id: I220b088e09d90c7dd86af0f27a0bdfe8243a5ac0
Change-Id: If5ce88bfa3e2907b07975c405093da6c758f4e13
Change-Id: If02ecec5fd95896ebe90f418c137954cf084272d
@jojochuang
Copy link
Contributor

This PR requires #8981

Change-Id: Id4b3d6fb8b3138eef663cc35ba8690ae6c6cd5dc
Change-Id: Ia1995e6bc6a7ea6d00e15c9253734d90dc835e02
Change-Id: I45495c7330afe19b97aed8fde43b12d16015dbf1

# Conflicts:
#	hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java
#	hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOmSnapshotManager.java
if (!filename.startsWith("fabricated") &&
!filename.startsWith(OZONE_RATIS_SNAPSHOT_COMPLETE_FLAG_NAME)) {
!filename.startsWith(OZONE_RATIS_SNAPSHOT_COMPLETE_FLAG_NAME) &&
!(filename.equals("archive") && file.getParent().getFileName().toString().startsWith("om.db"))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

findbugs warning:

M D NP: Possible null pointer dereference in org.apache.hadoop.ozone.om.TestOMDbCheckpointServlet.getFiles(Path, int, Set) due to return value of called method  Dereferenced at TestOMDbCheckpointServlet.java:[line 759]

https://github.com/swamirishi/ozone/actions/runs/17618881306/job/50059192799

Copy link
Contributor

@smengcl smengcl left a comment

Choose a reason for hiding this comment

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

Thanks @swamirishi for the patch.

lgtm apart from the findbugs and doc change request by @SaketaChalamchala

@smengcl smengcl marked this pull request as ready for review September 18, 2025 08:52
Change-Id: I26d6de5576d5303ffd29255ba7c51d857d8ad15a
Change-Id: I050a3ea531014e9955e8856e1168836e817e43ea
Copy link
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

Change-Id: I5957fb5ba0c59e9edf88585f618d6bda12057c31
@swamirishi
Copy link
Contributor Author

swamirishi commented Sep 22, 2025

@sadanand48 @smengcl I had to fix the way I am opening the rocksdb because of the change in logic of the snapshot cache where we wait for the entire transaction to get flushed instead of just the mere check of snapshot directory exists. Can you check the changes made in the last commit once more

@swamirishi swamirishi marked this pull request as draft September 22, 2025 11:53
@swamirishi swamirishi marked this pull request as ready for review September 22, 2025 15:21
Change-Id: Ia6b01ee8078a4949adb2a9250431d3c87311c1c9
Copy link
Contributor

@smengcl smengcl left a comment

Choose a reason for hiding this comment

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

lgtm. Thanks @swamirishi for the patch.

@swamirishi swamirishi merged commit c6c4279 into apache:master Sep 23, 2025
42 checks passed
@swamirishi
Copy link
Contributor Author

Thank you @sadanand48 @smengcl and @SaketaChalamchala for reviewing the patch

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.

6 participants