参考:
- https://www.jianshu.com/p/9b5…
- https://zhuanlan.zhihu.com/p/…
SST File Format
之前在 LSM-Tree 局部有提过,但过后理解的比拟浅
<beginning_of_file>
[data block 1]
[data block 2]
...
[data block N]
[meta block 1: filter block]
[meta block 2: index block]
[meta block 3: compression dictionary block]
[meta block 4: range deletion block]
[meta block 5: stats block]
...
[meta block K: future extended block] (More meta blocks may be added in the future)
[metaindex block]
[Footer] (fixed size; starts at file_size - sizeof(Footer))
<end_of_file>
与 BlockBasedTableBuilder 相干的类有以下几个
- BlockBasedTable, 该类封装了用于读取磁盘 BlockBasedTable 类型的 SST 表的逻辑。
- BlockBasedTableBuilder, 该类用于在磁盘上构建一个 BlockBasedTable 类型的 SST 表。
- BlockBasedTableFactory, 该类是 BlockBasedTable 工厂办法的实现,用于创立 BlockBasedTable/BlockBasedTableBuilder。
Write Block 的程序:
Write meta blocks, metaindex block and footer in the following order.
- [meta block: filter]
- [meta block: index]
- [meta block: compression dictionary]
- [meta block: range deletion tombstone]
- [meta block: properties]
- [metaindex block]
- Footer