-
Notifications
You must be signed in to change notification settings - Fork 507
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-8067. [Snapshot] Revisit locks on deletedTable and deletedDirTable #4701
Conversation
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
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
deletedTable
anddeletedDirectoryTable
would need to be synchronized withKeyDeletingTask
andDirDeletingTask
to avoid out-of-order access (read/write) messing up either table.Here are the code logics that justify the locks:
createOmSnapshotCheckpoint
flow, called fromOMSnapshotCreateResponse#addToDBBatch
getTableLock(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#call
flowgetTableLock(deletedTable)
write lockgetPendingDeletionKeys()
: (currently) retrieves a number of keys from active DB'sdeletedTable
processKeyDeletes()
: delete key blocks with SCM clientdeleteKeyBlocks()
, submitsPurgeKeysRequest
Ratis request which then removes successfully reclaimed keys from activedeletedTable
getTableLock(deletedTable)
write lockDirDeletingTask#call
flowgetTableLock(deletedDirectoryTable)
write lockdeletedDirectoryTable
, prepare a list ofPurgePathRequest
s, 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 limitpathLimitPerTask
isn't reached. Q: Can we refactor the same dir expansion logic? One, Two, Three @aswinshakilPurgePathRequest
s 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?