Company
Date Published
Author
Arunkumar Senthilnathan, Sr Software Engineer, Couchbase
Word count
1711
Language
English
Hacker News points
None

Summary

Couchbase's Cross Datacenter Replication (XDCR) feature aids in disaster recovery and data locality by providing two conflict resolution strategies: revision ID-based and timestamp-based. The revision ID-based strategy, suitable for applications following a "Most updates is best" policy, uses a document's revision ID to resolve conflicts. Conversely, timestamp-based conflict resolution, introduced in version 4.6, is tailored for applications that prioritize the "Most recent update is best" approach, utilizing a hybrid logical clock to maintain consistent mutation ordering. Choosing the appropriate strategy is crucial, as it is a bucket-level parameter that cannot be changed post-creation, and both source and destination buckets in an XDCR setup must share the same strategy. Timestamp-based resolution requires synchronized clocks, typically achieved using NTP, to function accurately, as time skew can lead to incorrect outcomes. Testing the timestamp-based approach involves validating its effectiveness against revision ID-based resolution and ensuring the monotonicity and correctness of the hybrid logical clock.