Class StripeCompactionPolicy
java.lang.Object
org.apache.hadoop.hbase.regionserver.compactions.CompactionPolicy
org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy
Stripe store implementation of compaction policy.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
Request for stripe compactor that will cause it to split the source files into several separate files at the provided boundaries.private static class
Request for stripe compactor that will cause it to split the source files into several separate files into based on key-value count, as well as file count limit.static class
Stripe compaction request wrapper.static interface
The information about stripes that the policy needs to do its stuff -
Field Summary
Modifier and TypeFieldDescriptionprivate StripeStoreConfig
private static final org.slf4j.Logger
private ExploringCompactionPolicy
Fields inherited from class org.apache.hadoop.hbase.regionserver.compactions.CompactionPolicy
comConf, storeConfigInfo
-
Constructor Summary
ConstructorDescriptionStripeCompactionPolicy
(org.apache.hadoop.conf.Configuration conf, StoreConfigInformation storeConfigInfo, StripeStoreConfig config) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
allFilesExpired
(List<HStoreFile> storeFiles) protected boolean
createEmptyRequest
(StripeCompactionPolicy.StripeInformationProvider si, CompactionRequestImpl request) estimateTargetKvs
(Collection<HStoreFile> files, double splitCount) static long
getTotalFileSize
(Collection<HStoreFile> candidates) private static long
getTotalKvCount
(Collection<HStoreFile> candidates) protected boolean
boolean
needsCompactions
(StripeCompactionPolicy.StripeInformationProvider si, List<HStoreFile> filesCompacting) protected boolean
preSelectFilesForCoprocessor
(StripeCompactionPolicy.StripeInformationProvider si, List<HStoreFile> filesCompacting) selectCompaction
(StripeCompactionPolicy.StripeInformationProvider si, List<HStoreFile> filesCompacting, boolean isOffpeak) selectExpiredMergeCompaction
(StripeCompactionPolicy.StripeInformationProvider si, boolean canDropDeletesNoL0) selectFlush
(CellComparator comparator, StripeCompactionPolicy.StripeInformationProvider si, int kvCount) private List<HStoreFile>
selectSimpleCompaction
(List<HStoreFile> sfs, boolean allFilesOnly, boolean isOffpeak, boolean forceCompact) Selects the compaction of a single stripe using default policy.selectSingleStripeCompaction
(StripeCompactionPolicy.StripeInformationProvider si, boolean includeL0, boolean canDropDeletesWithoutL0, boolean isOffpeak) boolean
shouldPerformMajorCompaction
(Collection<HStoreFile> filesToCompact) private boolean
boolean
throttleCompaction
(long compactionSize) Methods inherited from class org.apache.hadoop.hbase.regionserver.compactions.CompactionPolicy
getConf, setConf
-
Field Details
-
LOG
-
stripePolicy
-
config
-
-
Constructor Details
-
StripeCompactionPolicy
public StripeCompactionPolicy(org.apache.hadoop.conf.Configuration conf, StoreConfigInformation storeConfigInfo, StripeStoreConfig config)
-
-
Method Details
-
preSelectFilesForCoprocessor
public List<HStoreFile> preSelectFilesForCoprocessor(StripeCompactionPolicy.StripeInformationProvider si, List<HStoreFile> filesCompacting) -
createEmptyRequest
-
selectFlush
public StripeStoreFlusher.StripeFlushRequest selectFlush(CellComparator comparator, StripeCompactionPolicy.StripeInformationProvider si, int kvCount) -
selectCompaction
public StripeCompactionPolicy.StripeCompactionRequest selectCompaction(StripeCompactionPolicy.StripeInformationProvider si, List<HStoreFile> filesCompacting, boolean isOffpeak) throws IOException - Throws:
IOException
-
needsCompactions
public boolean needsCompactions(StripeCompactionPolicy.StripeInformationProvider si, List<HStoreFile> filesCompacting) -
shouldPerformMajorCompaction
public boolean shouldPerformMajorCompaction(Collection<HStoreFile> filesToCompact) throws IOException - Specified by:
shouldPerformMajorCompaction
in classCompactionPolicy
- Parameters:
filesToCompact
- Files to compact. Can be null.- Returns:
- True if we should run a major compaction.
- Throws:
IOException
-
throttleCompaction
- Specified by:
throttleCompaction
in classCompactionPolicy
- Parameters:
compactionSize
- Total size of some compaction- Returns:
- whether this should be a large or small compaction
-
needsSingleStripeCompaction
- Parameters:
si
- StoreFileManager.- Returns:
- Whether any stripe potentially needs compaction.
-
selectSingleStripeCompaction
protected StripeCompactionPolicy.StripeCompactionRequest selectSingleStripeCompaction(StripeCompactionPolicy.StripeInformationProvider si, boolean includeL0, boolean canDropDeletesWithoutL0, boolean isOffpeak) throws IOException - Throws:
IOException
-
selectSimpleCompaction
private List<HStoreFile> selectSimpleCompaction(List<HStoreFile> sfs, boolean allFilesOnly, boolean isOffpeak, boolean forceCompact) Selects the compaction of a single stripe using default policy.- Parameters:
sfs
- Files.allFilesOnly
- Whether a compaction of all-or-none files is needed.- Returns:
- The resulting selection.
-
shouldSelectL0Files
-
selectL0OnlyCompaction
-
selectExpiredMergeCompaction
private StripeCompactionPolicy.StripeCompactionRequest selectExpiredMergeCompaction(StripeCompactionPolicy.StripeInformationProvider si, boolean canDropDeletesNoL0) -
hasExpiredStripes
-
allL0FilesExpired
-
allFilesExpired
-
getTotalKvCount
-
getTotalFileSize
-
estimateTargetKvs
-