Today, we’re announcing the general availability of Couchbase Mobile 2.6. This release comes on the heels of Couchbase Mobile 2.5 which we released in April of this year.
This is the first in a series of focused, purpose-built Couchbase Mobile releases that will allow us to deliver high-priority features in a timely fashion, keeping pace with the agile development needs that mobile developers have come to expect
This release introduces two highly anticipated features – Custom Conflict Resolution with two-way merge on Couchbase Lite and advanced cache management on the Sync Gateway.
Couchbase Mobile extends the power of Couchbase Platform to the edge, securely managing and syncing data, from any cloud to edge devices or directly between edge devices. In this post I discuss the main features in Couchbase Lite and Sync Gateway platforms. In addition to the features discussed here, there are a number of bug fixes and minor enhancements which are discussed in the platform-specific release notes.
Custom Conflict Resolution
In Couchbase Mobile 2.0 we introduced Automatic Conflict Resolution or “Conflict-Free Mode,” wherein conflicts are automatically handled by Couchbase Lite at the time of write, so there are effectively no conflicting document revisions in the Couchbase database. Couchbase Lite applies a default conflict resolution policy to handle conflicts that are either the result of a local write or the result of writes coming in via a replication. With Automatic Conflict Resolution, app developers will never have to worry about unresolved conflicts bloating up their database.
In Couchbase Mobile 2.6, we have enhanced the Automatic Conflict Resolution support by allowing app developers to define their own custom conflict resolution policy that can override the default policy. While the default conflict resolution policies worked for the vast majority of use cases, we recognize that there are use cases where the winner of two conflicting revisions can be determined by business rules that only the app is privy to.
To support this feature, apps must register a conflict resolver/handler function with Couchbase Lite that must select the winner of two conflicting revisions. When the system encounters a conflict, the system calls into the registered conflict resolver/handler function with the conflicting revisions and saves the winning revision returned by the function into the database. As in the case of default conflict resolution policy, there are no conflicts saved to the database.
With this enhancement, Couchbase Mobile offers comprehensive conflict resolution support that is the cornerstone of distributed database systems with sync.
The figure below is a high-level overview of how conflicts are handled in 2.6.