Class AbstractCompactionTask

  • Direct Known Subclasses:
    CrossSpaceCompactionTask, InnerSpaceCompactionTask

    public abstract class AbstractCompactionTask
    extends java.lang.Object
    AbstractCompactionTask is the base class for all compaction task, it carries out the execution of compaction. AbstractCompactionTask uses a template method, it executes the abstract function doCompaction() implemented by subclass, and decrease the currentTaskNum in CompactionScheduler when the doCompaction() is finished. The future returns the CompactionTaskSummary of this task execution.
    • Field Detail

      • dataRegionId

        protected java.lang.String dataRegionId
      • storageGroupName

        protected java.lang.String storageGroupName
      • timePartition

        protected long timePartition
      • currentTaskNum

        protected final java.util.concurrent.atomic.AtomicInteger currentTaskNum
      • hashCode

        protected int hashCode
      • serialId

        protected long serialId
    • Constructor Detail

      • AbstractCompactionTask

        public AbstractCompactionTask​(java.lang.String storageGroupName,
                                      java.lang.String dataRegionId,
                                      long timePartition,
                                      TsFileManager tsFileManager,
                                      java.util.concurrent.atomic.AtomicInteger currentTaskNum,
                                      long serialId)
    • Method Detail

      • setSourceFilesToCompactionCandidate

        public abstract void setSourceFilesToCompactionCandidate()
      • doCompaction

        protected abstract void doCompaction()
      • start

        public void start()
      • getStorageGroupName

        public java.lang.String getStorageGroupName()
      • getDataRegionId

        public java.lang.String getDataRegionId()
      • getTimePartition

        public long getTimePartition()
      • checkValidAndSetMerging

        public abstract boolean checkValidAndSetMerging()
        Check if the compaction task is valid (selected files are not merging, closed and exist). If the task is valid, then set the merging status of selected files to true.
        Returns:
        true if the task is valid else false
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • resetCompactionCandidateStatusForAllSourceFiles

        public abstract void resetCompactionCandidateStatusForAllSourceFiles()
      • getTimeCost

        public long getTimeCost()
      • checkInterrupted

        protected void checkInterrupted()
                                 throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • isTaskRan

        public boolean isTaskRan()
      • cancel

        public void cancel()
      • isSuccess

        public boolean isSuccess()
      • isTaskFinished

        public boolean isTaskFinished()
      • getSerialId

        public long getSerialId()