Skip to content
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

HDDS-10590. [Snapshot] Synchronized snapshot purge, set snapshot property and SstFilteringService #6456

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

hemantk-12
Copy link
Contributor

What changes were proposed in this pull request?

SstFilteringService marks the sstFilter flag for a snapshot and updates the RocksDB, code. It may cause snapshot chain corruption (probably not after the fix: #6443) or data inconsistency due to race condition because SstFilteringService updates snapshot info in parallel to SnapshotPurge and SnapshotProperty which also update snapshot info. Even tho SstFilteringService takes a lock before updating snapshotInfo, SnapshotPurge, and SnapshotProperty APIs don't take a lock and rely on OMStateMachine because OMStateMachine is going to process each request sequentially.
In general, each update to snapshotInfoTable should go through API but that is not possible for SstFilteringService because SstFilteringService runs on each OM independently.

This change introduces locks to achieve synchronization among snapshot purge, set snapshot property, and SstFilteringService.

What is the link to the Apache JIRA

HDDS-10590

How was this patch tested?

Existing unit tests.

@hemantk-12 hemantk-12 added the snapshot https://issues.apache.org/jira/browse/HDDS-6517 label Mar 28, 2024
@hemantk-12 hemantk-12 changed the title HDDS-10590. [Snapshot] Introduced synchronization among snapshot purge, set snapshot property and SstFilteringService HDDS-10590. [Snapshot] Synchronized snapshot purge, set snapshot property and SstFilteringService Apr 1, 2024
@hemantk-12 hemantk-12 requested review from smengcl and swamirishi April 2, 2024 20:39
Copy link
Contributor

@swamirishi swamirishi left a comment

Choose a reason for hiding this comment

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

Thanks for the patch @hemantk-12 , the changes overall look good. I had some nitpicky minor comments.

// snapshotTableKey is nothing but /volumeName/bucketName/snapshotName.
// Once all the locks are acquired, it performs the three steps mentioned above and
// release all the locks after that.
Set<String> lockSet = new HashSet<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we know there are going to be only 2 elements in the set. Should we set the initial capacity to 2 and load factor as 1?

Suggested change
Set<String> lockSet = new HashSet<>();
Set<String> lockSet = new HashSet<>(2, 1.0);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can change it to 4 rather than unbounded. We can acquire up to 4 locks (one for the snapshot to purge, one for the next active snapshot to update the deep clean flag, one for the path previous snapshot, and the last one for the global previous).

Copy link
Contributor

@swamirishi swamirishi left a comment

Choose a reason for hiding this comment

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

Overall the patch looks good just a minor nitpicky comment here. Otherwise things look good to me.

Copy link
Contributor

@swamirishi swamirishi left a comment

Choose a reason for hiding this comment

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

LGTM

@hemantk-12 hemantk-12 merged commit 7da5ecb into apache:master Apr 3, 2024
39 checks passed
@hemantk-12
Copy link
Contributor Author

Thanks @swamirishi for the review.

xichen01 pushed a commit to xichen01/ozone that referenced this pull request Apr 17, 2024
…erty and SstFilteringService (apache#6456)

(cherry picked from commit 7da5ecb)
xichen01 pushed a commit to xichen01/ozone that referenced this pull request Apr 18, 2024
…erty and SstFilteringService (apache#6456)

(cherry picked from commit 7da5ecb)
xichen01 pushed a commit to xichen01/ozone that referenced this pull request Apr 23, 2024
…erty and SstFilteringService (apache#6456)

(cherry picked from commit 7da5ecb)
jojochuang pushed a commit to jojochuang/ozone that referenced this pull request May 29, 2024
…erty and SstFilteringService (apache#6456)

(cherry picked from commit 7da5ecb)
swamirishi pushed a commit to swamirishi/ozone that referenced this pull request Jun 10, 2024
…napshot property and SstFilteringService (apache#6456)

Change-Id: I867aa900c4e76d28abacc2406f6e440769f0b2ce
@hemantk-12 hemantk-12 deleted the HDDS-10590 branch October 28, 2024 18:40
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.

2 participants