Class AbstractMemTable
- java.lang.Object
-
- org.apache.iotdb.db.engine.memtable.AbstractMemTable
-
- All Implemented Interfaces:
IMemTable,SerializedSize,WALEntryValue
- Direct Known Subclasses:
NotifyFlushMemTable,PrimitiveMemTable
public abstract class AbstractMemTable extends java.lang.Object implements IMemTable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractMemTable.Factory
-
Field Summary
Fields Modifier and Type Field Description protected booleandisableMemControlThe initial value is true because we want calculate the text data size when recover memTable!!static java.util.concurrent.atomic.AtomicLongmemTableIdCountereach memTable node has a unique int value identifier, init when recovering wal
-
Constructor Summary
Constructors Constructor Description AbstractMemTable()AbstractMemTable(java.util.Map<IDeviceID,IWritableMemChunkGroup> memTableMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTextDataSize(long textDataSize)only used when mem control enabledvoidaddTVListRamCost(long cost)only used when mem control enabledbooleancheckIfChunkDoesNotExist(IDeviceID deviceId, java.lang.String measurement)must guarantee the device exists in the work memtable only used when mem control enabledvoidclear()putBack all the memory resources.voiddelete(org.apache.iotdb.commons.path.PartialPath originalPath, org.apache.iotdb.commons.path.PartialPath devicePath, long startTimestamp, long endTimestamp)Delete data in it whose timestamp <= 'timestamp' and belonging to timeseries path.voiddeserialize(java.io.DataInputStream stream)longgetCreatedTime()longgetCurrentTVListSize(IDeviceID deviceId, java.lang.String measurement)only used when mem control enabledFlushStatusgetFlushStatus()longgetMaxPlanIndex()longgetMemTableId()java.util.Map<IDeviceID,IWritableMemChunkGroup>getMemTableMap()longgetMinPlanIndex()intgetSeriesNumber()longgetTotalPointsNum()longgetTVListsRamCost()only used when mem control enabledvoidinsert(InsertRowNode insertRowNode)voidinsert(InsertRowPlan insertRowPlan)insert into this memtablevoidinsertAlignedRow(InsertRowNode insertRowNode)voidinsertAlignedRow(InsertRowPlan insertRowPlan)voidinsertAlignedTablet(InsertTabletNode insertTabletNode, int start, int end)voidinsertAlignedTablet(InsertTabletPlan insertTabletPlan, int start, int end)voidinsertTablet(InsertTabletNode insertTabletNode, int start, int end)voidinsertTablet(InsertTabletPlan insertTabletPlan, int start, int end)insert tablet into this memtable.booleanisEmpty()longmemSize()ReadOnlyMemChunkquery(org.apache.iotdb.commons.path.PartialPath fullPath, long ttlLowerBound, java.util.List<org.apache.iotdb.tsfile.utils.Pair<Modification,IMemTable>> modsToMemtable)booleanreachTotalPointNumThreshold()only used when mem control enabledvoidrelease()release resource of this memtablevoidreleaseTextDataSize(long textDataSize)only used when mem control enabledvoidreleaseTVListRamCost(long cost)only used when mem control enabledintserializedSize()Notice: this method is concurrent unsafevoidserializeToWAL(IWALByteBufferView buffer)Notice: this method is concurrent unsafevoidsetFlushStatus(FlushStatus flushStatus)voidsetShouldFlush()booleanshouldFlush()longsize()voidwrite(IDeviceID deviceId, java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> schemaList, long insertTime, java.lang.Object[] objectValue)voidwrite(InsertTabletNode insertTabletNode, int start, int end)voidwrite(InsertTabletPlan insertTabletPlan, int start, int end)write data in the range [start, end).voidwriteAlignedRow(IDeviceID deviceId, java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> schemaList, long insertTime, java.lang.Object[] objectValue)voidwriteAlignedTablet(InsertTabletNode insertTabletNode, int start, int end)voidwriteAlignedTablet(InsertTabletPlan insertTabletPlan, int start, int end)-
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.memtable.IMemTable
copy, isSignalMemTable
-
-
-
-
Field Detail
-
memTableIdCounter
public static final java.util.concurrent.atomic.AtomicLong memTableIdCounter
each memTable node has a unique int value identifier, init when recovering wal
-
disableMemControl
protected boolean disableMemControl
The initial value is true because we want calculate the text data size when recover memTable!!
-
-
Constructor Detail
-
AbstractMemTable
public AbstractMemTable()
-
AbstractMemTable
public AbstractMemTable(java.util.Map<IDeviceID,IWritableMemChunkGroup> memTableMap)
-
-
Method Detail
-
getMemTableMap
public java.util.Map<IDeviceID,IWritableMemChunkGroup> getMemTableMap()
- Specified by:
getMemTableMapin interfaceIMemTable
-
insert
public void insert(InsertRowPlan insertRowPlan)
Description copied from interface:IMemTableinsert into this memtable
-
insert
public void insert(InsertRowNode insertRowNode)
-
insertAlignedRow
public void insertAlignedRow(InsertRowPlan insertRowPlan)
- Specified by:
insertAlignedRowin interfaceIMemTable
-
insertAlignedRow
public void insertAlignedRow(InsertRowNode insertRowNode)
- Specified by:
insertAlignedRowin interfaceIMemTable
-
insertTablet
public void insertTablet(InsertTabletPlan insertTabletPlan, int start, int end) throws WriteProcessException
Description copied from interface:IMemTableinsert 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}- Specified by:
insertTabletin interfaceIMemTable- Parameters:
insertTabletPlan- insertTabletPlanstart- includedend- excluded- Throws:
WriteProcessException
-
insertAlignedTablet
public void insertAlignedTablet(InsertTabletPlan insertTabletPlan, int start, int end) throws WriteProcessException
- Specified by:
insertAlignedTabletin interfaceIMemTable- Throws:
WriteProcessException
-
insertTablet
public void insertTablet(InsertTabletNode insertTabletNode, int start, int end) throws WriteProcessException
- Specified by:
insertTabletin interfaceIMemTable- Throws:
WriteProcessException
-
insertAlignedTablet
public void insertAlignedTablet(InsertTabletNode insertTabletNode, int start, int end) throws WriteProcessException
- Specified by:
insertAlignedTabletin interfaceIMemTable- Throws:
WriteProcessException
-
write
public void write(IDeviceID deviceId, java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> schemaList, long insertTime, java.lang.Object[] objectValue)
-
writeAlignedRow
public void writeAlignedRow(IDeviceID deviceId, java.util.List<org.apache.iotdb.tsfile.write.schema.IMeasurementSchema> schemaList, long insertTime, java.lang.Object[] objectValue)
- Specified by:
writeAlignedRowin interfaceIMemTable
-
write
public void write(InsertTabletPlan insertTabletPlan, int start, int end)
Description copied from interface:IMemTablewrite 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}
-
write
public void write(InsertTabletNode insertTabletNode, int start, int end)
-
writeAlignedTablet
public void writeAlignedTablet(InsertTabletPlan insertTabletPlan, int start, int end)
- Specified by:
writeAlignedTabletin interfaceIMemTable
-
writeAlignedTablet
public void writeAlignedTablet(InsertTabletNode insertTabletNode, int start, int end)
-
checkIfChunkDoesNotExist
public boolean checkIfChunkDoesNotExist(IDeviceID deviceId, java.lang.String measurement)
Description copied from interface:IMemTablemust guarantee the device exists in the work memtable only used when mem control enabled- Specified by:
checkIfChunkDoesNotExistin interfaceIMemTable
-
getCurrentTVListSize
public long getCurrentTVListSize(IDeviceID deviceId, java.lang.String measurement)
Description copied from interface:IMemTableonly used when mem control enabled- Specified by:
getCurrentTVListSizein interfaceIMemTable
-
getSeriesNumber
public int getSeriesNumber()
- Specified by:
getSeriesNumberin interfaceIMemTable
-
getTotalPointsNum
public long getTotalPointsNum()
- Specified by:
getTotalPointsNumin interfaceIMemTable
-
reachTotalPointNumThreshold
public boolean reachTotalPointNumThreshold()
Description copied from interface:IMemTableonly used when mem control enabled- Specified by:
reachTotalPointNumThresholdin interfaceIMemTable- Returns:
- whether the average number of points in each WritableChunk reaches the threshold
-
clear
public void clear()
Description copied from interface:IMemTableputBack all the memory resources.
-
query
public 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
- Specified by:
queryin interfaceIMemTable- Throws:
java.io.IOExceptionQueryProcessException
-
delete
public void delete(org.apache.iotdb.commons.path.PartialPath originalPath, org.apache.iotdb.commons.path.PartialPath devicePath, long startTimestamp, long endTimestamp)Description copied from interface:IMemTableDelete data in it whose timestamp <= 'timestamp' and belonging to timeseries path. Only called for non-flushing MemTable.
-
addTVListRamCost
public void addTVListRamCost(long cost)
Description copied from interface:IMemTableonly used when mem control enabled- Specified by:
addTVListRamCostin interfaceIMemTable
-
releaseTVListRamCost
public void releaseTVListRamCost(long cost)
Description copied from interface:IMemTableonly used when mem control enabled- Specified by:
releaseTVListRamCostin interfaceIMemTable
-
getTVListsRamCost
public long getTVListsRamCost()
Description copied from interface:IMemTableonly used when mem control enabled- Specified by:
getTVListsRamCostin interfaceIMemTable
-
addTextDataSize
public void addTextDataSize(long textDataSize)
Description copied from interface:IMemTableonly used when mem control enabled- Specified by:
addTextDataSizein interfaceIMemTable
-
releaseTextDataSize
public void releaseTextDataSize(long textDataSize)
Description copied from interface:IMemTableonly used when mem control enabled- Specified by:
releaseTextDataSizein interfaceIMemTable
-
setShouldFlush
public void setShouldFlush()
- Specified by:
setShouldFlushin interfaceIMemTable
-
shouldFlush
public boolean shouldFlush()
- Specified by:
shouldFlushin interfaceIMemTable
-
release
public void release()
Description copied from interface:IMemTablerelease resource of this memtable
-
getMaxPlanIndex
public long getMaxPlanIndex()
- Specified by:
getMaxPlanIndexin interfaceIMemTable
-
getMinPlanIndex
public long getMinPlanIndex()
- Specified by:
getMinPlanIndexin interfaceIMemTable
-
getMemTableId
public long getMemTableId()
- Specified by:
getMemTableIdin interfaceIMemTable
-
getCreatedTime
public long getCreatedTime()
- Specified by:
getCreatedTimein interfaceIMemTable
-
getFlushStatus
public FlushStatus getFlushStatus()
- Specified by:
getFlushStatusin interfaceIMemTable
-
setFlushStatus
public void setFlushStatus(FlushStatus flushStatus)
- Specified by:
setFlushStatusin interfaceIMemTable
-
serializedSize
public int serializedSize()
Notice: this method is concurrent unsafe- Specified by:
serializedSizein interfaceSerializedSize- Returns:
- bytes number
-
serializeToWAL
public void serializeToWAL(IWALByteBufferView buffer)
Notice: this method is concurrent unsafe- Specified by:
serializeToWALin interfaceWALEntryValue
-
deserialize
public void deserialize(java.io.DataInputStream stream) throws java.io.IOException- Throws:
java.io.IOException
-
-