How it works
A log-structured replica commonly appends a write to a durable log and updates an in-memory table, the memtable. It later flushes that table to disk as an immutable sorted file, an SSTable. This design, the log-structured merge tree or LSM tree, is used by Cassandra, RocksDB, and HBase because it turns random writes into sequential ones. Acknowledging before the required log durability boundary risks losing a write on restart, even if the coordinator counted it. A process crash spares data in the operating system’s page cache; a power cut does not, unless the log was flushed with fsync. Engines often fsync in batches to save time, so treat the boundary as a setting to check.
A read checks memory and then disk tables, newest first. A Bloom filter is a compact bit array kept per table. It can say a table definitely lacks a key or might contain it; it never wrongly says absent. As an example, with ten tables and a 1% false-positive rate, a lookup for a key in none of them opens about 0.1 tables on average instead of ten. That rate takes about 10 bits per key, or 1.25 GB for a billion keys. A “maybe” still needs a real lookup, which may find nothing.
Compaction merges files and clears obsolete versions at an I/O cost; if it falls behind, reads touch more files. A read-heavy workload with few updates may do better on a B-tree engine such as InnoDB, which updates pages in place. Watch compaction pressure and disk headroom alongside API latency.
A node acknowledges when a value reaches memory but before its log is durable. Power fails immediately. What happens?
That replica may lose an acknowledged value. Count it toward W only after the durability boundary promised by the API.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Replica acknowledgments need an explicit durability boundary.
- A Bloom filter can prove a key is absent from a table, never that it is present.