This is an automated email from the ASF dual-hosted git repository.
apurtell pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.2 by this push:
new 66b98f0 HBASE-24099 Use a fair ReentrantReadWriteLock for the region
close lock (#1407)
66b98f0 is described below
commit 66b98f03310024aa5e67882cdcf69041d7caef29
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 bd6d311..2259fda 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
@@ -671,7 +671,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();
@@ -762,6 +762,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);
@@ -1498,6 +1500,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";