The interview problem

Practice prompt

A storage reader checks many immutable tables for a key that is usually absent. Add a compact membership structure without ever hiding a stored record.

Original practice, not a reported company interview. All scenarios and worked numbers are illustrative. Interview date: not applicable. Sources retrieved September 30, 2026.

1. Scope and assumptions

Assume immutable table generations and a standard Bloom filter with no deletion. A positive result means possibly present; a negative result is useful only for the exact complete generation the filter represents.

2. Worked approach

generation manifest
  → validated filter
  → absent: skip / possible: inspect table

Build the filter from every key in the immutable table, record hash configuration and checksum, and publish it in the same generation manifest as the table. The reader validates metadata before trusting negative answers. If a filter is missing or corrupt, fall back to the actual table.

Compaction creates a new filter and table before atomically switching manifests. Do not reuse an old filter after inserting additional keys into a mutable table. If supporting mutable buffers, either update membership before exposing records or consult the mutable layer independently. Treat the filter only as a read optimization, never as the authoritative uniqueness check.

3. Calculate the example

For n = 10 million keys and desired false-positive probability p = 0.01, the standard approximation m = −n ln(p)/(ln 2)² gives about 95.85 million bits, or 11.98 MB decimal. The optimal k ≈ (m/n) ln 2 is 6.64, so test seven hashes. For one million truly absent independent queries at an actual 1% false-positive rate, expect about 10,000 unnecessary table probes. The filter does not eliminate reads for present keys.

4. Failure cases and trade-offs

A build job that omits a partition creates real false negatives despite the mathematical structure's guarantee. A mismatched seed or generation is similarly dangerous. Validate coverage at publication and retain a safe bypass path. Adversarial queries can produce much worse behavior than the expected false-positive workload.

More bits reduce false positives but consume memory that could cache actual data. More hashes add CPU. Counting filters support different update behavior but need overflow and delete semantics; they are not a drop-in license to delete from a standard bit array.

5. Validate the result

Check every inserted key on a build sample or complete small fixture, query disjoint absent keys, and simulate corrupt metadata. Measure saved disk work against hashing cost under the real absence rate.

6. Interview follow-ups and self-review

Why can clearing one bit break another key? What happens when the filter exceeds its planned capacity?

Reward generation coupling, correct approximate sizing, safe failure fallback and refusal to use possible-membership as truth.

Sources and related practice

Technical reference: redis.io — Bloom membership semantics; immutable-table protocol and sizing example are original.

Exact publication/update date not established in this review. Retrieved September 30, 2026. This reference supports the named technical concept; the proposed workflow and examples are original, not a documented vendor implementation or interview report.

Continue with Compact an event log without resurrecting deleted keys; Design a distributed cache.

Continue your preparation

Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.