Optimize RocksDB prefix scans for persistent forest leaves
- Lingua principale
- Rust
- Stelle
- 772
- Fork
- 352
- Merge medio
- 1g 12h
- PR unite (30g)
- 93
Descrizione
The persistent forest stores leaf keys as `LineageId || leaf_index`. `entries(lineage)` scans leaves by that 32-byte lineage prefix, but `LEAVES_CF` does not set a RocksDB prefix extractor.
RocksDB can use prefix seek optimizations when a prefix extractor is configured:
- [Prefix Seek](https://github.com/facebook/rocksdb/wiki/Prefix-Seek)
- [Iterator: Prefix Iterating](https://github.com/facebook/rocksdb/wiki/Iterator#prefix-iterating)
- [Tuning Guide: Prefix database on flash storage](https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide#prefix-database-on-flash-storage)
## Suggested change
Set a fixed 32-byte prefix extractor for `LEAVES_CF`, matching `LineageId`.
Benchmark `entries(lineage)` before and after. Only add prefix bloom or hash index tuning if the benchmark supports it.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.