bharatviswa504 commented on a change in pull request #949: HDDS-1672. Improve locking in OzoneManager. URL: https://github.com/apache/hadoop/pull/949#discussion_r295951701
########## File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerLock.java ########## @@ -154,79 +178,137 @@ public void releaseVolumeLock(String volume) { } /** - * Acquires S3 Bucket lock on the given resource. + * Acquires bucket lock on the given resource. * * <p>If the lock is not available then the current thread becomes - * disabled for thread scheduling purposes and lies dormant until the lock has - * been acquired. + * disabled for thread scheduling purposes and lies dormant until the + * lock has been acquired. * - * @param s3BucketName S3Bucket Name on which the lock has to be acquired + * @param bucket Bucket on which the lock has to be acquired */ - public void acquireS3Lock(String s3BucketName) { - // Calling thread should not hold any bucket lock. - // You can take an Volume while holding S3 bucket lock, since - // semantically an S3 bucket maps to the ozone volume. So we check here - // only if ozone bucket lock is taken. - if (hasAnyBucketLock()) { + public void acquireBucketLock(String volume, String bucket) { + if (hasAnyUserLock()) { throw new RuntimeException( "Thread '" + Thread.currentThread().getName() + - "' cannot acquire S3 bucket lock while holding Ozone bucket " + - "lock(s)."); + "' cannot acquire bucket lock while holding User lock."); } - manager.lock(OM_S3_PREFIX + s3BucketName); - myLocks.get().get(S3_BUCKET_LOCK).incrementAndGet(); + manager.lock(OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket); Review comment: Yes, we prefix volumeName with /(OM_KEY_PREFIX) and bucketName with /(OM_KEY_PREFIX) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org