Quick revision
The short answer
A LOCAL_ONE write is acknowledged as soon as one local replica has it, and a LOCAL_ONE read asks one replica, which may be a different one that has not received the write yet, so users miss their own updates. If the only replica that had the write dies or restarts before hints or repair copy it to the others, the update can be lost. The fix is LOCAL_QUORUM for both writes and reads where users must read their own writes, set in the driver profile with basic.request.consistency, plus regular repairs, synchronised clocks, and lightweight transactions only for genuinely conditional updates.
What to remember
In this answer, we traced both symptoms to LOCAL_ONE: a write acknowledged by one replica and a read answered by another do not have to overlap, and a write held by a single replica is lost if that replica fails before hints or repair spread it. LOCAL_QUORUM for reads and writes, set as the driver's default with a fast profile for tolerant queries, fixes both for a millisecond or two. Regular repair, synchronised clocks, and LWTs reserved for conditional updates complete the setup.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
A LOCAL_ONE write is acknowledged as soon as one local replica has it, and a LOCAL_ONE read asks one replica, which may be a different one that has not received the write yet, so users miss their own updates. If the only replica that had the write dies or restarts before hints or repair copy it to the others, the update can be lost. The fix is LOCAL_QUORUM for both writes and reads where users must read their own writes, set in the driver profile with basic.request.consistency, plus regular repairs, synchronised clocks, and lightweight transactions only for genuinely conditional updates.
Why this question is asked
LOCAL_ONE is a tempting default: it is the fastest consistency level and almost never fails. The problems it causes are intermittent and hard to reproduce, a refresh that shows old data or an update that vanishes after maintenance, so they are often blamed on caching or the front end. Interviewers ask this scenario to see whether we can connect those symptoms to replica behaviour and fix the configuration without overcorrecting. In this answer, we will see why users miss their own writes, how updates get lost around restarts, fix the driver configuration in Spring Boot, look at repair and clocks, and decide when lightweight transactions are worth their cost.
1Why Users Do Not See Their Own Updates
With a replication factor of 3 in the local data center, every write is sent to all three replicas, but at LOCAL_ONE the coordinator replies to the application after the first acknowledgement. The other two replicas usually get the write within milliseconds, but under load, during GC pauses or while a node is restarting, they can lag.
A read at LOCAL_ONE asks just one replica. The driver's load balancing picks a replica, and nothing makes it pick the one that acknowledged the write. Since LOCAL_ONE plus LOCAL_ONE is 1 + 1 = 2, which is not greater than 3, the read and write replica sets need not overlap, so the read can return the previous value.
8 messages in order. Play them, or step through them one at a time.
One replica acknowledged; a different one answered the read.
So the symptom, I saved my address and after refreshing the old one is back, is exactly what the configuration allows. It happens rarely because most of the time all replicas are up to date, which is why it seems random.
2How Updates Get Lost After Restarts
The second symptom is worse. Suppose r1 acknowledged the write, r2 and r3 were slow or briefly down, and then r1 is restarted. Cassandra writes to the commit log before acknowledging, but with the default periodic commitlog_sync, the commit log is fsynced to disk only every 10 seconds, so a machine crash or power loss can lose the most recent acknowledged writes on that node.
Normally the other replicas would save us. If they were down, the coordinator keeps a hint and replays it when they return, but hints are kept only for max_hint_window, three hours by default, and they live on the coordinator, which may itself restart. If the write existed on one replica only and that replica lost it, nothing remains anywhere. At LOCAL_ONE the application was told the write succeeded when only one copy existed, so a single failure loses it.
3Fixing the Consistency Level in the Driver
The fix is to require a majority of local replicas on both sides. With LOCAL_QUORUM for writes and reads, W = 2 and R = 2, so 2 + 2 > 3 and every read overlaps every successful write. And an acknowledged write exists on two replicas, so a single node failure cannot lose it. With the DataStax Java driver 4.x, the cleanest place is the driver configuration file, with a separate profile for the few queries that can stay fast.
| Write / read | R + W > 3? | Own writes visible | Survives one node loss |
|---|---|---|---|
LOCAL_ONE / LOCAL_ONE | No (2) | Not guaranteed | No, write may be on 1 node |
LOCAL_QUORUM / LOCAL_ONE | No (3) | Not guaranteed | Yes |
LOCAL_QUORUM / LOCAL_QUORUM | Yes (4) | Yes | Yes |
In Spring Boot with Spring Data Cassandra, spring.cassandra.request.consistency can set the same default, and individual statements can override it with setConsistencyLevel or setExecutionProfileName("analytics-fast"). Check the property names for your Boot version.
The cost is modest: LOCAL_QUORUM waits for the second-fastest of three local replicas instead of the fastest, which typically adds a millisecond or two, and it tolerates one local replica being down. We keep LOCAL_ONE only for data where staleness is acceptable, such as view counts.
4Repairs and Clocks
Consistency levels decide what one request sees; repair decides whether replicas eventually agree. Anti-entropy repair, run with nodetool repair or scheduled by a tool such as Cassandra Reaper, compares data between replicas and streams the differences. It should run on every table at least once within gc_grace_seconds, ten days by default, otherwise deleted data can reappear. Incremental repair, the default in recent versions, makes regular runs cheaper.
Clocks matter because Cassandra resolves conflicting values per cell by timestamp, last write wins. If one application server's clock runs 500 ms ahead, its writes win over later writes from other servers. So all servers, application and database, run NTP or chrony, and we alert on clock offset. Server-side timestamps, generated by the driver's timestamp generator on one host, do not remove the problem across hosts.
5When to Use Lightweight Transactions
Sometimes the requirement is not read your own writes but only update if, for example change the status from PENDING to PAID only if it is still PENDING, or register a username only if it does not exist. Quorum reads and writes do not make read-then-write safe, because two clients can both read PENDING and both write. Lightweight transactions (LWT) solve this.
An LWT runs a Paxos round among the replicas at SERIAL or LOCAL_SERIAL consistency, so only one conditional update wins. It costs about four round trips instead of one, and contention on one partition makes it slower, so we use it only where the condition matters, not as a general fix for consistency.
6Follow-up questions
Would LOCAL_QUORUM writes with LOCAL_ONE reads be enough?
It fixes the lost updates, because every acknowledged write is on two replicas, but not the stale reads: 2 + 1 = 3 is not greater than 3, so a read can still hit the one replica that has not got the write yet. For users who must see their own changes, reads need LOCAL_QUORUM too.
How would you verify the fix?
In staging with a three-node cluster, write at the new level, pause one node with a signal or network rule, and check that reads still return the new value and that killing the acknowledging node loses nothing. In production, track the driver's per-level latency and error metrics after the change, and watch user reports of stale data.
7Conclusion
In this answer, we traced both symptoms to LOCAL_ONE: a write acknowledged by one replica and a read answered by another do not have to overlap, and a write held by a single replica is lost if that replica fails before hints or repair spread it. LOCAL_QUORUM for reads and writes, set as the driver's default with a fast profile for tolerant queries, fixes both for a millisecond or two. Regular repair, synchronised clocks, and LWTs reserved for conditional updates complete the setup.
Open with
Both symptoms come from LOCAL_ONE. With RF 3, the write is sent to all three local replicas, but the coordinator acknowledges after the first one. A LOCAL_ONE read then asks a single replica, possibly a different one that has not received the write yet, and since one plus one is not greater than three, nothing guarantees overlap, so users sometimes see old data after a refresh.
Then, if they want more
The lost updates happen when the only replica that had the write restarts or crashes before the others get it: hints only last three hours and live on the coordinator, and the commit log is synced periodically, so an acknowledged write that existed on one node can disappear.
The fix is LOCAL_QUORUM for both writes and reads wherever users must read their own writes: two plus two is greater than three, and every acknowledged write is on two replicas. I would set it as the default in the driver's application.conf with basic.request.consistency, and keep a LOCAL_ONE profile for reads where staleness is fine.
The extra latency is usually a millisecond or two. I would also make sure repairs run regularly, through Reaper or nodetool repair within gc_grace_seconds, and that clocks are synchronised with NTP because conflicts are last write wins.
For conditional updates, like changing a status only if it is still pending, I would use lightweight transactions with IF, accepting their extra round trips.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Cassandra documentation, Amazon DynamoDB developer guide
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "A Spring Boot service using the DataStax Java driver writes with LOCAL_ONE for speed....": https://scrivio-interview-library.netlify.app/databases/cassandra-and-dynamodb/796e2e5ede/