Ribbon filter
A Ribbon filter is a static approximate-membership filter built from localized binary linear equations, trading construction work for compact storage.
The constructed filter is not a mutable set or a data-integrity checksum. Standard, homogeneous and bumped variants differ. RocksDB's bloom_equivalent_bits_per_key targets Bloom-equivalent filtering, not the actual bit count. [1] [2]
In v9.7.3, selecting a Ribbon builder does not guarantee Ribbon output: construction can fall back to Bloom for a smaller representation, a failed banding-memory reservation or exhausted seed search. [3]
Construction-memory charging uses an available block cache only when enabled; its compatibility default is disabled. This is separate from caching finished filters and is not a process-RSS cap. Compare actual output format, resident size and concurrent construction. [4]
Homogeneous Ribbon solves AZ=0 with randomized free variables instead of storing arbitrary assigned values. Its false-positive probability is p+(1-p)2^-r, where p is the probability that an absent key's coefficient vector lies in the stored rows' span. It is not exactly 2^-r in general. Localized row coefficients also do not make the sorted matrix a conventional fixed-diagonal band matrix. [1]
Relations
- related
- Bloom filter, Sorted string table, Partitioned filter, XOR filter, Binary fuse filter, Retrieval data structure
Citations
- Dillinger et al. Fast Succinct Retrieval and Approximate Membership using Ribbon. arXiv:2109.01892v2, sections 1-3 and 9.
- RocksDB v9.7.3. include/rocksdb/filter_policy.h: NewRibbonFilterPolicy and bloom_before_level.
- RocksDB v9.7.3: Ribbon builder selection and construction fallbacks.
- RocksDB v9.7.3: filter-construction cache charging and its default.
Further reading
- Hesela: Ribbon construction and cache-accounting boundaries.
- Hesela: six version-pinned Ribbon selection and fallback cases.
Sources & caveats
- The v9.7.3 fallback conditions were checked in source code, not triggered in a runtime experiment; no fallback-frequency estimate is implied. [3]