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

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


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

commit ac6060c3f937013272d665dcdeff34f3c53b8cec
Author: Andrew Purtell <[email protected]>
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 <[email protected]>
    Signed-off-by: Xu Cang <[email protected]>
    Signed-off-by: Reid Chan <[email protected]>
    Signed-off-by: Bharath Vissapragada <[email protected]>
---
 .../main/java/org/apache/hadoop/hbase/regionserver/HRegion.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 3a12f87..35718cc 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
@@ -681,7 +681,7 @@ public class HRegion implements HeapSize, 
PropagatingConfigurationObserver, Regi
   private long flushPerChanges;
   private long blockingMemStoreSize;
   // Used to guard closes
-  final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+  final ReentrantReadWriteLock lock;
 
   // Stop updates lock
   private final ReentrantReadWriteLock updatesLock = new 
ReentrantReadWriteLock();
@@ -772,6 +772,8 @@ public class HRegion implements HeapSize, 
PropagatingConfigurationObserver, Regi
     this.conf = new CompoundConfiguration()
       .add(confParam)
       .addBytesMap(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);
@@ -1521,6 +1523,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";

Reply via email to