Package org.apache.hadoop.hbase.mob
Class DefaultMobStoreCompactor
java.lang.Object
org.apache.hadoop.hbase.regionserver.compactions.Compactor<StoreFileWriter>
org.apache.hadoop.hbase.regionserver.compactions.DefaultCompactor
org.apache.hadoop.hbase.mob.DefaultMobStoreCompactor
Compact passed set of files in the mob-enabled column family.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.regionserver.compactions.Compactor
Compactor.CellSinkFactory<S>, Compactor.FileDetails, Compactor.InternalScannerFactory
-
Field Summary
Modifier and TypeFieldDescription(package private) static ThreadLocal<Boolean>
protected boolean
private static final org.slf4j.Logger
(package private) static ThreadLocal<HashMap<String,
Long>> (package private) static ThreadLocal<org.apache.hbase.thirdparty.com.google.common.collect.SetMultimap<TableName,
String>> protected long
protected HMobStore
private final Compactor.InternalScannerFactory
(package private) static ThreadLocal<Boolean>
private final Compactor.CellSinkFactory<StoreFileWriter>
Fields inherited from class org.apache.hadoop.hbase.regionserver.compactions.Compactor
COMPACTION_PROGRESS_LOG_INTERVAL, compactionKVMax, compactScannerSizeLimit, conf, defaultScannerFactory, dropCacheMajor, dropCacheMinor, keepSeqIdPeriod, MAJOR_COMPACTION_DROP_CACHE, majorCompactionCompression, MINOR_COMPACTION_DROP_CACHE, minorCompactionCompression, store
-
Constructor Summary
ConstructorDescriptionDefaultMobStoreCompactor
(org.apache.hadoop.conf.Configuration conf, HStore store) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
calculateMobLengthMap
(org.apache.hbase.thirdparty.com.google.common.collect.SetMultimap<TableName, String> mobRefs) private void
private void
commitOrAbortMobWriter
(StoreFileWriter mobFileWriter, long maxSeqId, long mobCells, boolean major) protected List<org.apache.hadoop.fs.Path>
commitWriter
(StoreFileWriter writer, Compactor.FileDetails fd, CompactionRequestImpl request) List<org.apache.hadoop.fs.Path>
compact
(CompactionRequestImpl request, ThroughputController throughputController, User user) Do a minor/major compaction on an explicit set of storefiles from a Store.private void
deleteCommittedMobFiles
(List<String> fileNames) protected String
private StoreFileWriter
newMobWriter
(Compactor.FileDetails fd, boolean major, Consumer<org.apache.hadoop.fs.Path> writerCreationTracker) protected boolean
performCompaction
(Compactor.FileDetails fd, InternalScanner scanner, CellSink writer, long smallestReadPoint, boolean cleanSeqId, ThroughputController throughputController, CompactionRequestImpl request, CompactionProgress progress) Performs compaction on a column family with the mob flag enabled.private StoreFileWriter
switchToNewMobWriter
(StoreFileWriter mobFileWriter, Compactor.FileDetails fd, long mobCells, boolean major, CompactionRequestImpl request, List<String> committedMobWriterFileNames) Methods inherited from class org.apache.hadoop.hbase.regionserver.compactions.DefaultCompactor
abortWriter
Methods inherited from class org.apache.hadoop.hbase.regionserver.compactions.Compactor
compact, createParams, createScanner, createScanner, createWriter, createWriter, getProgress, isCompacting
-
Field Details
-
LOG
-
mobSizeThreshold
-
mobStore
-
ioOptimizedMode
-
mobRefSet
static ThreadLocal<org.apache.hbase.thirdparty.com.google.common.collect.SetMultimap<TableName,String>> mobRefSet -
userRequest
-
disableIO
-
mobLengthMap
-
scannerFactory
-
writerFactory
-
-
Constructor Details
-
DefaultMobStoreCompactor
-
-
Method Details
-
compact
public List<org.apache.hadoop.fs.Path> compact(CompactionRequestImpl request, ThroughputController throughputController, User user) throws IOException Description copied from class:DefaultCompactor
Do a minor/major compaction on an explicit set of storefiles from a Store.- Overrides:
compact
in classDefaultCompactor
- Throws:
IOException
-
calculateMobLengthMap
private void calculateMobLengthMap(org.apache.hbase.thirdparty.com.google.common.collect.SetMultimap<TableName, String> mobRefs) throws IOException- Parameters:
mobRefs
- multimap of original table name -> mob hfile- Throws:
IOException
-
performCompaction
protected boolean performCompaction(Compactor.FileDetails fd, InternalScanner scanner, CellSink writer, long smallestReadPoint, boolean cleanSeqId, ThroughputController throughputController, CompactionRequestImpl request, CompactionProgress progress) throws IOException Performs compaction on a column family with the mob flag enabled. This works only when MOB compaction is explicitly requested (by User), or by Master There are two modes of a MOB compaction:
- 1. Full mode - when all MOB data for a region is compacted into a single MOB file.
- 2. I/O optimized mode - for use cases with no or infrequent updates/deletes of a
MOB data. The main idea behind i/o optimized compaction is to limit maximum size of a MOB file produced during compaction and to limit I/O write/read amplification.
1. If the Put cell has a mob reference tag, the cell's value is the path of the mob file.- If the value size of a cell is larger than the threshold, this cell is regarded as a mob, directly copy the (with mob tag) cell into the new store file.
- Otherwise, retrieve the mob cell from the mob file, and writes a copy of the cell into the new store file.
- If the value size of a cell is larger than the threshold, this cell is regarded as a mob, write this cell to a mob file, and write the path of this mob file to the store file.
- Otherwise, directly write this cell into the store file.
- Overrides:
performCompaction
in classCompactor<StoreFileWriter>
- Parameters:
fd
- File detailsscanner
- Where to read from.writer
- Where to write to.smallestReadPoint
- Smallest read point.cleanSeqId
- When true, remove seqId(used to be mvcc) value which is <= smallestReadPointthroughputController
- The compaction throughput controller.request
- compaction request.progress
- Progress reporter.- Returns:
- Whether compaction ended; false if it was interrupted for any reason.
- Throws:
IOException
-
getStoreInfo
-
clearThreadLocals
-
newMobWriter
private StoreFileWriter newMobWriter(Compactor.FileDetails fd, boolean major, Consumer<org.apache.hadoop.fs.Path> writerCreationTracker) throws IOException - Throws:
IOException
-
commitOrAbortMobWriter
private void commitOrAbortMobWriter(StoreFileWriter mobFileWriter, long maxSeqId, long mobCells, boolean major) throws IOException - Throws:
IOException
-
commitWriter
protected List<org.apache.hadoop.fs.Path> commitWriter(StoreFileWriter writer, Compactor.FileDetails fd, CompactionRequestImpl request) throws IOException - Overrides:
commitWriter
in classDefaultCompactor
- Throws:
IOException
-
switchToNewMobWriter
private StoreFileWriter switchToNewMobWriter(StoreFileWriter mobFileWriter, Compactor.FileDetails fd, long mobCells, boolean major, CompactionRequestImpl request, List<String> committedMobWriterFileNames) throws IOException - Throws:
IOException
-
deleteCommittedMobFiles
-