Class CompactSplit
java.lang.Object
org.apache.hadoop.hbase.regionserver.CompactSplit
- All Implemented Interfaces:
ConfigurationObserver
,PropagatingConfigurationObserver
,CompactionRequester
@Private
public class CompactSplit
extends Object
implements CompactionRequester, PropagatingConfigurationObserver
Compact region on request and then run split if appropriate
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static final class
protected static interface
private final class
-
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
private ThroughputController
private static final Comparator<Runnable>
private final org.apache.hadoop.conf.Configuration
static final int
private static final CompactSplit.CompactionCompleteTracker
static final String
static final String
static final int
private static final org.slf4j.Logger
private ThreadPoolExecutor
static final String
private int
Splitting should not take place if the total number of regions exceed this.private final HRegionServer
private ThreadPoolExecutor
static final String
static final int
static final String
static final int
private ThreadPoolExecutor
-
Constructor Summary
ConstructorDescriptionCompactSplit
(org.apache.hadoop.conf.Configuration conf) CompactSplit
(HRegionServer server) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
private void
private void
void
deregisterChildren
(ConfigurationManager manager) Needs to be called to deregister the children from the manager.int
Returns the current size of the queue containing regions that are processed.getCompleteTracker
(CompactionLifeCycleTracker tracker, IntSupplier numberOfStores) int
protected int
(package private) ThreadPoolExecutor
Returns the longCompactions thread pool executorint
Returns the regionSplitLimit(package private) ThreadPoolExecutor
Returns the shortCompactions thread pool executorint
protected int
int
protected int
private String
private void
(package private) void
Only interrupt once it's done with a run through the work loop.boolean
boolean
Check if this store is under compaction(package private) void
join()
void
onConfigurationChange
(org.apache.hadoop.conf.Configuration newConf) This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.void
registerChildren
(ConfigurationManager manager) Needs to be called to register the children to the manager.private void
void
requestCompaction
(HRegion region, String why, int priority, CompactionLifeCycleTracker tracker, User user) Request compaction on all the stores of the given region.void
requestCompaction
(HRegion region, HStore store, String why, int priority, CompactionLifeCycleTracker tracker, User user) Request compaction on the given store.private void
requestCompactionInternal
(HRegion region, String why, int priority, boolean selectNow, CompactionLifeCycleTracker tracker, CompactSplit.CompactionCompleteTracker completeTracker, User user) protected void
requestCompactionInternal
(HRegion region, HStore store, String why, int priority, boolean selectNow, CompactionLifeCycleTracker tracker, CompactSplit.CompactionCompleteTracker completeTracker, User user) boolean
private void
requestSplit
(Region r, byte[] midKey) private void
requestSplit
(Region r, byte[] midKey, User user) void
requestSystemCompaction
(HRegion region, String why) void
requestSystemCompaction
(HRegion region, HStore store, String why) void
requestSystemCompaction
(HRegion region, HStore store, String why, boolean giveUpIfRequestedOrCompacting) Request system compaction on the given store.private Optional<CompactionContext>
selectCompaction
(HRegion region, HStore store, int priority, CompactionLifeCycleTracker tracker, CompactSplit.CompactionCompleteTracker completeTracker, User user) void
setCompactionsEnabled
(boolean compactionsEnabled) private boolean
(package private) void
Shutdown the long compaction thread pool.void
switchCompaction
(boolean onOrOff) on/off compactiontoString()
private void
waitFor
(ThreadPoolExecutor t, String name)
-
Field Details
-
LOG
-
LARGE_COMPACTION_THREADS
- See Also:
-
LARGE_COMPACTION_THREADS_DEFAULT
- See Also:
-
SMALL_COMPACTION_THREADS
- See Also:
-
SMALL_COMPACTION_THREADS_DEFAULT
- See Also:
-
SPLIT_THREADS
- See Also:
-
SPLIT_THREADS_DEFAULT
- See Also:
-
REGION_SERVER_REGION_SPLIT_LIMIT
- See Also:
-
DEFAULT_REGION_SERVER_REGION_SPLIT_LIMIT
- See Also:
-
HBASE_REGION_SERVER_ENABLE_COMPACTION
- See Also:
-
server
-
conf
-
longCompactions
-
shortCompactions
-
splits
-
compactionThroughputController
-
underCompactionStores
-
compactionsEnabled
-
regionSplitLimit
Splitting should not take place if the total number of regions exceed this. This is not a hard limit to the number of regions but it is a guideline to stop splitting after number of online regions is greater than this. -
DUMMY_COMPLETE_TRACKER
-
COMPARATOR
-
-
Constructor Details
-
CompactSplit
CompactSplit(HRegionServer server) -
CompactSplit
-
-
Method Details
-
createSplitExcecutors
-
createCompactionExecutors
-
toString
-
dumpQueue
-
requestSplit
-
requestSplit
-
requestSplit
-
interrupt
-
reInitializeCompactionsExecutors
-
getCompleteTracker
private CompactSplit.CompactionCompleteTracker getCompleteTracker(CompactionLifeCycleTracker tracker, IntSupplier numberOfStores) -
requestCompaction
public void requestCompaction(HRegion region, String why, int priority, CompactionLifeCycleTracker tracker, User user) throws IOException Description copied from interface:CompactionRequester
Request compaction on all the stores of the given region.- Specified by:
requestCompaction
in interfaceCompactionRequester
- Throws:
IOException
-
requestCompaction
public void requestCompaction(HRegion region, HStore store, String why, int priority, CompactionLifeCycleTracker tracker, User user) throws IOException Description copied from interface:CompactionRequester
Request compaction on the given store.- Specified by:
requestCompaction
in interfaceCompactionRequester
- Throws:
IOException
-
switchCompaction
Description copied from interface:CompactionRequester
on/off compaction- Specified by:
switchCompaction
in interfaceCompactionRequester
-
requestCompactionInternal
private void requestCompactionInternal(HRegion region, String why, int priority, boolean selectNow, CompactionLifeCycleTracker tracker, CompactSplit.CompactionCompleteTracker completeTracker, User user) throws IOException - Throws:
IOException
-
requestCompactionInternal
protected void requestCompactionInternal(HRegion region, HStore store, String why, int priority, boolean selectNow, CompactionLifeCycleTracker tracker, CompactSplit.CompactionCompleteTracker completeTracker, User user) throws IOException - Throws:
IOException
-
requestSystemCompaction
- Throws:
IOException
-
requestSystemCompaction
- Throws:
IOException
-
requestSystemCompaction
public void requestSystemCompaction(HRegion region, HStore store, String why, boolean giveUpIfRequestedOrCompacting) throws IOException Description copied from interface:CompactionRequester
Request system compaction on the given store.- Specified by:
requestSystemCompaction
in interfaceCompactionRequester
- Throws:
IOException
-
selectCompaction
private Optional<CompactionContext> selectCompaction(HRegion region, HStore store, int priority, CompactionLifeCycleTracker tracker, CompactSplit.CompactionCompleteTracker completeTracker, User user) throws IOException - Throws:
IOException
-
interruptIfNecessary
void interruptIfNecessary()Only interrupt once it's done with a run through the work loop. -
waitFor
-
join
void join() -
getCompactionQueueSize
Returns the current size of the queue containing regions that are processed.- Returns:
- The current size of the regions queue.
-
getLargeCompactionQueueSize
-
getSmallCompactionQueueSize
-
getSplitQueueSize
-
shouldSplitRegion
-
getRegionSplitLimit
Returns the regionSplitLimit -
isUnderCompaction
Check if this store is under compaction -
onConfigurationChange
This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.- Specified by:
onConfigurationChange
in interfaceConfigurationObserver
-
getSmallCompactionThreadNum
-
getLargeCompactionThreadNum
-
getSplitThreadNum
-
registerChildren
Needs to be called to register the children to the manager.- Specified by:
registerChildren
in interfacePropagatingConfigurationObserver
- Parameters:
manager
- : to register to
-
deregisterChildren
Needs to be called to deregister the children from the manager.- Specified by:
deregisterChildren
in interfacePropagatingConfigurationObserver
- Parameters:
manager
- : to deregister from
-
getCompactionThroughputController
-
shutdownLongCompactions
void shutdownLongCompactions()Shutdown the long compaction thread pool. Should only be used in unit test to prevent long compaction thread pool from stealing job from short compaction queue -
clearLongCompactionsQueue
-
clearShortCompactionsQueue
-
isCompactionsEnabled
-
setCompactionsEnabled
-
getLongCompactions
Returns the longCompactions thread pool executor -
getShortCompactions
Returns the shortCompactions thread pool executor -
getStoreNameForUnderCompaction
-