-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-8067. [Snapshot] Revisit locks on deletedTable and deletedDirTable #4701
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
Conversation
aswinshakil
left a comment
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 path @smengcl. I have one comment inline. Overall LGTM! 👍
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java
Outdated
Show resolved
Hide resolved
aswinshakil
left a comment
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 for the fix @smengcl
|
Thanks @aswinshakil for the review and suggestion. |
What changes were proposed in this pull request?
During snapshot creation, access to
deletedTableanddeletedDirectoryTablewould need to be synchronized withKeyDeletingTaskandDirDeletingTaskto avoid out-of-order access (read/write) messing up either table.Here are the code logics that justify the locks:
createOmSnapshotCheckpointflow, called fromOMSnapshotCreateResponse#addToDBBatchgetTableLock(deletedDirectoryTable)write lock, then acquiregetTableLock(deletedTable)write lockdeletedTable, remove all keys with prefix matching snapshot scope path (bucket)deletedDirectoryTable, remove all keys with prefix matching snapshot scope path (bucket)getTableLock(deletedTable)write lock, then releasegetTableLock(deletedDirectoryTable)write lockKeyDeletingTask#callflowgetTableLock(deletedTable)write lockgetPendingDeletionKeys(): (currently) retrieves a number of keys from active DB'sdeletedTableprocessKeyDeletes(): delete key blocks with SCM clientdeleteKeyBlocks(), submitsPurgeKeysRequestRatis request which then removes successfully reclaimed keys from activedeletedTablegetTableLock(deletedTable)write lockDirDeletingTask#callflowgetTableLock(deletedDirectoryTable)write lockdeletedDirectoryTable, prepare a list ofPurgePathRequests, each contains immediate children (keys and dirs) under this directory.AcquireNot needed. See HDDS-8067. [Snapshot] Revisit locks on deletedTable and deletedDirTable #4701 (comment)getTableLock(deletedTable)write lockoptimizeDirDeletesAndSubmitRequest(): recurse further into sub-dirs if batch limitpathLimitPerTaskisn't reached. Q: Can we refactor the same dir expansion logic? One, Two, Three @aswinshakilPurgePathRequests to RatisReleasegetTableLock(deletedTable)write lockgetTableLock(deletedDirectoryTable)write lockWhat is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-8067
How was this patch tested?