Class CompactionStrategy
- java.lang.Object
-
- org.apache.accumulo.tserver.compaction.CompactionStrategy
-
- Direct Known Subclasses:
DefaultCompactionStrategy
,EverythingCompactionStrategy
@Deprecated(since="2.1.0", forRemoval=true) public abstract class CompactionStrategy extends Object
Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 useCompactionSelector
,CompactionConfigurer
, andCompactionPlanner
instead. SeeCompactionStrategyConfig
for more information about why this was deprecated.The interface for customizing major compactions.The tablet server has one thread to ask many tablets if they should compact. When the strategy returns true, then tablet is added to the queue of tablets waiting for a compaction thread. Once a thread is available, the
gatherInformation(MajorCompactionRequest)
method is called outside the tablets' lock. This gives the strategy the ability to read information that maybe expensive to fetch. Once the gatherInformation returns, the tablet lock is grabbed and the compactionPlan computed. This should *not* do expensive operations, especially not I/O. Note that the number of files may change between calls togatherInformation(MajorCompactionRequest)
andgetCompactionPlan(MajorCompactionRequest)
.Note: the strategy object used for the
shouldCompact(MajorCompactionRequest)
call is going to be different from the one used in the compaction thread.- See Also:
org.apache.accumulo.core.spi.compaction
-
-
Constructor Summary
Constructors Constructor Description CompactionStrategy()
Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
gatherInformation(MajorCompactionRequest request)
Deprecated, for removal: This API element is subject to removal in a future version.Called prior to obtaining the tablet lock, useful for examining metadata or indexes.abstract CompactionPlan
getCompactionPlan(MajorCompactionRequest request)
Deprecated, for removal: This API element is subject to removal in a future version.Get the plan for compacting a tablets files.void
init(Map<String,String> options)
Deprecated, for removal: This API element is subject to removal in a future version.The settings for the compaction strategy pulled from zookeeper.abstract boolean
shouldCompact(MajorCompactionRequest request)
Deprecated, for removal: This API element is subject to removal in a future version.Determine if this tablet is eligible for a major compaction.
-
-
-
Method Detail
-
init
public void init(Map<String,String> options)
Deprecated, for removal: This API element is subject to removal in a future version.The settings for the compaction strategy pulled from zookeeper. Thetable.compacations.major.strategy.opts
part of the setting will be removed.
-
shouldCompact
public abstract boolean shouldCompact(MajorCompactionRequest request) throws IOException
Deprecated, for removal: This API element is subject to removal in a future version.Determine if this tablet is eligible for a major compaction. It's ok if it later determines (throughgatherInformation(MajorCompactionRequest)
andgetCompactionPlan(MajorCompactionRequest)
) that it does not need to. Any state stored during shouldCompact will no longer exist whengatherInformation(MajorCompactionRequest)
andgetCompactionPlan(MajorCompactionRequest)
are called.Called while holding the tablet lock, so it should not be doing any blocking.
Since no blocking should be done in this method, then its unexpected that this method will throw IOException. However since its in the API, it can not be easily removed.
- Throws:
IOException
-
gatherInformation
public void gatherInformation(MajorCompactionRequest request) throws IOException
Deprecated, for removal: This API element is subject to removal in a future version.Called prior to obtaining the tablet lock, useful for examining metadata or indexes. State collected during this method will be available during the call thegetCompactionPlan(MajorCompactionRequest)
.- Parameters:
request
- basic details about the tablet- Throws:
IOException
-
getCompactionPlan
public abstract CompactionPlan getCompactionPlan(MajorCompactionRequest request) throws IOException
Deprecated, for removal: This API element is subject to removal in a future version.Get the plan for compacting a tablets files. Called while holding the tablet lock, so it should not be doing any blocking.Since no blocking should be done in this method, then its unexpected that this method will throw IOException. However since its in the API, it can not be easily removed.
- Parameters:
request
- basic details about the tablet- Returns:
- the plan for a major compaction, or null to cancel the compaction.
- Throws:
IOException
-
-