You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2020/04/08 18:57:43 UTC

[hbase] branch branch-1.4 updated: HBASE-24099 Use a fair ReentrantReadWriteLock for the region close lock (#1407)

This is an automated email from the ASF dual-hosted git repository.

apurtell pushed a commit to branch branch-1.4
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-1.4 by this push:
     new ef3a476  HBASE-24099 Use a fair ReentrantReadWriteLock for the region close lock (#1407)
ef3a476 is described below

commit ef3a47671e8f06a19ef87423051669e02b697fdc
Author: Andrew Purtell <ap...@apache.org>
AuthorDate: Wed Apr 8 11:36:48 2020 -0700

    HBASE-24099 Use a fair ReentrantReadWriteLock for the region close lock (#1407)
    
    Signed-off-by: Michael Stack <st...@apache.org>
    Signed-off-by: Xu Cang <xu...@apache.org>
    Signed-off-by: Reid Chan <re...@apache.org>
    Signed-off-by: Bharath Vissapragada <bh...@apache.org>
    
    Conflicts:
    	hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
---
 .../main/java/org/apache/hadoop/hbase/regionserver/HRegion.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index e4736ad..773d61f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -658,8 +658,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
   private long blockingMemStoreSize;
   final long threadWakeFrequency;
   // Used to guard closes
-  final ReentrantReadWriteLock lock =
-    new ReentrantReadWriteLock();
+  final ReentrantReadWriteLock lock;
 
   // Stop updates lock
   private final ReentrantReadWriteLock updatesLock =
@@ -749,6 +748,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
       .add(confParam)
       .addStringMap(htd.getConfiguration())
       .addWritableMap(htd.getValues());
+    this.lock = new ReentrantReadWriteLock(conf.getBoolean(FAIR_REENTRANT_CLOSE_LOCK,
+        DEFAULT_FAIR_REENTRANT_CLOSE_LOCK));
     this.flushCheckInterval = conf.getInt(MEMSTORE_PERIODIC_FLUSH_INTERVAL,
         DEFAULT_CACHE_FLUSH_INTERVAL);
     this.flushPerChanges = conf.getLong(MEMSTORE_FLUSH_PER_CHANGES, DEFAULT_FLUSH_PER_CHANGES);
@@ -1442,6 +1443,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
 
   private final Object closeLock = new Object();
 
+  /** Conf key for fair locking policy */
+  public static final String FAIR_REENTRANT_CLOSE_LOCK =
+      "hbase.regionserver.fair.region.close.lock";
+  public static final boolean DEFAULT_FAIR_REENTRANT_CLOSE_LOCK = true;
   /** Conf key for the periodic flush interval */
   public static final String MEMSTORE_PERIODIC_FLUSH_INTERVAL =
       "hbase.regionserver.optionalcacheflushinterval";