@InterfaceAudience.Private public abstract class Compactor<T extends CellSink> extends Object
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 Compression.Algorithm |
compactionCompression |
protected int |
compactionKVMax |
protected org.apache.hadoop.conf.Configuration |
conf |
protected Compactor.InternalScannerFactory |
defaultScannerFactory |
private boolean |
dropCacheMajor |
private boolean |
dropCacheMinor |
protected int |
keepSeqIdPeriod
specify how many days to keep MVCC values during major compaction
|
private static org.slf4j.Logger |
LOG |
protected static String |
MAJOR_COMPACTION_DROP_CACHE |
protected static String |
MINOR_COMPACTION_DROP_CACHE |
protected CompactionProgress |
progress |
protected HStore |
store |
Constructor and Description |
---|
Compactor(org.apache.hadoop.conf.Configuration conf,
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) |
private List<StoreFileScanner> |
createFileScanners(Collection<HStoreFile> filesToCompact,
long smallestReadPoint,
boolean useDropBehind)
Creates file scanners for compaction.
|
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 |
createTmpWriter(Compactor.FileDetails fd,
boolean shouldDropBehind)
Creates a writer for a new file in a temporary directory.
|
private Compactor.FileDetails |
getFileDetails(Collection<HStoreFile> filesToCompact,
boolean allFiles)
Extracts some details about the files to compact that are commonly needed by compactors.
|
CompactionProgress |
getProgress() |
private long |
getSmallestReadPoint() |
protected boolean |
performCompaction(Compactor.FileDetails fd,
InternalScanner scanner,
CellSink writer,
long smallestReadPoint,
boolean cleanSeqId,
ThroughputController throughputController,
boolean major,
int numofFilesToCompact)
Performs the compaction.
|
private InternalScanner |
postCompactScannerOpen(CompactionRequestImpl request,
ScanType scanType,
InternalScanner scanner,
User user)
Calls coprocessor, if any, to create scanners - after normal scanner creation.
|
private ScanInfo |
preCompactScannerOpen(CompactionRequestImpl request,
ScanType scanType,
User user) |
private static final org.slf4j.Logger LOG
protected static final long COMPACTION_PROGRESS_LOG_INTERVAL
protected volatile CompactionProgress progress
protected final org.apache.hadoop.conf.Configuration conf
protected final int compactionKVMax
protected final Compression.Algorithm compactionCompression
protected int keepSeqIdPeriod
protected static final String MAJOR_COMPACTION_DROP_CACHE
protected static final String MINOR_COMPACTION_DROP_CACHE
private final boolean dropCacheMajor
private final boolean dropCacheMinor
protected final Compactor.InternalScannerFactory defaultScannerFactory
public CompactionProgress getProgress()
private Compactor.FileDetails getFileDetails(Collection<HStoreFile> filesToCompact, boolean allFiles) throws IOException
filesToCompact
- Files.allFiles
- Whether all files are included for compactionIOException
private List<StoreFileScanner> createFileScanners(Collection<HStoreFile> filesToCompact, long smallestReadPoint, boolean useDropBehind) throws IOException
filesToCompact
- Files.IOException
private long getSmallestReadPoint()
protected final StoreFileWriter createTmpWriter(Compactor.FileDetails fd, boolean shouldDropBehind) throws IOException
fd
- The file details.IOException
- if creation failedprivate ScanInfo preCompactScannerOpen(CompactionRequestImpl request, ScanType scanType, User user) throws IOException
IOException
private InternalScanner postCompactScannerOpen(CompactionRequestImpl request, ScanType scanType, InternalScanner scanner, User user) throws IOException
request
- Compaction request.scanType
- Scan type.scanner
- The default scanner created for compaction.IOException
protected final List<org.apache.hadoop.fs.Path> compact(CompactionRequestImpl request, Compactor.InternalScannerFactory scannerFactory, Compactor.CellSinkFactory<T> sinkFactory, ThroughputController throughputController, User user) throws IOException
IOException
protected abstract List<org.apache.hadoop.fs.Path> commitWriter(T writer, Compactor.FileDetails fd, CompactionRequestImpl request) throws IOException
IOException
protected abstract void abortWriter(T writer) throws IOException
IOException
protected boolean performCompaction(Compactor.FileDetails fd, InternalScanner scanner, CellSink writer, long smallestReadPoint, boolean cleanSeqId, ThroughputController throughputController, boolean major, int numofFilesToCompact) 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 <=
smallestReadPointmajor
- Is a major compaction.numofFilesToCompact
- the number of files to compactIOException
protected 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.IOException
protected 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.IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.