Class MasterRegionFlusherAndCompactor
java.lang.Object
org.apache.hadoop.hbase.master.region.MasterRegionFlusherAndCompactor
- All Implemented Interfaces:
Closeable
,AutoCloseable
As long as there is no RegionServerServices for a master local region, we need implement the
flush and compaction logic by our own.
The flush logic is very simple, every time after calling a modification method in
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.-
Field Summary
Modifier and TypeFieldDescriptionprivate final Abortable
private final String
private final AtomicLong
private boolean
private final ExecutorService
private final Lock
private final int
private boolean
private final org.apache.hadoop.conf.Configuration
private final Condition
private final long
private final Lock
private final long
private boolean
private final long
private final Thread
private final org.apache.hadoop.fs.Path
private long
private static final org.slf4j.Logger
private final HRegion
-
Constructor Summary
ConstructorDescriptionMasterRegionFlusherAndCompactor
(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) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
private void
compact()
private void
private void
private boolean
(package private) void
onUpdate()
(package private) void
(package private) void
(package private) void
(package private) static void
setupConf
(org.apache.hadoop.conf.Configuration conf, long flushSize, long flushPerChanges, long flushIntervalMs) private boolean
shouldFlush
(long changes)
-
Field Details
-
LOG
-
conf
-
abortable
-
region
-
changesAfterLastFlush
-
flushSize
-
flushPerChanges
-
flushIntervalMs
-
compactMin
-
globalArchivePath
-
archivedHFileSuffix
-
flushThread
-
flushLock
-
flushCond
-
flushRequest
-
lastFlushTime
-
compactExecutor
-
compactLock
-
compactRequest
-
closed
-
-
Constructor Details
-
MasterRegionFlusherAndCompactor
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)
-
-
Method Details
-
setupConf
static void setupConf(org.apache.hadoop.conf.Configuration conf, long flushSize, long flushPerChanges, long flushIntervalMs) -
moveHFileToGlobalArchiveDir
- Throws:
IOException
-
compact
-
needCompaction
-
flushLoop
-
shouldFlush
-
onUpdate
void onUpdate() -
requestFlush
void requestFlush() -
resetChangesAfterLastFlush
void resetChangesAfterLastFlush() -
recordLastFlushTime
void recordLastFlushTime() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-