# Storage engine

# Design ideas

The storage engine is based on the LSM design. The data is first written to the memory buffer memtable and then flushed to disk. For each device, the maximum timestamp being flushed (including those that have been flushed and are being flushed) is maintained in memory. The data is divided into sequential data and out-of-order data according to this timestamp. Different types of data are separated into different memtables and flushed into different TsFiles.

Each data file TsFile corresponds to a file index information TsFileResource in memory for query use.

In addition, the storage engine includes asynchronous persistence and file merge mechanisms.

# Write process

  • org.apache.iotdb.db.engine.StorageEngine

    Responsible for writing and accessing an IoTDB instance and managing all StorageGroupProsessor.

  • org.apache.iotdb.db.engine.storagegroup.StorageGroupProcessor

    Responsible for writing and accessing data within a time partition of a storage group.

    Manages all partitions‘ TsFileProcessor .

  • org.apache.iotdb.db.engine.storagegroup.TsFileProcessor

    Responsible for data writing and accessing a TsFile file.

# Data write

See details:

# Data access

  • Main entrance(StorageEngine): public QueryDataSource query(SingleSeriesExpression seriesExpression, QueryContext context, QueryFileManager filePathsManager) ​
    • Find all ordered and out-of-order TsFileResources containing this time series and return them for use by the query engine

Copyright © 2021 The Apache Software Foundation.
Apache and the Apache feather logo are trademarks of The Apache Software Foundation

Contact us: Join QQ Group 659990460 | Add friend tietouqiao and be invited to Wechat Group
see Join the community for more