public class CompactionRequest extends Object implements Comparable<CompactionRequest>, Runnable
Modifier and Type | Class and Description |
---|---|
static class |
CompactionRequest.CompactionState
An enum for the region compaction state
|
static class |
CompactionRequest.Rejection
Cleanup class to use when rejecting a compaction request from the queue.
|
Constructor and Description |
---|
CompactionRequest(HRegion r,
Store s,
CompactSelection files,
boolean isMajor,
int p) |
CompactionRequest(HRegion region,
Store store,
int priority)
Constructor for a custom compaction.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(CompactionRequest request)
This function will define where in the priority queue the request will
end up.
|
void |
finishRequest() |
static CompactionRequest.CompactionState |
getCompactionState(long regionId)
Find out if a given region in compaction now.
|
CompactSelection |
getCompactSelection()
Gets the compact selection object for the request
|
List<StoreFile> |
getFiles()
Gets the StoreFiles for the request
|
HRegion |
getHRegion()
Gets the HRegion for the request
|
int |
getPriority()
Gets the priority for the request
|
static CompactionRequest |
getRequestForTesting(Store store,
org.apache.hadoop.conf.Configuration conf,
Collection<StoreFile> selection,
boolean isMajor)
Create a simple compaction request just for testing - this lets you specify everything you
would need in the general case of testing compactions from an external perspective (e.g.
|
long |
getSize()
Gets the total size of all StoreFiles in compaction
|
Store |
getStore()
Gets the Store for the request
|
boolean |
isMajor() |
static void |
postRequest(CompactionRequest cr) |
static void |
preRequest(CompactionRequest cr) |
void |
run() |
void |
setIsMajor(boolean isMajor)
Specify if this compaction should be a major compaction based on the state of the store
|
void |
setPriority(int p)
Gets the priority for the request
|
void |
setSelection(CompactSelection files)
Set the files (and, implicitly, the size of the compaction based on those files)
|
void |
setServer(HRegionServer hrs) |
String |
toString() |
public CompactionRequest(HRegion region, Store store, int priority)
region
- region that is being compactedstore
- store which is being compactedpriority
- specified priority with which this compaction should enter the queue.public CompactionRequest(HRegion r, Store s, CompactSelection files, boolean isMajor, int p)
public static CompactionRequest getRequestForTesting(Store store, org.apache.hadoop.conf.Configuration conf, Collection<StoreFile> selection, boolean isMajor)
store
- conf
- selection
- isMajor
- public static CompactionRequest.CompactionState getCompactionState(long regionId)
regionId
- public static void preRequest(CompactionRequest cr)
public static void postRequest(CompactionRequest cr)
public void finishRequest()
public int compareTo(CompactionRequest request)
Note: The date is only accurate to the millisecond which means it is possible that two requests were inserted into the queue within a millisecond. When that is the case this function will break the tie arbitrarily.
compareTo
in interface Comparable<CompactionRequest>
public HRegion getHRegion()
public Store getStore()
public CompactSelection getCompactSelection()
public long getSize()
public boolean isMajor()
public int getPriority()
public void setPriority(int p)
public void setServer(HRegionServer hrs)
public void setSelection(CompactSelection files)
files
- files that should be included in the compactionpublic void setIsMajor(boolean isMajor)
isMajor
- true if the system determines that this compaction should be a major
compactionCopyright © 2014 The Apache Software Foundation. All Rights Reserved.