Writes and an extract both use consistency level ONE on Cassandra with replication factor 3 — what can the extract miss?
A write at ONE is acknowledged by one replica; a read at ONE asks one replica, which may not have it yet, so recent rows and deletes can be missing or stale. Reads see every acknowledged write only when R + W > RF: QUORUM on both sides (2 + 2 > 3).
- Believing ONE still copies the write to every replica before acknowledging it
- Adding up R + W = 3 for QUORUM reads over ONE writes and calling it consistent, when it must exceed RF
- Forgetting that a delete is a write too, so a stale replica can return a row that was already deleted
- With two datacenters, what do LOCAL_QUORUM and LOCAL_ONE change for an extract running in the analytics datacenter?
- Which Cassandra mechanisms bring a lagging replica up to date, and which of them can an extract rely on?
What a level means. A consistency level is how many replicas must answer the coordinator for the operation to succeed. The data is still sent to every replica; the level only decides whom to wait for.
| Write (W) | Read (R) | R + W at RF = 3 | What the extract sees |
|---|---|---|---|
| ONE | ONE | 2 | may read a replica without the recent write |
| ONE | QUORUM | 3 | can still miss: 3 is not greater than 3 |
| QUORUM | QUORUM | 4 | every acknowledged write is visible |
| ONE | ALL | 4 | visible, but the read fails if any replica is down |
What it means for an extract.
- A row inserted a minute ago sits on one replica while the extract asked another — the row is missing. Tomorrow's run finds it, and "yesterday's" totals drift.
- A delete is a write too (a tombstone). A lagging replica returns a row that no longer exists.
- Replicas catch up through hinted handoff and read repair, but those are best-effort; only anti-entropy repair is guaranteed to remove the differences.
In practice. Reporting extracts read at LOCAL_QUORUM in the same datacenter where the application writes at least at LOCAL_QUORUM (a separate analytics datacenter receives writes asynchronously, so it gets no such guarantee); if it writes at ONE, a quorum read does not help, and the extract is reconciled against the system of record or taken from CDC instead. It is a concrete case of the CAP/PACELC trade-off: Cassandra lets you choose latency or consistency per request.