-
Notifications
You must be signed in to change notification settings - Fork 509
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
Conversation
…y and SstFilteringService
There was a problem hiding this 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<>(); |
There was a problem hiding this comment.
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?
Set<String> lockSet = new HashSet<>(); | |
Set<String> lockSet = new HashSet<>(2, 1.0); |
There was a problem hiding this comment.
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).
...anager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotPurgeRequest.java
Outdated
Show resolved
Hide resolved
...anager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotPurgeRequest.java
Outdated
Show resolved
Hide resolved
...anager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotPurgeRequest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
...anager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotPurgeRequest.java
Outdated
Show resolved
Hide resolved
...anager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotPurgeRequest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 review. |
…erty and SstFilteringService (apache#6456) (cherry picked from commit 7da5ecb)
…erty and SstFilteringService (apache#6456) (cherry picked from commit 7da5ecb)
…erty and SstFilteringService (apache#6456) (cherry picked from commit 7da5ecb)
…erty and SstFilteringService (apache#6456) (cherry picked from commit 7da5ecb)
…napshot property and SstFilteringService (apache#6456) Change-Id: I867aa900c4e76d28abacc2406f6e440769f0b2ce
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.