sumitagrawl commented on code in PR #7583: URL: https://github.com/apache/ozone/pull/7583#discussion_r2052297258
########## hadoop-hdds/docs/content/design/leader-execution/obs-locking.md: ########## @@ -0,0 +1,97 @@ +--- +title: Ozone Granular locking for OBS bucket +summary: Granular locking for OBS bucket +date: 2025-01-06 +jira: HDDS-11898 +status: draft +author: Sumit Agrawal +--- +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. See accompanying LICENSE file. +--> + +# OBS locking + +OBS case just involves volume, bucket and key. So this is more simplified in terms of locking. + +There will be: +1. Volume Strip Lock: locking for volume +2. Bucket Strip Lock: locking for bucket +3. Key Strip Lock: Locking for key + +**Note**: Multiple keys locking (like delete multiple keys or rename operation), lock needs to be taken in order, i.e. using StrippedLocking order to avoid deadlock. + +Stripped locking ordering: +- Strip lock is obtained over a hash bucket. +- All keys needs to be ordered with hash bucket +- And then need take lock in sequence order + +## OBS operation +Bucket read lock will be there default. This is to ensure: +- key operation uses updated bucket acl, quota and other properties +- key does not becomes dandling when parallel bucket is deleted + +Note: Volume lock is not required as key depends on bucket only to retrieve information and bucket as parent. Review Comment: Currently there is no volume rename operation. Other volume update operation as no relation to key operation, like quota, owner. These changed parameter will be taken by bucket only on creation as design for current implementation also. So there is no impact. But in future, it needs volume to be locked, we can have it in builder pattern to include. But currently, there is no need, and in existing Ozone implementation also, its only bucket level lock. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
