Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Storage engine

Image Added

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.

Writing process

Related code

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

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

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

    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 writing

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

Related documents