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

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

@InterfaceAudience.Private
public abstract class CompactionContext
extends Object

This class holds all "physical" details necessary to run a compaction, and abstracts away the details specific to a particular compaction. It also has compaction request with all the logical details. Hence, this class is basically the compaction.


Field Summary
protected  CompactionRequest request
           
 
Constructor Summary
CompactionContext()
           
 
Method Summary
abstract  List<org.apache.hadoop.fs.Path> compact(CompactionThroughputController throughputController)
          Runs the compaction based on current selection.
abstract  List<org.apache.hadoop.fs.Path> compact(CompactionThroughputController throughputController, User user)
           
 void forceSelect(CompactionRequest request)
          Forces external selection to be applied for this compaction.
 CompactionRequest getRequest()
           
 boolean hasSelection()
           
abstract  List<StoreFile> preSelect(List<StoreFile> filesCompacting)
          Called before coprocessor preCompactSelection and should filter the candidates for coprocessor; i.e.
abstract  boolean select(List<StoreFile> filesCompacting, boolean isUserCompaction, boolean mayUseOffPeak, boolean forceMajor)
          Called to select files for compaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected CompactionRequest request
Constructor Detail

CompactionContext

public CompactionContext()
Method Detail

preSelect

public abstract List<StoreFile> preSelect(List<StoreFile> filesCompacting)
Called before coprocessor preCompactSelection and should filter the candidates for coprocessor; i.e. exclude the files that definitely cannot be compacted at this time.

Parameters:
filesCompacting - files currently compacting
Returns:
the list of files that can theoretically be compacted.

select

public abstract boolean select(List<StoreFile> filesCompacting,
                               boolean isUserCompaction,
                               boolean mayUseOffPeak,
                               boolean forceMajor)
                        throws IOException
Called to select files for compaction. Must fill in the request field if successful.

Parameters:
filesCompacting - Files currently being compacted by other compactions.
isUserCompaction - Whether this is a user compaction.
mayUseOffPeak - Whether the underlying policy may assume it's off-peak hours.
forceMajor - Whether to force major compaction.
Returns:
Whether the selection succeeded. Selection may be empty and lead to no compaction.
Throws:
IOException

forceSelect

public void forceSelect(CompactionRequest request)
Forces external selection to be applied for this compaction.

Parameters:
request - The pre-cooked request with selection and other settings.

compact

public abstract List<org.apache.hadoop.fs.Path> compact(CompactionThroughputController throughputController)
                                                 throws IOException
Runs the compaction based on current selection. select/forceSelect must have been called.

Returns:
The new file paths resulting from compaction.
Throws:
IOException

compact

public abstract List<org.apache.hadoop.fs.Path> compact(CompactionThroughputController throughputController,
                                                        User user)
                                                 throws IOException
Throws:
IOException

getRequest

public CompactionRequest getRequest()

hasSelection

public boolean hasSelection()


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