cockroachdb / cockroachdb/cockroach
logical: improve lww tie handling
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Logical Data Replication (LDR) uses last-write-wins (LWW) conflict resolution. When two writes have exactly the same HLC timestamp and primary key, the local write wins on each side. This means the two clusters diverge — each retains its own version of the row with no mechanism to detect or repair the inconsistency.
HLC timestamp ties are unlikely but possible. We thinks this is unlikely to crop up in production because it requires writing conflicting values for the same primary at the same nanosecond.
LDR should apply a deterministic tiebreaker by comparing the row data itself, so that both clusters converge to the same value when timestamps are equal.
Jira issue: CRDB-62991
Contributor guide
Research direction
Start by tracing Logical Data Replication's last-write-wins conflict resolution and the handling of equal HLC timestamps for identical primary keys. Verify how row values are available for comparison and identify the relevant replication tests. Done means both clusters choose the same row value for an equal-timestamp conflict and the behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100