@InterfaceAudience.Private public abstract class Compactor<T extends CellSink> extends Object
Compactions might be concurrent against a given store and the Compactor is shared among them. Do not put mutable state into class fields. All Compactor class fields should be final or effectively final. 'keepSeqIdPeriod' is an exception to this rule because unit tests may set it.
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
Compactor.CellSinkFactory<S> |
protected static class |
Compactor.FileDetails
The sole reason this class exists is that java has no ref/out/pointer parameters.
|
protected static interface |
Compactor.InternalScannerFactory |
| Modifier and Type | Field and Description |
|---|---|
protected static long |
COMPACTION_PROGRESS_LOG_INTERVAL |
protected int |
compactionKVMax |
protected org.apache.hadoop.conf.Configuration |
conf |
protected Compactor.InternalScannerFactory |
defaultScannerFactory |
protected boolean |
dropCacheMajor |
protected boolean |
dropCacheMinor |
protected int |
keepSeqIdPeriod
specify how many days to keep MVCC values during major compaction
|
protected static String |
MAJOR_COMPACTION_DROP_CACHE |
protected Compression.Algorithm |
majorCompactionCompression |
protected static String |
MINOR_COMPACTION_DROP_CACHE |
protected Compression.Algorithm |
minorCompactionCompression |
protected HStore |
store |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
abortWriter(T writer) |
protected abstract List<org.apache.hadoop.fs.Path> |
commitWriter(T writer,
Compactor.FileDetails fd,
CompactionRequestImpl request) |
protected List<org.apache.hadoop.fs.Path> |
compact(CompactionRequestImpl request,
Compactor.InternalScannerFactory scannerFactory,
Compactor.CellSinkFactory<T> sinkFactory,
ThroughputController throughputController,
User user) |
protected CreateStoreFileWriterParams |
createParams(Compactor.FileDetails fd,
boolean shouldDropBehind,
boolean major,
Consumer<org.apache.hadoop.fs.Path> writerCreationTracker) |
protected InternalScanner |
createScanner(HStore store,
ScanInfo scanInfo,
List<StoreFileScanner> scanners,
long smallestReadPoint,
long earliestPutTs,
byte[] dropDeletesFromRow,
byte[] dropDeletesToRow) |
protected InternalScanner |
createScanner(HStore store,
ScanInfo scanInfo,
List<StoreFileScanner> scanners,
ScanType scanType,
long smallestReadPoint,
long earliestPutTs) |
protected StoreFileWriter |
createWriter(Compactor.FileDetails fd,
boolean shouldDropBehind,
boolean major,
Consumer<org.apache.hadoop.fs.Path> writerCreationTracker)
Creates a writer for a new file.
|
protected StoreFileWriter |
createWriter(Compactor.FileDetails fd,
boolean shouldDropBehind,
String fileStoragePolicy,
boolean major,
Consumer<org.apache.hadoop.fs.Path> writerCreationTracker) |
CompactionProgress |
getProgress()
Return the aggregate progress for all currently active compactions.
|
boolean |
isCompacting() |
protected boolean |
performCompaction(Compactor.FileDetails fd,
InternalScanner scanner,
CellSink writer,
long smallestReadPoint,
boolean cleanSeqId,
ThroughputController throughputController,
CompactionRequestImpl request,
CompactionProgress progress)
Performs the compaction.
|
protected static final long COMPACTION_PROGRESS_LOG_INTERVAL
protected final org.apache.hadoop.conf.Configuration conf
protected final HStore store
protected final int compactionKVMax
protected final Compression.Algorithm majorCompactionCompression
protected final Compression.Algorithm minorCompactionCompression
protected int keepSeqIdPeriod
protected static final String MAJOR_COMPACTION_DROP_CACHE
protected static final String MINOR_COMPACTION_DROP_CACHE
protected final boolean dropCacheMajor
protected final boolean dropCacheMinor
protected final Compactor.InternalScannerFactory defaultScannerFactory
protected final CreateStoreFileWriterParams createParams(Compactor.FileDetails fd, boolean shouldDropBehind, boolean major, Consumer<org.apache.hadoop.fs.Path> writerCreationTracker)
protected final StoreFileWriter createWriter(Compactor.FileDetails fd, boolean shouldDropBehind, boolean major, Consumer<org.apache.hadoop.fs.Path> writerCreationTracker) throws IOException
fd - The file details.IOException - if creation failedprotected final StoreFileWriter createWriter(Compactor.FileDetails fd, boolean shouldDropBehind, String fileStoragePolicy, boolean major, Consumer<org.apache.hadoop.fs.Path> writerCreationTracker) throws IOException
IOExceptionprotected final List<org.apache.hadoop.fs.Path> compact(CompactionRequestImpl request, Compactor.InternalScannerFactory scannerFactory, Compactor.CellSinkFactory<T> sinkFactory, ThroughputController throughputController, User user) throws IOException
IOExceptionprotected abstract List<org.apache.hadoop.fs.Path> commitWriter(T writer, Compactor.FileDetails fd, CompactionRequestImpl request) throws IOException
IOExceptionprotected abstract void abortWriter(T writer) throws IOException
IOExceptionprotected boolean performCompaction(Compactor.FileDetails fd, InternalScanner scanner, CellSink writer, long smallestReadPoint, boolean cleanSeqId, ThroughputController throughputController, CompactionRequestImpl request, CompactionProgress progress) throws IOException
fd - FileDetails of cell sink writerscanner - 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 <=
smallestReadPointrequest - compaction request.progress - Progress reporter.IOExceptionprotected InternalScanner createScanner(HStore store, ScanInfo scanInfo, List<StoreFileScanner> scanners, ScanType scanType, long smallestReadPoint, long earliestPutTs) throws IOException
store - storescanners - Store file scanners.scanType - Scan type.smallestReadPoint - Smallest MVCC read point.earliestPutTs - Earliest put across all files.IOExceptionprotected InternalScanner createScanner(HStore store, ScanInfo scanInfo, List<StoreFileScanner> scanners, long smallestReadPoint, long earliestPutTs, byte[] dropDeletesFromRow, byte[] dropDeletesToRow) throws IOException
store - The store.scanners - Store file scanners.smallestReadPoint - Smallest MVCC read point.earliestPutTs - Earliest put across all files.dropDeletesFromRow - Drop deletes starting with this row, inclusive. Can be null.dropDeletesToRow - Drop deletes ending with this row, exclusive. Can be null.IOExceptionpublic CompactionProgress getProgress()
public boolean isCompacting()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.