I’m testing out Couchbase Mobile + Sync Gateway
Platform: Android 4.0.2 (Kotlin)
Sync Gateway: 4.0.2 enterprise
Couchbase Server: 8.0.0 enterprise
Reproduction: GitHub - ludydoo/tmp-couchbase-mobile-sync-repro (with screen recordings)
I am testing a custom “conflictResolver”, which is able to merge 2 conflicting documents.
The scenario:
Three devices (“dev1”, “dev2”, “dev3”) are connected to Sync Gateway and operating on the same document (“order1”).
Scenario
-
All devices are online. dev1 adds an item to the order — the document syncs correctly to all devices.
-
dev2 and dev3 go offline.
-
dev2 and dev3 independently modify
order1 -
dev2 comes back online; its changes sync correctly to dev1 and dev2.
-
dev3 comes back online. It receives some changes, but its local state diverges from dev1/dev2. dev2’s replicator’ documentReplicationListener sees an event with error “Invalid version string ‘188ed2b0d61b0000@A6KKjWppSKeo4akbAL5J7w, 188ed2abfb620000@A6KKjWppSKeo4akbAL5J7w,188ed2abc7e20000@m4XlarW6S4Ceb6kua70JwA;’”.
Observed outcomes
-
If dev3 then performs the next mutation, the document eventually converges across all devices. But there is an inconsistent state before the mutation.
-
If dev1 or dev2 performs a mutation after dev3 comes online, the document never converges again — all devices remain in divergent states.
Desired outcome:
- Documents should converge across all devices when online
Am I doing something wrong?