hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (HDDS-1672) Improve locking in OzoneManager
Date Thu, 20 Jun 2019 19:03:00 GMT

     [ https://issues.apache.org/jira/browse/HDDS-1672?focusedWorklogId=264025&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-264025
]

ASF GitHub Bot logged work on HDDS-1672:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/Jun/19 19:02
            Start Date: 20/Jun/19 19:02
    Worklog Time Spent: 10m 
      Work Description: bharatviswa504 commented on pull request #949: HDDS-1672. Improve
locking in OzoneManager.
URL: https://github.com/apache/hadoop/pull/949#discussion_r295952709
 
 

 ##########
 File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerLock.java
 ##########
 @@ -258,12 +348,61 @@ public void acquirePrefixLock(String prefixPath) {
     myLocks.get().get(PREFIX_LOCK).incrementAndGet();
   }
 
-  private boolean hasAnyPrefixLock() {
-    return myLocks.get().get(PREFIX_LOCK).get() != 0;
-  }
-
+  /**
+   * Releases the prefix lock on given resource.
+   */
   public void releasePrefixLock(String prefixPath) {
     manager.unlock(prefixPath);
     myLocks.get().get(PREFIX_LOCK).decrementAndGet();
   }
+
+  /**
+   * Returns true if the current thread holds any volume lock.
+   * @return true if current thread holds volume lock, else false
+   */
+  private boolean hasAnyVolumeLock() {
+    return myLocks.get().get(VOLUME_LOCK).get() != 0;
+  }
+
+  /**
+   * Returns true if the current thread holds any bucket lock.
+   * @return true if current thread holds bucket lock, else false
+   */
+  private boolean hasAnyBucketLock() {
+    return myLocks.get().get(BUCKET_LOCK).get() != 0;
+  }
+
+  /**
+   * Returns true if the current thread holds any s3 bucket lock.
+   * @return true if current thread holds s3 bucket lock, else false
+   */
+  private boolean hasAnyS3BucketLock() {
+    return myLocks.get().get(S3_BUCKET_LOCK).get() != 0;
+  }
+
+  /**
+   * Returns true if the current thread holds any user lock.
+   * @return true if current thread holds user lock, else false
+   */
+  private boolean hasAnyUserLock() {
+    return myLocks.get().get(USER_LOCK).get() != 0;
 
 Review comment:
   Yes, added a call for hasAnyUserLock() in acquireUserLock() so that if some one is trying
to acquire multiple user locks, he will immediately fail with RunTimeException. As said in
code comments in acquireUserLock() this is a protection logic, in avoiding users do that.
 
----------------------------------------------------------------
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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 264025)
    Time Spent: 6h 10m  (was: 6h)

> Improve locking in OzoneManager
> -------------------------------
>
>                 Key: HDDS-1672
>                 URL: https://issues.apache.org/jira/browse/HDDS-1672
>             Project: Hadoop Distributed Data Store
>          Issue Type: Improvement
>          Components: Ozone Manager
>    Affects Versions: 0.4.0
>            Reporter: Bharat Viswanadham
>            Assignee: Bharat Viswanadham
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: Ozone Locks in OM.pdf
>
>          Time Spent: 6h 10m
>  Remaining Estimate: 0h
>
> In this Jira, we shall follow the new lock ordering. In this way, in volume requests
we can solve the issue of acquire/release/reacquire problem. And few bugs in the current
implementation of S3Bucket/Volume operations.
>  
> Currently after acquiring volume lock, we cannot acquire user lock. 
> This is causing an issue in Volume request implementation, acquire/release/reacquire
volume lock.
>  
> Case of Delete Volume Request: 
>  # Acquire volume lock.
>  # Get Volume Info from DB
>  # Release Volume lock. (We are releasing the lock, because while acquiring volume lock,
we cannot acquire user lock0
>  # Get owner from volume Info read from DB
>  # Acquire owner lock
>  # Acquire volume lock
>  # Do delete logic
>  # release volume lock
>  # release user lock
>  
> We can avoid this acquire/release/reacquire lock issue by making volume lock as low weight. 
>  
> In this way, the above deleteVolume request will change as below
>  # Acquire volume lock
>  # Get Volume Info from DB
>  # Get owner from volume Info read from DB
>  # Acquire owner lock
>  # Do delete logic
>  # release owner lock
>  # release volume lock. 
> Same issue is seen with SetOwner for Volume request also.
> During HDDS-1620 [~arp] brought up this issue. 
> I am proposing the above solution to solve this issue. Any other idea/suggestions are
welcome.
> This also resolves a bug in setOwner for Volume request.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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


Mime
View raw message