Interface IMemTable

  • All Superinterfaces:
    SerializedSize, WALEntryValue
    All Known Implementing Classes:
    AbstractMemTable, NotifyFlushMemTable, PrimitiveMemTable

    public interface IMemTable
    extends WALEntryValue
    IMemTable is designed to store data points which are not flushed into TsFile yet. An instance of IMemTable maintains all series belonging to one StorageGroup, corresponding to one StorageGroupProcessor.
    The concurrent control of IMemTable is based on the concurrent control of StorageGroupProcessor, i.e., Writing and querying operations must already have gotten writeLock and readLock respectively.
    • Method Detail

      • write

        void write​(IDeviceID deviceId,
                   java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> schemaList,
                   long insertTime,
                   java.lang.Object[] objectValue)
      • writeAlignedRow

        void writeAlignedRow​(IDeviceID deviceId,
                             java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> schemaList,
                             long insertTime,
                             java.lang.Object[] objectValue)
      • write

        void write​(InsertTabletPlan insertTabletPlan,
                   int start,
                   int end)
        write data 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}
      • writeAlignedTablet

        void writeAlignedTablet​(InsertTabletPlan insertTabletPlan,
                                int start,
                                int end)
      • size

        long size()
        Returns:
        the number of points
      • memSize

        long memSize()
        Returns:
        memory usage
      • addTVListRamCost

        void addTVListRamCost​(long cost)
        only used when mem control enabled
      • releaseTVListRamCost

        void releaseTVListRamCost​(long cost)
        only used when mem control enabled
      • getTVListsRamCost

        long getTVListsRamCost()
        only used when mem control enabled
      • reachTotalPointNumThreshold

        boolean reachTotalPointNumThreshold()
        only used when mem control enabled
        Returns:
        whether the average number of points in each WritableChunk reaches the threshold
      • getSeriesNumber

        int getSeriesNumber()
      • getTotalPointsNum

        long getTotalPointsNum()
      • insert

        void insert​(InsertRowPlan insertRowPlan)
        insert into this memtable
        Parameters:
        insertRowPlan - insertRowPlan
      • insertAlignedRow

        void insertAlignedRow​(InsertRowPlan insertRowPlan)
      • insertAlignedRow

        void insertAlignedRow​(InsertRowNode insertRowNode)
      • insertTablet

        void insertTablet​(InsertTabletPlan insertTabletPlan,
                          int start,
                          int end)
                   throws WriteProcessException
        insert tablet into this memtable. 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 - insertTabletPlan
        start - included
        end - excluded
        Throws:
        WriteProcessException
      • query

        ReadOnlyMemChunk query​(org.apache.iotdb.commons.path.PartialPath fullPath,
                               long ttlLowerBound,
                               java.util.List<org.apache.iotdb.tsfile.utils.Pair<Modification,​IMemTable>> modsToMemtable)
                        throws java.io.IOException,
                               QueryProcessException,
                               org.apache.iotdb.commons.exception.MetadataException
        Throws:
        java.io.IOException
        QueryProcessException
        org.apache.iotdb.commons.exception.MetadataException
      • clear

        void clear()
        putBack all the memory resources.
      • isEmpty

        boolean isEmpty()
      • delete

        void delete​(org.apache.iotdb.commons.path.PartialPath path,
                    org.apache.iotdb.commons.path.PartialPath devicePath,
                    long startTimestamp,
                    long endTimestamp)
        Delete data in it whose timestamp <= 'timestamp' and belonging to timeseries path. Only called for non-flushing MemTable.
        Parameters:
        path - the PartialPath the timeseries to be deleted.
        devicePath - the device path of the timeseries to be deleted.
        startTimestamp - the lower-bound of deletion time.
        endTimestamp - the upper-bound of deletion time
      • copy

        IMemTable copy()
        Make a copy of this MemTable.
        Returns:
        a MemTable with the same data as this one.
      • isSignalMemTable

        boolean isSignalMemTable()
      • setShouldFlush

        void setShouldFlush()
      • shouldFlush

        boolean shouldFlush()
      • release

        void release()
        release resource of this memtable
      • checkIfChunkDoesNotExist

        boolean checkIfChunkDoesNotExist​(IDeviceID deviceId,
                                         java.lang.String measurement)
        must guarantee the device exists in the work memtable only used when mem control enabled
      • getCurrentTVListSize

        long getCurrentTVListSize​(IDeviceID deviceId,
                                  java.lang.String measurement)
        only used when mem control enabled
      • addTextDataSize

        void addTextDataSize​(long textDataIncrement)
        only used when mem control enabled
      • releaseTextDataSize

        void releaseTextDataSize​(long textDataDecrement)
        only used when mem control enabled
      • getMaxPlanIndex

        long getMaxPlanIndex()
      • getMinPlanIndex

        long getMinPlanIndex()
      • getMemTableId

        long getMemTableId()
      • getCreatedTime

        long getCreatedTime()
      • setFlushStatus

        void setFlushStatus​(FlushStatus flushStatus)