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
Nested ClassesModifier and TypeClassDescriptionprivate static final classprotected static interfaceprivate final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate ThroughputControllerprivate static final Comparator<Runnable>private final org.apache.hadoop.conf.Configurationstatic final intprivate static final CompactSplit.CompactionCompleteTrackerstatic final Stringstatic final Stringstatic final intprivate static final org.slf4j.Loggerprivate ThreadPoolExecutorstatic final Stringprivate intSplitting should not take place if the total number of regions exceed this.private final HRegionServerprivate ThreadPoolExecutorstatic final Stringstatic final intstatic final Stringstatic final intprivate ThreadPoolExecutor -
Constructor Summary
ConstructorsConstructorDescriptionCompactSplit(org.apache.hadoop.conf.Configuration conf) CompactSplit(HRegionServer server) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidprivate voidprivate voidvoidderegisterChildren(ConfigurationManager manager) Needs to be called to deregister the children from the manager.intReturns the current size of the queue containing regions that are processed.getCompleteTracker(CompactionLifeCycleTracker tracker, IntSupplier numberOfStores) intprotected int(package private) ThreadPoolExecutorReturns the longCompactions thread pool executorintReturns the regionSplitLimit(package private) ThreadPoolExecutorReturns the shortCompactions thread pool executorintprotected intintprotected intprivate Stringprivate void(package private) voidOnly interrupt once it's done with a run through the work loop.booleanbooleanCheck if this store is under compaction(package private) voidjoin()voidonConfigurationChange(org.apache.hadoop.conf.Configuration newConf) This method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.voidregisterChildren(ConfigurationManager manager) Needs to be called to register the children to the manager.private voidvoidrequestCompaction(HRegion region, String why, int priority, CompactionLifeCycleTracker tracker, User user) Request compaction on all the stores of the given region.voidrequestCompaction(HRegion region, HStore store, String why, int priority, CompactionLifeCycleTracker tracker, User user) Request compaction on the given store.private voidrequestCompactionInternal(HRegion region, String why, int priority, boolean selectNow, CompactionLifeCycleTracker tracker, CompactSplit.CompactionCompleteTracker completeTracker, User user) protected voidrequestCompactionInternal(HRegion region, HStore store, String why, int priority, boolean selectNow, CompactionLifeCycleTracker tracker, CompactSplit.CompactionCompleteTracker completeTracker, User user) booleanprivate voidrequestSplit(Region r, byte[] midKey) private voidrequestSplit(Region r, byte[] midKey, User user) voidrequestSystemCompaction(HRegion region, String why) voidrequestSystemCompaction(HRegion region, HStore store, String why) voidrequestSystemCompaction(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) voidsetCompactionsEnabled(boolean compactionsEnabled) private boolean(package private) voidShutdown the long compaction thread pool.voidswitchCompaction(boolean onOrOff) on/off compactiontoString()private voidwaitFor(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:CompactionRequesterRequest compaction on all the stores of the given region.- Specified by:
requestCompactionin 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:CompactionRequesterRequest compaction on the given store.- Specified by:
requestCompactionin interfaceCompactionRequester- Throws:
IOException
-
switchCompaction
Description copied from interface:CompactionRequesteron/off compaction- Specified by:
switchCompactionin 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:CompactionRequesterRequest system compaction on the given store.- Specified by:
requestSystemCompactionin 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 theConfigurationManagerobject when theConfigurationobject is reloaded from disk.- Specified by:
onConfigurationChangein interfaceConfigurationObserver
-
getSmallCompactionThreadNum
-
getLargeCompactionThreadNum
-
getSplitThreadNum
-
registerChildren
Needs to be called to register the children to the manager.- Specified by:
registerChildrenin interfacePropagatingConfigurationObserver- Parameters:
manager- : to register to
-
deregisterChildren
Needs to be called to deregister the children from the manager.- Specified by:
deregisterChildrenin 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
-