You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2019/06/27 20:31:58 UTC

[GitHub] [hadoop] arp7 commented on a change in pull request #1016: HDDS-1672. Improve locking in OzoneManager.

arp7 commented on a change in pull request #1016: HDDS-1672. Improve locking in OzoneManager.
URL: https://github.com/apache/hadoop/pull/1016#discussion_r298357461
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/BucketManagerImpl.java
 ##########
 @@ -114,9 +115,11 @@ public void createBucket(OmBucketInfo bucketInfo) throws IOException {
     Preconditions.checkNotNull(bucketInfo);
     String volumeName = bucketInfo.getVolumeName();
     String bucketName = bucketInfo.getBucketName();
-    metadataManager.getLock().acquireVolumeLock(volumeName);
-    metadataManager.getLock().acquireBucketLock(volumeName, bucketName);
+    boolean acquiredBucketLock = false;
+    metadataManager.getLock().acquireLock(VOLUME_LOCK, volumeName);
 
 Review comment:
   We have to assume that it can fail for two reasons:
   
   1. Because of the following check:
   ```
     public void acquireVolumeLock(String volume) {
       // 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()) {
         throw new RuntimeException(
             "Thread '" + Thread.currentThread().getName() +
                 "' cannot acquire volume lock while holding bucket lock(s).");
       }
   ```
   1. The wrapped call to `lockPool.borrowObject()` in `LockManager#lock` declares that it can throw `Exception`. So that covers pretty much any exception under the earth.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org