org.apache.hadoop.hbase.regionserver.compactions
Class RatioBasedCompactionPolicy

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.compactions.CompactionPolicy
      extended by org.apache.hadoop.hbase.regionserver.compactions.RatioBasedCompactionPolicy
Direct Known Subclasses:
ExploringCompactionPolicy

@InterfaceAudience.Private
public class RatioBasedCompactionPolicy
extends CompactionPolicy

The default algorithm for selecting files for compaction. Combines the compaction configuration and the provisional file selection that it's given to produce the list of suitable candidates for compaction.


Field Summary
 
Fields inherited from class org.apache.hadoop.hbase.regionserver.compactions.CompactionPolicy
comConf, storeConfigInfo
 
Constructor Summary
RatioBasedCompactionPolicy(org.apache.hadoop.conf.Configuration conf, StoreConfigInformation storeConfigInfo)
           
 
Method Summary
 long getNextMajorCompactTime(Collection<StoreFile> filesToCompact)
           
 boolean isMajorCompaction(Collection<StoreFile> filesToCompact)
           
 boolean needsCompaction(Collection<StoreFile> storeFiles, List<StoreFile> filesCompacting)
           
 List<StoreFile> preSelectCompactionForCoprocessor(Collection<StoreFile> candidates, List<StoreFile> filesCompacting)
           
 CompactionRequest selectCompaction(Collection<StoreFile> candidateFiles, List<StoreFile> filesCompacting, boolean isUserCompaction, boolean mayUseOffPeak, boolean forceMajor)
           
 boolean throttleCompaction(long compactionSize)
           
 
Methods inherited from class org.apache.hadoop.hbase.regionserver.compactions.CompactionPolicy
getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RatioBasedCompactionPolicy

public RatioBasedCompactionPolicy(org.apache.hadoop.conf.Configuration conf,
                                  StoreConfigInformation storeConfigInfo)
Method Detail

preSelectCompactionForCoprocessor

public List<StoreFile> preSelectCompactionForCoprocessor(Collection<StoreFile> candidates,
                                                         List<StoreFile> filesCompacting)

selectCompaction

public CompactionRequest selectCompaction(Collection<StoreFile> candidateFiles,
                                          List<StoreFile> filesCompacting,
                                          boolean isUserCompaction,
                                          boolean mayUseOffPeak,
                                          boolean forceMajor)
                                   throws IOException
Parameters:
candidateFiles - candidate files, ordered from oldest to newest
Returns:
subset copy of candidate list that meets compaction criteria
Throws:
IOException

isMajorCompaction

public boolean isMajorCompaction(Collection<StoreFile> filesToCompact)
                          throws IOException
Specified by:
isMajorCompaction in class CompactionPolicy
Parameters:
filesToCompact - Files to compact. Can be null.
Returns:
True if we should run a major compaction.
Throws:
IOException

getNextMajorCompactTime

public long getNextMajorCompactTime(Collection<StoreFile> filesToCompact)

throttleCompaction

public boolean throttleCompaction(long compactionSize)
Specified by:
throttleCompaction in class CompactionPolicy
Parameters:
compactionSize - Total size of some compaction
Returns:
whether this should be a large or small compaction

needsCompaction

public boolean needsCompaction(Collection<StoreFile> storeFiles,
                               List<StoreFile> filesCompacting)


Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.