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
FieldsModifier and TypeFieldDescriptionprivate final Abortableprivate final Stringprivate final AtomicLongprivate booleanprivate final ExecutorServiceprivate final Lockprivate final intprivate booleanprivate final org.apache.hadoop.conf.Configurationprivate final Conditionprivate final longprivate final Lockprivate final longprivate booleanprivate final longprivate final Threadprivate final org.apache.hadoop.fs.Pathprivate longprivate static final org.slf4j.Loggerprivate final HRegion -
Constructor Summary
ConstructorsConstructorDescriptionMasterRegionFlusherAndCompactor(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 TypeMethodDescriptionvoidclose()private voidcompact()private voidprivate voidprivate boolean(package private) voidonUpdate()(package private) void(package private) void(package private) void(package private) static voidsetupConf(org.apache.hadoop.conf.Configuration conf, long flushSize, long flushPerChanges, long flushIntervalMs) private booleanshouldFlush(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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-