org.apache.accumulo.tserver.compaction
public abstract class CompactionStrategy extends Object
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 to
gatherInformation(MajorCompactionRequest)
and getCompactionPlan(MajorCompactionRequest)
.
Note: the strategy object used for the shouldCompact(MajorCompactionRequest)
call is going to be different from the one used in the
compaction thread.
Constructor and Description |
---|
CompactionStrategy() |
Modifier and Type | Method and Description |
---|---|
void |
gatherInformation(MajorCompactionRequest request)
Called prior to obtaining the tablet lock, useful for examining metadata or indexes.
|
abstract CompactionPlan |
getCompactionPlan(MajorCompactionRequest request)
Get the plan for compacting a tablets files.
|
void |
init(Map<String,String> options)
The settings for the compaction strategy pulled from zookeeper.
|
abstract boolean |
shouldCompact(MajorCompactionRequest request)
Determine if this tablet is eligible for a major compaction.
|
public void init(Map<String,String> options)
public abstract boolean shouldCompact(MajorCompactionRequest request) throws IOException
gatherInformation(MajorCompactionRequest)
and
getCompactionPlan(MajorCompactionRequest)
) that it does not need to. Any state stored during shouldCompact will no longer exist when
gatherInformation(MajorCompactionRequest)
and getCompactionPlan(MajorCompactionRequest)
are called.IOException
public void gatherInformation(MajorCompactionRequest request) throws IOException
getCompactionPlan(MajorCompactionRequest)
.request
- basic details about the tabletIOException
public abstract CompactionPlan getCompactionPlan(MajorCompactionRequest request) throws IOException
request
- basic details about the tabletIOException
Copyright © 2011–2016 The Apache Software Foundation. All rights reserved.