@InterfaceAudience.Private class MasterRegionFlusherAndCompactor extends Object implements Closeable
RegionProcedureStore
, we will call the onUpdate()
method below, and in this
method, we will check the memstore size and if it is above the flush size, we will call
HRegion.flush(boolean)
to force flush all stores.
And for compaction, the logic is also very simple. After flush, we will check the store file
count, if it is above the compactMin, we will do a major compaction.Modifier and Type | Field and Description |
---|---|
private Abortable |
abortable |
private String |
archivedHFileSuffix |
private AtomicLong |
changesAfterLastFlush |
private boolean |
closed |
private ExecutorService |
compactExecutor |
private Lock |
compactLock |
private int |
compactMin |
private boolean |
compactRequest |
private org.apache.hadoop.conf.Configuration |
conf |
private Condition |
flushCond |
private long |
flushIntervalMs |
private Lock |
flushLock |
private long |
flushPerChanges |
private boolean |
flushRequest |
private long |
flushSize |
private Thread |
flushThread |
private org.apache.hadoop.fs.Path |
globalArchivePath |
private long |
lastFlushTime |
private static org.slf4j.Logger |
LOG |
private HRegion |
region |
Constructor and Description |
---|
MasterRegionFlusherAndCompactor(org.apache.hadoop.conf.Configuration conf,
Abortable abortable,
HRegion region,
long flushSize,
long flushPerChanges,
long flushIntervalMs,
int compactMin,
org.apache.hadoop.fs.Path globalArchivePath,
String archivedHFileSuffix) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
private void |
compact() |
private void |
flushLoop() |
private void |
moveHFileToGlobalArchiveDir() |
private boolean |
needCompaction() |
(package private) void |
onUpdate() |
(package private) void |
recordLastFlushTime() |
(package private) void |
requestFlush() |
(package private) void |
resetChangesAfterLastFlush() |
(package private) static void |
setupConf(org.apache.hadoop.conf.Configuration conf,
long flushSize,
long flushPerChanges,
long flushIntervalMs) |
private boolean |
shouldFlush(long changes) |
private static final org.slf4j.Logger LOG
private final org.apache.hadoop.conf.Configuration conf
private final AtomicLong changesAfterLastFlush
private final long flushSize
private final long flushPerChanges
private final long flushIntervalMs
private final int compactMin
private final org.apache.hadoop.fs.Path globalArchivePath
private final String archivedHFileSuffix
private final Thread flushThread
private boolean flushRequest
private long lastFlushTime
private final ExecutorService compactExecutor
private final Lock compactLock
private boolean compactRequest
private volatile boolean closed
MasterRegionFlusherAndCompactor(org.apache.hadoop.conf.Configuration conf, Abortable abortable, HRegion region, long flushSize, long flushPerChanges, long flushIntervalMs, int compactMin, org.apache.hadoop.fs.Path globalArchivePath, String archivedHFileSuffix)
static void setupConf(org.apache.hadoop.conf.Configuration conf, long flushSize, long flushPerChanges, long flushIntervalMs)
private void moveHFileToGlobalArchiveDir() throws IOException
IOException
private void compact()
private boolean needCompaction()
private void flushLoop()
private boolean shouldFlush(long changes)
void onUpdate()
void requestFlush()
void resetChangesAfterLastFlush()
void recordLastFlushTime()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.