@InterfaceAudience.Private class MemStoreFlusher extends Object implements FlushRequester
FlushRequester
Modifier and Type | Class and Description |
---|---|
private class |
MemStoreFlusher.FlushHandler |
(package private) static interface |
MemStoreFlusher.FlushQueueEntry |
(package private) static class |
MemStoreFlusher.FlushRegionEntry
Datastructure used in the flush queue.
|
(package private) static class |
MemStoreFlusher.WakeupFlushThread
Token to insert into the flush queue that ensures that the flusher does not sleep
|
Modifier and Type | Field and Description |
---|---|
private long |
blockingWaitTime |
private Object |
blockSignal |
private org.apache.hadoop.conf.Configuration |
conf |
private MemStoreFlusher.FlushHandler[] |
flushHandlers |
private BlockingQueue<MemStoreFlusher.FlushQueueEntry> |
flushQueue |
private List<FlushRequestListener> |
flushRequestListeners |
protected long |
globalMemStoreLimit |
protected long |
globalMemStoreLimitLowMark |
protected float |
globalMemStoreLimitLowMarkPercent |
private ReentrantReadWriteLock |
lock |
private static org.apache.commons.logging.Log |
LOG |
private Map<Region,MemStoreFlusher.FlushRegionEntry> |
regionsInQueue |
private HRegionServer |
server |
private long |
threadWakeFrequency |
private Counter |
updatesBlockedMsHighWater |
private AtomicBoolean |
wakeupPending |
Constructor and Description |
---|
MemStoreFlusher(org.apache.hadoop.conf.Configuration conf,
HRegionServer server) |
Modifier and Type | Method and Description |
---|---|
String |
dumpQueue() |
private boolean |
flushOneForGlobalPressure()
The memstore across all regions has exceeded the low water mark.
|
private boolean |
flushRegion(MemStoreFlusher.FlushRegionEntry fqe)
A flushRegion that checks store file count.
|
private boolean |
flushRegion(Region region,
boolean emergencyFlush,
boolean forceFlushAllStores)
Flush a region.
|
private Region |
getBiggestMemstoreOfRegionReplica(SortedMap<Long,Region> regionsBySize,
Set<Region> excludedRegions) |
private Region |
getBiggestMemstoreRegion(SortedMap<Long,Region> regionsBySize,
Set<Region> excludedRegions,
boolean checkStoreFileCount) |
int |
getFlushQueueSize() |
long |
getMemoryLimit() |
Counter |
getUpdatesBlockedMsHighWater() |
(package private) void |
interruptIfNecessary()
Only interrupt once it's done with a run through the work loop.
|
private boolean |
isAboveHighWaterMark()
Return true if global memory usage is above the high watermark
|
private boolean |
isAboveLowWaterMark()
Return true if we're above the high watermark
|
(package private) boolean |
isAlive() |
private boolean |
isTooManyStoreFiles(Region region) |
(package private) void |
join() |
private void |
notifyFlushRequest(Region region,
boolean emergencyFlush) |
void |
reclaimMemStoreMemory()
Check if the regionserver's memstore memory usage is greater than the
limit.
|
private boolean |
refreshStoreFilesAndReclaimMemory(Region region) |
void |
registerFlushRequestListener(FlushRequestListener listener)
Register a MemstoreFlushListener
|
void |
requestDelayedFlush(Region r,
long delay,
boolean forceFlushAllStores)
Tell the listener the cache needs to be flushed after a delay
|
void |
requestFlush(Region r,
boolean forceFlushAllStores)
Tell the listener the cache needs to be flushed.
|
void |
setGlobalMemstoreLimit(long globalMemStoreSize)
Sets the global memstore limit to a new size.
|
(package private) void |
start(Thread.UncaughtExceptionHandler eh) |
String |
toString() |
boolean |
unregisterFlushRequestListener(FlushRequestListener listener)
Unregister the listener from MemstoreFlushListeners
|
private void |
wakeupFlushThread() |
private void |
wakeUpIfBlocking() |
private static final org.apache.commons.logging.Log LOG
private org.apache.hadoop.conf.Configuration conf
private final BlockingQueue<MemStoreFlusher.FlushQueueEntry> flushQueue
private final Map<Region,MemStoreFlusher.FlushRegionEntry> regionsInQueue
private AtomicBoolean wakeupPending
private final long threadWakeFrequency
private final HRegionServer server
private final ReentrantReadWriteLock lock
private final Object blockSignal
protected long globalMemStoreLimit
protected float globalMemStoreLimitLowMarkPercent
protected long globalMemStoreLimitLowMark
private long blockingWaitTime
private final Counter updatesBlockedMsHighWater
private final MemStoreFlusher.FlushHandler[] flushHandlers
private List<FlushRequestListener> flushRequestListeners
public MemStoreFlusher(org.apache.hadoop.conf.Configuration conf, HRegionServer server)
conf
- server
- public Counter getUpdatesBlockedMsHighWater()
private boolean flushOneForGlobalPressure()
private void wakeupFlushThread()
private Region getBiggestMemstoreRegion(SortedMap<Long,Region> regionsBySize, Set<Region> excludedRegions, boolean checkStoreFileCount)
private Region getBiggestMemstoreOfRegionReplica(SortedMap<Long,Region> regionsBySize, Set<Region> excludedRegions)
private boolean refreshStoreFilesAndReclaimMemory(Region region)
private boolean isAboveHighWaterMark()
private boolean isAboveLowWaterMark()
public void requestFlush(Region r, boolean forceFlushAllStores)
FlushRequester
requestFlush
in interface FlushRequester
r
- the Region requesting the cache flushforceFlushAllStores
- whether we want to flush all stores. e.g., when request from log
rolling.public void requestDelayedFlush(Region r, long delay, boolean forceFlushAllStores)
FlushRequester
requestDelayedFlush
in interface FlushRequester
r
- the Region requesting the cache flushdelay
- after how much time should the flush happenforceFlushAllStores
- whether we want to flush all stores. e.g., when request from log
rolling.public int getFlushQueueSize()
void interruptIfNecessary()
void start(Thread.UncaughtExceptionHandler eh)
boolean isAlive()
void join()
private boolean flushRegion(MemStoreFlusher.FlushRegionEntry fqe)
fqe
- private boolean flushRegion(Region region, boolean emergencyFlush, boolean forceFlushAllStores)
region
- Region to flush.emergencyFlush
- Set if we are being force flushed. If true the region
needs to be removed from the flush queue. If false, when we were called
from the main flusher run loop and we got the entry to flush by calling
poll on the flush queue (which removed it).forceFlushAllStores
- whether we want to flush all store.private void notifyFlushRequest(Region region, boolean emergencyFlush)
private void wakeUpIfBlocking()
private boolean isTooManyStoreFiles(Region region)
public void reclaimMemStoreMemory()
public String dumpQueue()
public void registerFlushRequestListener(FlushRequestListener listener)
registerFlushRequestListener
in interface FlushRequester
listener
- public boolean unregisterFlushRequestListener(FlushRequestListener listener)
unregisterFlushRequestListener
in interface FlushRequester
listener
- public void setGlobalMemstoreLimit(long globalMemStoreSize)
setGlobalMemstoreLimit
in interface FlushRequester
globalMemStoreSize
- public long getMemoryLimit()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.