You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "duongkame (via GitHub)" <gi...@apache.org> on 2023/09/05 16:19:25 UTC

[GitHub] [ozone] duongkame commented on a diff in pull request #4885: HDDS-8765. OzoneManagerLock to use striped locks to improve performance.

duongkame commented on code in PR #4885:
URL: https://github.com/apache/ozone/pull/4885#discussion_r1316133836


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/lock/OzoneManagerLock.java:
##########
@@ -95,34 +98,36 @@ public class OzoneManagerLock implements IOzoneManagerLock {
    * @param conf Configuration object
    */
   public OzoneManagerLock(ConfigurationSource conf) {
-    boolean fair = conf.getBoolean(OZONE_MANAGER_FAIR_LOCK,
-        OZONE_MANAGER_FAIR_LOCK_DEFAULT);
-    manager = new LockManager<>(conf, fair);
     omLockMetrics = OMLockMetrics.create();
+
+    // TODO: for now, guava Striped doesn't allow create a striped
+    //  ReadWriteLock with fair-lock yet.
+    //  https://github.com/google/guava/issues/2514.
+    //  We may have to consider implement our own striped locks.
+    //boolean fair = conf.getBoolean(OZONE_MANAGER_FAIR_LOCK,
+    //    OZONE_MANAGER_FAIR_LOCK_DEFAULT);
+
+    Map<Resource, Striped<ReadWriteLock>> stripedLockMap =
+        new EnumMap<>(Resource.class);
+    for (Resource r : Resource.values()) {
+      stripedLockMap.put(r, createStripeLock(r, conf));

Review Comment:
   Yup, we can mimic a simpler version in our own code base.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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