Class SizeTieredCompactionSelector
- java.lang.Object
-
- org.apache.iotdb.db.engine.compaction.inner.sizetiered.SizeTieredCompactionSelector
-
- All Implemented Interfaces:
IInnerSeqSpaceSelector,IInnerUnseqSpaceSelector,ICompactionSelector
public class SizeTieredCompactionSelector extends java.lang.Object implements IInnerSeqSpaceSelector, IInnerUnseqSpaceSelector
SizeTieredCompactionSelector selects files to be compacted based on the size of files. The selector traverses the file list from old to new. If the size of selected files or the number of select files exceed given threshold, a compaction task will be submitted to task queue in CompactionTaskManager. In CompactionTaskManager, tasks are ordered byICompactionTaskComparator. To maximize compaction efficiency, selector searches compaction task from 0 compaction files(that is, file that never been compacted, named level 0 file) to higher level files. If a compaction task is found in some level, selector will not search higher level anymore.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringdataRegionIdprotected booleanhasNextTimePartitionprotected booleansequenceprotected java.lang.StringstorageGroupNameprotected longtimePartitionprotected TsFileManagertsFileManagerprotected java.util.List<TsFileResource>tsFileResources
-
Constructor Summary
Constructors Constructor Description SizeTieredCompactionSelector(java.lang.String storageGroupName, java.lang.String dataRegionId, long timePartition, boolean sequence, TsFileManager tsFileManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.util.List<TsFileResource>>selectInnerSpaceTask(java.util.List<TsFileResource> tsFileResources)This method searches for a batch of files to be compacted from layer 0 to the highest layer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.iotdb.db.engine.compaction.task.ICompactionSelector
getCompactionMemoryCost, selectCrossSpaceTask
-
-
-
-
Field Detail
-
storageGroupName
protected java.lang.String storageGroupName
-
dataRegionId
protected java.lang.String dataRegionId
-
timePartition
protected long timePartition
-
tsFileResources
protected java.util.List<TsFileResource> tsFileResources
-
sequence
protected boolean sequence
-
tsFileManager
protected TsFileManager tsFileManager
-
hasNextTimePartition
protected boolean hasNextTimePartition
-
-
Constructor Detail
-
SizeTieredCompactionSelector
public SizeTieredCompactionSelector(java.lang.String storageGroupName, java.lang.String dataRegionId, long timePartition, boolean sequence, TsFileManager tsFileManager)
-
-
Method Detail
-
selectInnerSpaceTask
public java.util.List<java.util.List<TsFileResource>> selectInnerSpaceTask(java.util.List<TsFileResource> tsFileResources)
This method searches for a batch of files to be compacted from layer 0 to the highest layer. If there are more than a batch of files to be merged on a certain layer, it does not search to higher layers. It creates a compaction thread for each batch of files and put it into the candidateCompactionTaskQueue of theCompactionTaskManager.- Specified by:
selectInnerSpaceTaskin interfaceICompactionSelector- Specified by:
selectInnerSpaceTaskin interfaceIInnerSeqSpaceSelector- Specified by:
selectInnerSpaceTaskin interfaceIInnerUnseqSpaceSelector- Returns:
- Returns whether the file was found and submits the merge task
-
-