- C++ 84.7%
- Java 6.7%
- Python 2.3%
- C 2.3%
- Starlark 1.7%
- Other 2.2%
Summary: Pull Request resolved: https://github.com/meta/rocksdb/pull/15865 ## Summary With `min_tombstones_for_range_conversion` enabled, read-path conversions append logically redundant range tombstones to the active memtable. Invalidating the fragmented cache after every conversion can make concurrent scans contend on cache initialization and do quadratic rebuild work as the list grows. Add the experimental mutable column family option `range_tombstone_conversion_cache_invalidation_threshold` with a default of 300. Column families that already enable read-path conversion pick up this threshold by default. Once the active memtable reaches that total range deletion count, conversions keep appending to the range deletion skiplist and leave the cache in place. The original point tombstones cover those deletions while the cache lags. Set the threshold to 0 to allow conversion-driven invalidation at any count. User-issued `DeleteRange` still invalidates the cache, and sealing the memtable fragments the full skiplist. SuperVersion installation applies the latest threshold to the active memtable, including when `SetOptions()` overlaps a memtable switch. Deduplication probes up to five entries in the raw skiplist for a visible covering range. The probe includes conversions that left the cache in place and avoids loading the fragmented cache. The bounded search can miss a covering range, so deduplication is best effort. The first conversion that skips invalidation marks the memtable for its lifetime. Subsequent external SST ingestion and bounded manual compaction overlap checks rebuild the marked memtable's cache from the skiplist, and later readers can reuse it. Memtables with no skipped invalidations use the normal cache path for overlap checks. ## Benchmarks Compared optimized `db_bench` builds with and without the diff. Each trial ran 65,536 scans on a fresh tmpfs copy of a synthetic 1M-key database with clustered point deletions and an initially empty active memtable. Each scan creates an iterator, seeks to a random key, and makes up to 100 `Next()` calls. The table shows median throughput and median per-trial scan p99 over six interleaved trials per setting on an AMD EPYC 9D85 host. | Setting | 1 thread scans/s | 1 thread p99 (µs) | 32 threads scans/s | 32 threads p99 (µs) | 64 threads scans/s | 64 threads p99 (µs) | | Without diff | 34,276 | 209.2 | 239,422 | 544.7 | 316,418 | 688.7 | | 100 | 31,866 | 102.5 | 462,608 | 161.3 | 737,108 | 193.2 | | 200 | 32,399 | 100.2 | 487,837 | 158.1 | 783,200 | 212.3 | | 300 | 32,884 | 97.2 | 489,082 | 157.6 | 810,475 | 186.0 | | 400 | 33,216 | 95.0 | 504,642 | 159.7 | 814,232 | 189.9 | | 500 | 33,600 | 92.9 | 511,258 | 160.7 | 769,692 | 202.2 | | 1,000 | 35,344 | 91.6 | 530,512 | 170.4 | 733,838 | 232.3 | | 2,000 | 35,400 | 151.8 | 416,102 | 335.7 | 547,294 | 361.2 | | 3,000 | 34,154 | 204.3 | 259,013 | 523.4 | 329,258 | 576.4 | | 0 (uncapped) | 34,520 | 204.8 | 261,318 | 519.1 | 333,020 | 574.6 | Threshold 300 had the lowest median p99 at 32 and 64 threads. At one thread, throughput fell 4% versus the pre-diff build. Scans can step over more point tombstones once conversions stop invalidating the cache. At 0, each successful conversion still invalidates the cache. The skiplist dedup check avoids a possible rebuild or wait during conversion, which likely helps throughput versus the pre-diff build. At 3,000, the workload stayed below the cutoff and tracked the uncapped setting. Runs used the reverse-bytewise comparator and `min_tombstones_for_range_conversion=8`, with compression and automatic compaction disabled. Thresholds 2,000 and 3,000 ran alongside 300 in a separate sweep. ```bash taskset -c 0-95 ./db_bench --db="$run" --options_file="$opts" \ --benchmarks=memstats,seekrandom,memstats --num=1000000 --duration=0 \ --threads="$threads" --reads="$((65536 / threads))" --seek_nexts=100 \ --histogram=1 --use_existing_db=1 --seed=1 --reverse_iterator=0 ``` Reviewed By: xingbowang Differential Revision: D135421808 fbshipit-source-id: 19b5890f2c69debc8c878516affb967946540765 |
||
|---|---|---|
| .github | ||
| buckifier | ||
| build_tools | ||
| c_api_gen | ||
| cache | ||
| claude_md | ||
| cmake | ||
| coverage | ||
| db | ||
| db_stress_tool | ||
| docs | ||
| env | ||
| examples | ||
| file | ||
| fuzz | ||
| githooks | ||
| include/rocksdb | ||
| java | ||
| logging | ||
| memory | ||
| memtable | ||
| microbench | ||
| monitoring | ||
| options | ||
| plugin | ||
| port | ||
| table | ||
| test_util | ||
| third-party | ||
| tools | ||
| trace_replay | ||
| unreleased_history | ||
| util | ||
| utilities | ||
| wiki | ||
| .clang-format | ||
| .clang-tidy | ||
| .gitignore | ||
| .lgtm.yml | ||
| .watchmanconfig | ||
| AGENTS.md | ||
| AUTHORS | ||
| BUCK | ||
| ccache_msvc_compiler.bat | ||
| CLAUDE.md | ||
| CMakeLists.txt | ||
| CODE_OF_CONDUCT.md | ||
| common.mk | ||
| CONTRIBUTING.md | ||
| COPYING | ||
| crash_test.mk | ||
| DEFAULT_OPTIONS_HISTORY.md | ||
| Directory.Build.props | ||
| DUMP_FORMAT.md | ||
| folly.mk | ||
| HISTORY.md | ||
| INSTALL.md | ||
| issue_template.md | ||
| LANGUAGE-BINDINGS.md | ||
| LICENSE.Apache | ||
| LICENSE.leveldb | ||
| Makefile | ||
| PLUGINS.md | ||
| README.md | ||
| rocksdb.pc.in | ||
| src.mk | ||
| thirdparty.inc | ||
| USERS.md | ||
| Vagrantfile | ||
| WINDOWS_PORT.md | ||
RocksDB: A Persistent Key-Value Store for Flash and RAM Storage
RocksDB is developed and maintained by Facebook Database Engineering Team. It is built on earlier work on LevelDB by Sanjay Ghemawat (sanjay@google.com) and Jeff Dean (jeff@google.com)
This code is a library that forms the core building block for a fast key-value server, especially suited for storing data on flash drives. It has a Log-Structured-Merge-Database (LSM) design with flexible tradeoffs between Write-Amplification-Factor (WAF), Read-Amplification-Factor (RAF) and Space-Amplification-Factor (SAF). It has multi-threaded compactions, making it especially suitable for storing multiple terabytes of data in a single database.
Start with example usage here: https://github.com/meta/rocksdb/tree/main/examples
See the github wiki for more explanation.
The public interface is in include/. Callers should not include or
rely on the details of any other header files in this package. Those
internal APIs may be changed without warning.
Questions and discussions are welcome on the RocksDB Developers Public Facebook group and email list on Google Groups.
License
RocksDB is dual-licensed under both the GPLv2 (found in the COPYING file in the root directory) and Apache 2.0 License (found in the LICENSE.Apache file in the root directory). You may select, at your option, one of the above-listed licenses.