0%

Rocksdb-SST

目录#

Rocksdb SST 类型[1][2]#

  • BlockBasedTable [本文重点讨论]
    **an overview of the block-based table type in Rocksdb, which is inherited from LevelDB. **
    Data is stored in fixed-sized blocks, which can be compressed and encoded for efficient storage. To retrieve data, the block where the record may reside is located and read into memory, and a search is performed within the block. The block cache is used to avoid frequent reads of the same block.
    Rocksdb 中基于块的表类型的概述,该类型继承自 LevelDB。
    数据存储在固定大小的块中,可以压缩和编码以实现高效存储。为了检索数据,需要定位并读入可能包含记录的块,并在块内执行搜索。块缓存用于避免频繁读取相同的块。

  • Plain table

Rocksdb SST- BlockBasedTable [5]#

名称 说明
Footer 指出 IndexBlock 和 MetaIndexBlock 在文件中的偏移量信息,它是元信息的元信息,它位于 sstable 文件的尾部
IndexBlock 记录了 DataBlock 相关的元信息
MetaIndexBlock 各个元信息的Block,包括Filter、Properties(整个table的属性信息)、Compression dictionary、Range deletion tombstone
MetaBlock 存储布隆过滤器的二进制数据 及其他元信息数据
DataBlock 存储实际的数据即键值对内容

索引块 Index Block [3]#

索引块用于查找包含指定key的数据块。是一种基于二分搜索的数据结构。一个文件可能包含一个索引块,也可能包含一组分区索引块,这取决于使用配置。即存在全局索引与分区索引两种索引方式。

SSTable的数据检索过程 [6]#

参考#

  1. A Tutorial of RocksDB SST formats
  2. Rocksdb BlockBasedTable Format
  3. RocksDB基本架构与原理介绍
  4. leveldb sstable *** 未
  5. RocksDB block-based SST 文件详解 ***
  6. 浅析RocksDB的SSTable格式