HBASE-24099 Use a fair ReentrantReadWriteLock for the region close lock (#1407)
Signed-off-by: Michael Stack <stack@apache.org> Signed-off-by: Xu Cang <xucang@apache.org> Signed-off-by: Reid Chan <reidchan@apache.org> Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
This commit is contained in:
parent
5db62b422c
commit
3f511b0e93
|
@ -675,7 +675,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
private long flushPerChanges;
|
private long flushPerChanges;
|
||||||
private long blockingMemStoreSize;
|
private long blockingMemStoreSize;
|
||||||
// Used to guard closes
|
// Used to guard closes
|
||||||
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
final ReentrantReadWriteLock lock;
|
||||||
|
|
||||||
// Stop updates lock
|
// Stop updates lock
|
||||||
private final ReentrantReadWriteLock updatesLock = new ReentrantReadWriteLock();
|
private final ReentrantReadWriteLock updatesLock = new ReentrantReadWriteLock();
|
||||||
|
@ -766,6 +766,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
this.conf = new CompoundConfiguration()
|
this.conf = new CompoundConfiguration()
|
||||||
.add(confParam)
|
.add(confParam)
|
||||||
.addBytesMap(htd.getValues());
|
.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,
|
this.flushCheckInterval = conf.getInt(MEMSTORE_PERIODIC_FLUSH_INTERVAL,
|
||||||
DEFAULT_CACHE_FLUSH_INTERVAL);
|
DEFAULT_CACHE_FLUSH_INTERVAL);
|
||||||
this.flushPerChanges = conf.getLong(MEMSTORE_FLUSH_PER_CHANGES, DEFAULT_FLUSH_PER_CHANGES);
|
this.flushPerChanges = conf.getLong(MEMSTORE_FLUSH_PER_CHANGES, DEFAULT_FLUSH_PER_CHANGES);
|
||||||
|
@ -1505,6 +1507,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
|
|
||||||
private final Object closeLock = new Object();
|
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 */
|
/** Conf key for the periodic flush interval */
|
||||||
public static final String MEMSTORE_PERIODIC_FLUSH_INTERVAL =
|
public static final String MEMSTORE_PERIODIC_FLUSH_INTERVAL =
|
||||||
"hbase.regionserver.optionalcacheflushinterval";
|
"hbase.regionserver.optionalcacheflushinterval";
|
||||||
|
|
Loading…
Reference in New Issue