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

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest
All Implemented Interfaces:
Comparable<CompactionRequest>

@InterfaceAudience.LimitedPrivate(value="coprocessor")
@InterfaceStability.Evolving
public class CompactionRequest
extends Object
implements Comparable<CompactionRequest>

This class holds all logical details necessary to run a compaction.


Constructor Summary
CompactionRequest()
          This ctor should be used by coprocessors that want to subclass CompactionRequest.
CompactionRequest(Collection<StoreFile> files)
           
 
Method Summary
 void afterExecute()
          Called after compaction is executed by CompactSplitThread; for use by coproc subclasses.
 void beforeExecute()
          Called before compaction is executed by CompactSplitThread; for use by coproc subclasses.
 CompactionRequest combineWith(CompactionRequest other)
          Combines the request with other request.
 int compareTo(CompactionRequest request)
          This function will define where in the priority queue the request will end up.
 boolean equals(Object obj)
           
 Collection<StoreFile> getFiles()
           
 int getPriority()
          Gets the priority for the request
 long getSelectionTime()
           
 long getSize()
          Gets the total size of all StoreFiles in compaction
 boolean isMajor()
           
 boolean isOffPeak()
           
 void setDescription(String regionName, String storeName)
          Sets the region/store name, for logging.
 void setIsMajor(boolean isMajor)
          Specify if this compaction should be a major compaction based on the state of the store
 void setOffPeak(boolean value)
           
 void setPriority(int p)
          Sets the priority for the request
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompactionRequest

public CompactionRequest()
This ctor should be used by coprocessors that want to subclass CompactionRequest.


CompactionRequest

public CompactionRequest(Collection<StoreFile> files)
Method Detail

beforeExecute

public void beforeExecute()
Called before compaction is executed by CompactSplitThread; for use by coproc subclasses.


afterExecute

public void afterExecute()
Called after compaction is executed by CompactSplitThread; for use by coproc subclasses.


combineWith

public CompactionRequest combineWith(CompactionRequest other)
Combines the request with other request. Coprocessors subclassing CR may override this if they want to do clever things based on CompactionPolicy selection that is passed to this method via "other". The default implementation just does a copy.

Parameters:
other - Request to combine with.
Returns:
The result (may be "this" or "other").

compareTo

public int compareTo(CompactionRequest request)
This function will define where in the priority queue the request will end up. Those with the highest priorities will be first. When the priorities are the same it will first compare priority then date to maintain a FIFO functionality.

Note: The enqueue timestamp is accurate to the nanosecond. if two requests have same timestamp then this function will break the tie arbitrarily with hashCode() comparing.

Specified by:
compareTo in interface Comparable<CompactionRequest>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getFiles

public Collection<StoreFile> getFiles()

setDescription

public void setDescription(String regionName,
                           String storeName)
Sets the region/store name, for logging.


getSize

public long getSize()
Gets the total size of all StoreFiles in compaction


isMajor

public boolean isMajor()

getPriority

public int getPriority()
Gets the priority for the request


setPriority

public void setPriority(int p)
Sets the priority for the request


isOffPeak

public boolean isOffPeak()

setOffPeak

public void setOffPeak(boolean value)

getSelectionTime

public long getSelectionTime()

setIsMajor

public void setIsMajor(boolean isMajor)
Specify if this compaction should be a major compaction based on the state of the store

Parameters:
isMajor - true if the system determines that this compaction should be a major compaction

toString

public String toString()
Overrides:
toString in class Object


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