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

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.compactions.CompactionPolicy
      extended by org.apache.hadoop.hbase.regionserver.compactions.DefaultCompactionPolicy

@InterfaceAudience.Private
public class DefaultCompactionPolicy
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
DefaultCompactionPolicy(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
setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCompactionPolicy

public DefaultCompactionPolicy(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)
Specified by:
needsCompaction in class CompactionPolicy
Parameters:
storeFiles - Current store files.
filesCompacting - files currently compacting.
Returns:
whether a compactionSelection is possible


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.