Class TsFileProcessor


  • public class TsFileProcessor
    extends java.lang.Object
    • Method Detail

      • insertTablet

        public void insertTablet​(InsertTabletPlan insertTabletPlan,
                                 int start,
                                 int end,
                                 org.apache.iotdb.common.rpc.thrift.TSStatus[] results)
                          throws WriteProcessException
        insert batch data of insertTabletPlan into the workingMemtable. The rows to be inserted are in the range [start, end). Null value in each column values will be replaced by the subsequent non-null value, e.g., {1, null, 3, null, 5} will be {1, 3, 5, null, 5}
        Parameters:
        insertTabletPlan - insert a tablet of a device
        start - start index of rows to be inserted in insertTabletPlan
        end - end index of rows to be inserted in insertTabletPlan
        results - result array
        Throws:
        WriteProcessException
      • insertTablet

        public void insertTablet​(InsertTabletNode insertTabletNode,
                                 int start,
                                 int end,
                                 org.apache.iotdb.common.rpc.thrift.TSStatus[] results)
                          throws WriteProcessException
        insert batch data of insertTabletPlan into the workingMemtable. The rows to be inserted are in the range [start, end). Null value in each column values will be replaced by the subsequent non-null value, e.g., {1, null, 3, null, 5} will be {1, 3, 5, null, 5}
        Parameters:
        insertTabletNode - insert a tablet of a device
        start - start index of rows to be inserted in insertTabletPlan
        end - end index of rows to be inserted in insertTabletPlan
        results - result array
        Throws:
        WriteProcessException
      • deleteDataInMemory

        public void deleteDataInMemory​(Deletion deletion,
                                       java.util.Set<org.apache.iotdb.commons.path.PartialPath> devicePaths)
        Delete data which belongs to the timeseries `deviceId.measurementId` and the timestamp of which <= 'timestamp' in the deletion.

        Delete data in both working MemTable and flushing MemTables.

      • shouldFlush

        public boolean shouldFlush()
      • shouldClose

        public boolean shouldClose()
      • syncFlush

        public void syncFlush()
                       throws java.io.IOException
        TODO if the flushing thread is too fast, the tmpMemTable.wait() may never wakeup Tips: I am trying to solve this issue by checking whether the table exist before wait()
        Throws:
        java.io.IOException
      • asyncFlush

        public void asyncFlush()
        put the working memtable into flushing list and set the working memtable to null
      • flushOneMemTable

        public void flushOneMemTable()
        Take the first MemTable from the flushingMemTables and flush it. Called by a flush thread of the flush manager pool
      • isManagedByFlushManager

        public boolean isManagedByFlushManager()
      • setManagedByFlushManager

        public void setManagedByFlushManager​(boolean managedByFlushManager)
      • isMemtableNotNull

        public boolean isMemtableNotNull()
        sync method
      • getFlushingMemTableSize

        public int getFlushingMemTableSize()
      • getStorageGroupName

        public java.lang.String getStorageGroupName()
      • query

        public void query​(java.util.List<org.apache.iotdb.commons.path.PartialPath> seriesPaths,
                          QueryContext context,
                          java.util.List<TsFileResource> tsfileResourcesForQuery)
                   throws java.io.IOException
        get the chunk(s) in the memtable (one from work memtable and the other ones in flushing memtables and then compact them into one TimeValuePairSorter). Then get the related ChunkMetadata of data on disk.
        Parameters:
        seriesPaths - selected paths
        Throws:
        java.io.IOException
      • getTimeRangeId

        public long getTimeRangeId()
      • setTimeRangeId

        public void setTimeRangeId​(long timeRangeId)
      • setTsFileProcessorInfo

        public void setTsFileProcessorInfo​(TsFileProcessorInfo tsFileProcessorInfo)
      • getWorkMemTableRamCost

        public long getWorkMemTableRamCost()
      • getWorkMemTableCreatedTime

        public long getWorkMemTableCreatedTime()
        Return Long.MAX_VALUE if workMemTable is null
      • getLastWorkMemtableFlushTime

        public long getLastWorkMemtableFlushTime()
      • isSequence

        public boolean isSequence()
      • setWorkMemTableShouldFlush

        public void setWorkMemTableShouldFlush()
      • addFlushListener

        public void addFlushListener​(FlushListener listener)
      • addCloseFileListener

        public void addCloseFileListener​(CloseFileListener listener)
      • addFlushListeners

        public void addFlushListeners​(java.util.Collection<FlushListener> listeners)
      • addCloseFileListeners

        public void addCloseFileListeners​(java.util.Collection<CloseFileListener> listeners)
      • submitAFlushTask

        public void submitAFlushTask()
      • alreadyMarkedClosing

        public boolean alreadyMarkedClosing()
      • getWorkMemTable

        public IMemTable getWorkMemTable()
      • getFlushingMemTable

        public java.util.concurrent.ConcurrentLinkedDeque<IMemTable> getFlushingMemTable()