Resolving conflicts with the REST APIs

103 views
Skip to first unread message

Bart Arribe

unread,
Apr 4, 2014, 1:08:43 PM4/4/14
to mobile-c...@googlegroups.com
Hi,

I have been working on resolving conflicts but from so far, I think I'm missing one step.

I'm currently running the Phonegap plugin on my devices with the Sync Gateway and the Couchbase Server.
I would like to manage the conflicts from the device.

I can do a GET with the "_changes" feed and the  “?style=all_docs” query parameter to retrieve all the docs with the conflicts as Jens is saying in this thread. Then, I can delete the revisions I don't want anymore making a PUT with the "_deleted" parameter to true like this:

window.config.site.db.get([id, {"rev" : rev}], function(err, doc){
doc._deleted = true;
window.config.site.db.put([id, {"rev" : rev}], doc, function(){})
});


But on the sync gateway and my other device, i have still the conflicts, so I guess there is something wrong or missing in what I am doing. Any idea ?

I don't know if I give you enough information about my code so please, ask me if you need some more.


Thank you

Regards,
Bart

Bart Arribe

unread,
Apr 7, 2014, 6:59:28 AM4/7/14
to mobile-c...@googlegroups.com
Hi all,

Some more information about my problem and some logs.

I have a conflict as you can see 


{"lastName":"self","login":"peanut123","username":"arribbar","firstName":"of","type":"customer","_rev":"2-e3b45fed-ed43-4c18-a45e-b31d54ca74a2","_id":"90a80a29-6821-4f7c-9ef1-750ea428d018","_conflicts":["2-a18e2232-c7f1-436f-8354-37c5ee20436f"]}


{"results":[
{"seq":1,"id":"29b2f39f-2562-4a1c-91fc-903a0ab519c9","changes":[{"rev":"1-f390767e-48bc-4c3b-bdca-0cea827cf8cb"}]}
,{"seq":3,"id":"192f8899-ad0f-4d49-a468-ac25dfc372cc","changes":[{"rev":"1-65a4c504-bf99-495f-96e2-ff4d1b6166c1"}]}
,{"seq":6,"id":"4601efb2-b8ec-4ba5-90fe-d694c499997b","changes":[{"rev":"1-053602fb-e2d9-4492-a196-bcabbbd62ad8"}]}
,{"seq":9,"id":"6ce261a4-0ba7-4831-94f0-00bcc0283aa9","changes":[{"rev":"2-daf5e9b5-c142-4022-a5dd-50e6ebeb0d57"},{"rev":"2-7cc452f7-5c34-4a04-aded-4ab9a8948836"}]}
,{"seq":10,"id":"90a80a29-6821-4f7c-9ef1-750ea428d018","changes":[{"rev":"2-e3b45fed-ed43-4c18-a45e-b31d54ca74a2"},{"rev":"2-a18e2232-c7f1-436f-8354-37c5ee20436f"}]}
,{"seq":11,"id":"d922fa79-b19a-4ae3-8dab-d4d09073faf0","changes":[{"rev":"1-528f8063-9682-4e4b-b494-2d90addfb3bc"}]}
,{"seq":12,"id":"241b370d-b910-4880-895c-d8f25ebe619a","changes":[{"rev":"2-11b8bf91-6509-4a81-a45d-8799096fd62a"}]}
],
"last_seq":12}

When i delete 1 revision from a document in order to resolve the conflict, I do a DELETE (well, I hope) on the revision I don't want anymore.

window.config.site.db.get([id, {"rev" : rev}], function(err, doc){
doc._deleted = true;
window.config.site.db.put([id, {"rev" : rev}], doc, function(){})
});

and then, I am doing a PUT with the other revision I want to keep

window.config.site.db.get([id, {"rev" : revToKeep}], function(err, doc){
window.config.site.db.put([id, {"rev" : revToKeep}], doc, function(){})
});


When i delete 1 revision from a document in order to resolve the conflict


#118: POST /customers/_revs_diff  (as arribbar)
#119: POST /customers/_bulk_docs  (as arribbar)
#120: PUT /customers/_local/85e09fc37b291404d2679a16f0555376f628ce31  (as arribbar)
11:42:56.355154 WARNING: changeCache: Giving up, accepting #17 even though #16 is missing -- db.(*changeCache)._addPendingLogs() at change_cache.go:279
#121: GET /customers/_changes?feed=longpoll&limit=50&heartbeat=300000&since=17  (as arribbar)
#122: GET /customers/_changes?feed=longpoll&limit=50&heartbeat=300000&since=17  (as arribbar)
#123: GET /customers/_changes?feed=longpoll&limit=50&heartbeat=300000&since=17  (as arribbar)
#124: GET /customers/90a80a29-6821-4f7c-9ef1-750ea428d018?rev=3-e904fe96-bccb-4b71-9538-0c54c7f9af34&revs=true&attachments=true&atts_since=%5B%222-e3b45fed-ed43-4c18-a45e-b31d54ca74a2%22%2C%222-a18e2232-c7f1-436f-8354-37c5ee20436f%22%5D  (as arribbar)
#125: GET /customers/90a80a29-6821-4f7c-9ef1-750ea428d018?rev=3-e904fe96-bccb-4b71-9538-0c54c7f9af34&revs=true&attachments=true&atts_since=%5B%222-e3b45fed-ed43-4c18-a45e-b31d54ca74a2%22%2C%222-a18e2232-c7f1-436f-8354-37c5ee20436f%22%5D  (as arribbar)
#126: PUT /customers/_local/b63e4c8d2b4fe6101cd9533cebd8890e669fda33  (as arribbar)
#127: PUT /customers/_local/0681b7beb55d63f1329e9a27c601c66f5304d4cc  (as arribbar)


Well, after that, the revisions are just updated

{"lastName":"self","login":"peanut123","username":"arribbar","firstName":"of","type":"customer","_rev":"3-e904fe96-bccb-4b71-9538-0c54c7f9af34","_id":"90a80a29-6821-4f7c-9ef1-750ea428d018","_conflicts":["3-24fb86f8-8d5e-497b-b032-0e8d46485c75"]}

And it's the same on the sync gateway

So, as you can see, I'm resolving the conflict unfortunately. Any idea about what i am missing ?

Thank you 
Regards

Jens Alfke

unread,
Apr 7, 2014, 12:25:19 PM4/7/14
to mobile-c...@googlegroups.com
Please include the exact versions of both Sync Gateway and Couchbase Lite (including platform). From the logs it looks like you’ve got SG beta 3, but if you’re on iOS you’ve still got CBL beta 2.

Actually, please update to SG beta 3.1 — it fixed some really critical bugs with the change-cache, and your log includes a suspicious warning from that cache. (Is that warning repeatable?)

After that, if the bug persists, please file an issue on Github and we can dive in. :)

Actually one thing I noticed: I’m not too familiar with the JS APIs, but it looks like you’re deleting a document by adding a “_deleted”:true property to it. This is valid, but it will preserve all the other properties of the document too, which may not be what you want. The easiest way to delete is to use the DELETE method. Or you can do a PUT as you’re doing, but with a JSON body containing only the _deleted and _rev properties.

—Jens

Bart Arribe

unread,
Apr 8, 2014, 11:19:12 AM4/8/14
to mobile-c...@googlegroups.com
Hi Jens,

Thank you for your answer.


Le lundi 7 avril 2014 17:25:19 UTC+1, Jens Alfke a écrit :
Please include the exact versions of both Sync Gateway and Couchbase Lite (including platform). From the logs it looks like you’ve got SG beta 3, but if you’re on iOS you’ve still got CBL beta 2.

Actually, please update to SG beta 3.1 — it fixed some really critical bugs with the change-cache, and your log includes a suspicious warning from that cache. (Is that warning repeatable?)
I was using SG 3.0 and is now updated thanks to you. For Couchbase Lite, I'm using the phonegap plugin and running my example on android devices. It seems to be the version 0.2.0 and so, the latest version according to Github.

By the way, it seems the link to go to the download page on Couchbase website is not working anymore.

For the warning, I still have it but I'm not sure it's repeatable. The steps I follow from the start using Android devices.
1.Create a document and replicate it on the other.
2.Stop the connection from one device and make the conflict by updating the document on both devices
3.Connect again the device. You may need to "resume" the app, to have both revisions replicated ob both devices.
4.Delete one revision and make a put on the other one as I described above like this :

window.config.site.db.get([id, {"rev" : rev}], function(err, doc){
doc._deleted = true;
window.config.site.db.put([id, {"rev" : rev}], doc, function(){})
});

and then, I am doing a PUT with the other revision I want to keep

window.config.site.db.get([id, {"rev" : revToKeep}], function(err, doc){
window.config.site.db.put([id, {"rev" : revToKeep}], doc, function(){})
});

5.You should have the warning. If not, you may need to resume the app. 
***I don't know if I am very clear when i say "resume the app" ^^ . Basically, it's just going to the home page and then come back to the app.

After that, if the bug persists, please file an issue on Github and we can dive in. :)

If you think I should file an issue for that, just tell me and I'll do it. 

Actually one thing I noticed: I’m not too familiar with the JS APIs, but it looks like you’re deleting a document by adding a “_deleted”:true property to it. This is valid, but it will preserve all the other properties of the document too, which may not be what you want. The easiest way to delete is to use the DELETE method. Or you can do a PUT as you’re doing, but with a JSON body containing only the _deleted and _rev properties.

I would like to use the DELETE method but actually, I can't find out how to use it in the JS APIs. Do you have any documentation or just any idea how to do it ?



—Jens


Regards,

Bart 

Bart Arribe

unread,
May 1, 2014, 10:05:59 AM5/1/14
to mobile-c...@googlegroups.com
Hi all,

I keep trying to resolve properly a conflict but there is still something missing... I have several problems actually between replicating the conflict, deleting the revision and then replicate the resolution.

According to Traun, I'm currently using the beta2 version of couchbase-lite android and I'm still working with the plugin phonegap on android devices. I'm using as well the SG beta 3.1.



1. Replication of the conflicts
In order to replicate a conflict, I switch off the wifi on one of my device, change a document in both devices, quit the app and start again the app with the wifi on.
Here, I have a result I couldn't reproduce, sometimes, I have the two revisions on one device or on the other one, sometimes on both devices. I wanted what is the right behavior when there is a conflict? Replicating the two revisions on all the devices? Is the sync gateway supposed to detect the conflict as well?

I can give you the different logs I have if you need it.

2. Deleting properly a revision to resolve a conflict
I tried two solutions for the resolution. 
  • Just call the DELETE method, 

window.config.site.db.get([id, {"rev" : revToDel}], function(err, doc){
window.config.site.db.del([id, {"rev" : revToDel}], doc, function(){
console.log("APP - deleteRevision - DEL on the revision");
}); 
});

In this case, if I do a PUT on a other document after that, I got an error with the DOM :

05-01 14:09:25.324: I/Web Console(30145): APP - save_button clicked - GET - the previous revision of the document  at file:///android_asset/www/js/index.js:123
05-01 14:09:25.356: D/CordovaLog(30145): file:///android_asset/www/js/modules.js: Line 1118 : Uncaught Error: INVALID_STATE_ERR: DOM Exception 11
05-01 14:09:25.356: E/Web Console(30145): Uncaught Error: INVALID_STATE_ERR: DOM Exception 11 at file:///android_asset/www/js/modules.js:1118

The logs of sync gateway

 #032: POST /customers/_bulk_docs  (as bobby)
11:25:14.563320 CRUD+: Invoking sync on doc "36384a1c-aee1-4c5e-a45a-62e3f22b7f37" rev 2-c6acb9fd-d0cc-469d-b37d-5dd2ae0150ab
11:25:14.563947 CRUD+: Saving old revision "36384a1c-aee1-4c5e-a45a-62e3f22b7f37" / "1-5bdde52d-8f82-4dc4-ad26-deb11fba4042" (118 bytes)
11:25:14.662745 CRUD+: Backed up obsolete rev "36384a1c-aee1-4c5e-a45a-62e3f22b7f37"/"1-5bdde52d-8f82-4dc4-ad26-deb11fba4042"
11:25:14.664170 CRUD: Stored doc "36384a1c-aee1-4c5e-a45a-62e3f22b7f37" / "2-c6acb9fd-d0cc-469d-b37d-5dd2ae0150ab"
11:25:14.836793 Changes+: Notifying that "customers" changed (keys="{*, customer-36384a1c-aee1-4c5e-a45a-62e3f22b7f37}") count=5
11:25:14.836929 Changes+: MultiChangesFeed: channels expand to customer-36384a1c-aee1-4c5e-a45a-62e3f22b7f37:14,customer-68f3c008-d0e3-4b10-a758-0f48ed7a1fb5:3,customer-ca6be801-de14-43a4-a2b1-bb89375ecd6b:4,customer-cf32107b-4b7c-47f6-a04d-1011b3644ffe:9,registration:1 ...
11:25:14.836955 Changes+: MultiChangesFeed: channels expand to customer-36384a1c-aee1-4c5e-a45a-62e3f22b7f37:14,customer-68f3c008-d0e3-4b10-a758-0f48ed7a1fb5:3,customer-ca6be801-de14-43a4-a2b1-bb89375ecd6b:4,customer-cf32107b-4b7c-47f6-a04d-1011b3644ffe:9,registration:1 ...
11:25:14.837153 Changes+: MultiChangesFeed sending &{Seq:17 ID:36384a1c-aee1-4c5e-a45a-62e3f22b7f37 Deleted:false Removed:{} Doc:map[] Changes:[map[rev:2-c6acb9fd-d0cc-469d-b37d-5dd2ae0150ab]] branched:false}
11:25:14.837191 Changes: MultiChangesFeed done
11:25:14.837163 Changes+: MultiChangesFeed sending &{Seq:17 ID:36384a1c-aee1-4c5e-a45a-62e3f22b7f37 Deleted:false Removed:{} Doc:map[] Changes:[map[rev:2-c6acb9fd-d0cc-469d-b37d-5dd2ae0150ab]] branched:false}
11:25:14.837221 Changes: MultiChangesFeed done
11:25:14.852611 HTTP:  #033: GET /customers/_changes?feed=longpoll&limit=50&heartbeat=300000&since=17  (as bobby)
11:25:14.852763 Changes: MultiChangesFeed({*}, {Since:17 Limit:50 Conflicts:false IncludeDocs:false Wait:true Continuous:false Terminator:0xc2106f1360}) ...
11:25:14.852876 Changes+: MultiChangesFeed: channels expand to customer-36384a1c-aee1-4c5e-a45a-62e3f22b7f37:14,customer-68f3c008-d0e3-4b10-a758-0f48ed7a1fb5:3,customer-ca6be801-de14-43a4-a2b1-bb89375ecd6b:4,customer-cf32107b-4b7c-47f6-a04d-1011b3644ffe:9,registration:1 ...
11:25:14.852929 Changes+: MultiChangesFeed waiting...
11:25:14.852948 Changes+: Waiting for "customers"'s count to pass 5
11:25:16.959270 HTTP:  #034: PUT /customers/_local/79cb0645918093ebc4a5757f6ef85840900fdf36  (as bobby)
11:25:17.389754 HTTP:  #035: PUT /customers/_local/c5e52b661a5fbf9492ef215a26d86e32d8a870a9  (as bobby)
11:26:12.686228 HTTP:  #036: GET /customers/_local/741660d110bcb23df30c6f948c40cdd8c39989d3  (as bobby)
11:26:12.768899 HTTP:  #037: POST /customers/_revs_diff  (as bobby)
11:26:12.925801 HTTP:  #038: POST /customers/_bulk_docs  (as bobby)
11:26:12.927017 CRUD+: Invoking sync on doc "36384a1c-aee1-4c5e-a45a-62e3f22b7f37" rev 2-bf03a689-f3aa-4460-9a07-7422489451ba
11:26:12.927258 CRUD+: Got old revision "36384a1c-aee1-4c5e-a45a-62e3f22b7f37" / "1-5bdde52d-8f82-4dc4-ad26-deb11fba4042" --> 118 bytes
11:26:12.927814 CRUD+: updateDoc("36384a1c-aee1-4c5e-a45a-62e3f22b7f37"): Rev "2-bf03a689-f3aa-4460-9a07-7422489451ba" leaves "2-c6acb9fd-d0cc-469d-b37d-5dd2ae0150ab" still current
11:26:12.928234 CRUD: Stored doc "36384a1c-aee1-4c5e-a45a-62e3f22b7f37" / "2-bf03a689-f3aa-4460-9a07-7422489451ba"
11:26:13.029974 HTTP:  #039: GET /customers/_local/946c35e0790a2abb8c559a0bc25c29e743bd2b50  (as bobby)
11:26:13.079063 HTTP:  #040: GET /customers/_changes?feed=longpoll&limit=50&heartbeat=300000&since=16  (as bobby)
11:26:13.079144 Changes: MultiChangesFeed({*}, {Since:16 Limit:50 Conflicts:false IncludeDocs:false Wait:true Continuous:false Terminator:0xc2103357e0}) ...
11:26:13.079200 Changes+: MultiChangesFeed: channels expand to customer-36384a1c-aee1-4c5e-a45a-62e3f22b7f37:14,customer-68f3c008-d0e3-4b10-a758-0f48ed7a1fb5:3,customer-ca6be801-de14-43a4-a2b1-bb89375ecd6b:4,customer-cf32107b-4b7c-47f6-a04d-1011b3644ffe:9,registration:1 ...
11:26:13.079275 Changes+: MultiChangesFeed sending &{Seq:17 ID:36384a1c-aee1-4c5e-a45a-62e3f22b7f37 Deleted:false Removed:{} Doc:map[] Changes:[map[rev:2-c6acb9fd-d0cc-469d-b37d-5dd2ae0150ab]] branched:false}
11:26:13.079289 Changes: MultiChangesFeed done
11:26:13.081617 Changes+: Notifying that "customers" changed (keys="{*, customer-36384a1c-aee1-4c5e-a45a-62e3f22b7f37}") count=6
11:26:13.081660 Changes+: MultiChangesFeed: channels expand to customer-36384a1c-aee1-4c5e-a45a-62e3f22b7f37:14,customer-68f3c008-d0e3-4b10-a758-0f48ed7a1fb5:3,customer-ca6be801-de14-43a4-a2b1-bb89375ecd6b:4,customer-cf32107b-4b7c-47f6-a04d-1011b3644ffe:9,registration:1 ...
11:26:13.081721 Changes+: MultiChangesFeed sending &{Seq:18 ID:36384a1c-aee1-4c5e-a45a-62e3f22b7f37 Deleted:false Removed:{} Doc:map[] Changes:[map[rev:2-c6acb9fd-d0cc-469d-b37d-5dd2ae0150ab]] branched:true}
11:26:13.081736 Changes: MultiChangesFeed done
11:26:13.104072 HTTP:  #041: GET /customers/_changes?feed=longpoll&limit=50&heartbeat=300000&since=18  (as bobby)
11:26:13.104161 Changes: MultiChangesFeed({*}, {Since:18 Limit:50 Conflicts:false IncludeDocs:false Wait:true Continuous:false Terminator:0xc2103359c0}) ...
11:26:13.104220 Changes+: MultiChangesFeed: channels expand to customer-36384a1c-aee1-4c5e-a45a-62e3f22b7f37:14,customer-68f3c008-d0e3-4b10-a758-0f48ed7a1fb5:3,customer-ca6be801-de14-43a4-a2b1-bb89375ecd6b:4,customer-cf32107b-4b7c-47f6-a04d-1011b3644ffe:9,registration:1 ...
11:26:13.104249 Changes+: MultiChangesFeed waiting...
11:26:13.104260 Changes+: Waiting for "customers"'s count to pass 6
11:26:13.132722 HTTP:  #042: GET /customers/_changes?feed=longpoll&limit=50&heartbeat=300000&since=17  (as bobby)
11:26:13.132874 Changes: MultiChangesFeed({*}, {Since:17 Limit:50 Conflicts:false IncludeDocs:false Wait:true Continuous:false Terminator:0xc210335ba0}) ...
11:26:13.132990 Changes+: MultiChangesFeed: channels expand to customer-36384a1c-aee1-4c5e-a45a-62e3f22b7f37:14,customer-68f3c008-d0e3-4b10-a758-0f48ed7a1fb5:3,customer-ca6be801-de14-43a4-a2b1-bb89375ecd6b:4,customer-cf32107b-4b7c-47f6-a04d-1011b3644ffe:9,registration:1 ...
11:26:13.133119 Changes+: MultiChangesFeed sending &{Seq:18 ID:36384a1c-aee1-4c5e-a45a-62e3f22b7f37 Deleted:false Removed:{} Doc:map[] Changes:[map[rev:2-c6acb9fd-d0cc-469d-b37d-5dd2ae0150ab]] branched:true}
11:26:13.133145 Changes: MultiChangesFeed done
11:26:13.171421 HTTP:  #043: GET /customers/_changes?feed=longpoll&limit=50&heartbeat=300000&since=18  (as bobby)


  • Or call the DELETE method on the revision to delete and make a PUT to the other one
window.config.site.db.get([id, {"rev" : revToDel}], function(err, doc){
window.config.site.db.del([id, {"rev" : revToDel}], doc, function(){
console.log("APP - deleteRevision - DEL on the revision");
}); 
});
window.config.site.db.get([id, {"rev" : revToKeep}], function(err, doc){
window.config.site.db.put([id, {"rev" : revToKeep}], doc, function(){
console.log("APP - deleteRevision - PUT on the revision to keep");
})
});
In this case, I have a warning. I'm guessing it's because I'm trying to make two changes of the same document at the same moment ... It's the same warning that in my previous post. It seems to happen every-time I try to make a change on the same document at the moment(doing so as well when I'm doing it with two devices). 

The logs of sync gateway :
13:46:46.395676 HTTP:  #110: POST /customers/_revs_diff  (as bobby)
13:46:46.413924 HTTP:  #111: POST /customers/_bulk_docs  (as bobby)
13:46:46.414691 CRUD+: Invoking sync on doc "c82ac2b7-48a6-4b01-b245-0a4ae92fe238" rev 3-812efb33-554b-4eb7-8c91-fa0217de6180
13:46:46.414905 CRUD+: Saving old revision "c82ac2b7-48a6-4b01-b245-0a4ae92fe238" / "2-deabf2cd-3a6b-4196-babb-18558f2e38ea" (111 bytes)
13:46:46.415096 CRUD+: Backed up obsolete rev "c82ac2b7-48a6-4b01-b245-0a4ae92fe238"/"2-deabf2cd-3a6b-4196-babb-18558f2e38ea"
13:46:46.415135 CRUD+: updateDoc("c82ac2b7-48a6-4b01-b245-0a4ae92fe238"): Rev "3-812efb33-554b-4eb7-8c91-fa0217de6180" causes "2-9df54dcc-285c-43c7-92a8-e01f4fab1d15" to become current again
13:46:46.415147 CRUD+: Invoking sync on doc "c82ac2b7-48a6-4b01-b245-0a4ae92fe238" rev 2-9df54dcc-285c-43c7-92a8-e01f4fab1d15
13:46:46.415292 CRUD+: Got old revision "c82ac2b7-48a6-4b01-b245-0a4ae92fe238" / "1-39f0b380-58f0-4a8e-9236-d7f0549515da" --> 108 bytes
13:46:46.416038 CRUD: Stored doc "c82ac2b7-48a6-4b01-b245-0a4ae92fe238" / "3-812efb33-554b-4eb7-8c91-fa0217de6180"
13:46:46.416568 CRUD+: Invoking sync on doc "c82ac2b7-48a6-4b01-b245-0a4ae92fe238" rev 3-f00858a0-4743-4848-95f3-65ae9c279efa
13:46:46.416998 CRUD+: Saving old revision "c82ac2b7-48a6-4b01-b245-0a4ae92fe238" / "2-9df54dcc-285c-43c7-92a8-e01f4fab1d15" (204 bytes)
13:46:46.417189 CRUD+: Backed up obsolete rev "c82ac2b7-48a6-4b01-b245-0a4ae92fe238"/"2-9df54dcc-285c-43c7-92a8-e01f4fab1d15"
13:46:46.417504 CRUD: Stored doc "c82ac2b7-48a6-4b01-b245-0a4ae92fe238" / "3-f00858a0-4743-4848-95f3-65ae9c279efa"
13:46:48.652672 HTTP:  #112: PUT /customers/_local/5517bfde57beaf831c0798d96021dabc4ade66bb  (as bobby)
13:46:53.094326 WARNING: changeCache: Giving up, accepting #15 even though #14 is missing -- db.(*changeCache)._addPendingLogs() at change_cache.go:279
13:46:53.094509 Changes+: Notifying that "customers" changed (keys="{*, customer-c82ac2b7-48a6-4b01-b245-0a4ae92fe238}") count=27
13:46:53.094649 Changes+: MultiChangesFeed: channels expand to customer-0c4f9f24-37c6-403f-9713-f16ed50a103b:9,customer-2511038a-3574-488f-a469-c67c8e56049e:2,customer-8c394497-bcd9-43c6-bac2-2a9a0b31d3fb:8,customer-c82ac2b7-48a6-4b01-b245-0a4ae92fe238:3,registration:1 ...
13:46:53.094709 Changes+: MultiChangesFeed: channels expand to customer-0c4f9f24-37c6-403f-9713-f16ed50a103b:9,customer-2511038a-3574-488f-a469-c67c8e56049e:2,customer-8c394497-bcd9-43c6-bac2-2a9a0b31d3fb:8,customer-c82ac2b7-48a6-4b01-b245-0a4ae92fe238:3,registration:1 ...
13:46:53.094879 Changes+: MultiChangesFeed sending &{Seq:15 ID:c82ac2b7-48a6-4b01-b245-0a4ae92fe238 Deleted:false Removed:{} Doc:map[] Changes:[map[rev:3-f00858a0-4743-4848-95f3-65ae9c279efa]] branched:true}
13:46:53.094946 Changes: MultiChangesFeed done
13:46:53.094907 Changes+: MultiChangesFeed sending &{Seq:15 ID:c82ac2b7-48a6-4b01-b245-0a4ae92fe238 Deleted:false Removed:{} Doc:map[] Changes:[map[rev:3-f00858a0-4743-4848-95f3-65ae9c279efa]] branched:true}
13:46:53.095045 Changes: MultiChangesFeed done
13:46:53.129466 HTTP:  #114: GET /customers/_changes?feed=longpoll&limit=50&heartbeat=300000&since=15  (as bobby)
13:46:53.129628 Changes: MultiChangesFeed({*}, {Since:15 Limit:50 Conflicts:false IncludeDocs:false Wait:true Continuous:false Terminator:0xc210446ae0}) ...
13:46:53.129729 HTTP:  #113: GET /customers/_changes?feed=longpoll&limit=50&heartbeat=300000&since=15  (as bobby)
13:46:53.129848 Changes+: MultiChangesFeed: channels expand to customer-0c4f9f24-37c6-403f-9713-f16ed50a103b:9,customer-2511038a-3574-488f-a469-c67c8e56049e:2,customer-8c394497-bcd9-43c6-bac2-2a9a0b31d3fb:8,customer-c82ac2b7-48a6-4b01-b245-0a4ae92fe238:3,registration:1 ...
13:46:53.129866 Changes: MultiChangesFeed({*}, {Since:15 Limit:50 Conflicts:false IncludeDocs:false Wait:true Continuous:false Terminator:0xc2102e9240}) ...
13:46:53.129909 Changes+: MultiChangesFeed waiting...
13:46:53.129935 Changes+: Waiting for "customers"'s count to pass 27
13:46:53.130005 Changes+: MultiChangesFeed: channels expand to customer-0c4f9f24-37c6-403f-9713-f16ed50a103b:9,customer-2511038a-3574-488f-a469-c67c8e56049e:2,customer-8c394497-bcd9-43c6-bac2-2a9a0b31d3fb:8,customer-c82ac2b7-48a6-4b01-b245-0a4ae92fe238:3,registration:1 ...
13:46:53.130221 Changes+: MultiChangesFeed waiting...
13:46:53.130251 Changes+: Waiting for "customers"'s count to pass 27
13:46:54.583291 HTTP:  #115: GET /customers/c82ac2b7-48a6-4b01-b245-0a4ae92fe238?rev=3-f00858a0-4743-4848-95f3-65ae9c279efa&revs=true&attachments=true&atts_since=%5B%222-9df54dcc-285c-43c7-92a8-e01f4fab1d15%22%2C%222-deabf2cd-3a6b-4196-babb-18558f2e38ea%22%5D  (as bobby)
13:46:56.023330 HTTP:  #116: PUT /customers/_local/a3dfa87aacec2a0e28c0613afe7d082426ee611a  (as bobby)
13:46:58.685446 HTTP:  #117: PUT /customers/_local/f9001f8c207ea5ba976bd2316d95d7b53566d680  (as bobby)


3.Replicating the resolution of the conflict
In both case, I can see the revision deleted on sync gateway but the resolution is not replicated to the other device. Moreover, if this device didn't have the two revisions, the second revision is replicating without any resolution ... 

We can see the change made in the sync gateway with the revision deleted below but the resolution isn't replicated on the other device.
"seq":21,"id":"2511038a-3574-488f-a469-c67c8e56049e","changes":[{"rev":"2-468e52b9-ecd7-4213-8f67-51992fdf0173"},{"rev":"3-0b21e6d6-77bc-4cac-bdff-c6058179253a"}]

Both revisions in sync gateway
{"_id":"2511038a-3574-488f-a469-c67c8e56049e","_rev":"2-468e52b9-ecd7-4213-8f67-51992fdf0173","_revisions":{"ids":["468e52b9-ecd7-4213-8f67-51992fdf0173","234d1eb7-70db-45fc-9614-3f33fad0c311"],"start":2},"comment":"R","crewUser":"bobby","email":"de","fullName":"hello123","members":[],"phone":"14","type":"customer"}

{"_deleted":true,"_id":"2511038a-3574-488f-a469-c67c8e56049e","_rev":"3-0b21e6d6-77bc-4cac-bdff-c6058179253a","_revisions":{"ids":["0b21e6d6-77bc-4cac-bdff-c6058179253a","b41efe52-43b2-4b93-926f-b2b61f10b252","234d1eb7-70db-45fc-9614-3f33fad0c311"],"start":3}}

The logs on the sync gateway are the ones above. Do you have any idea why is acting like that?



Thank you very much :)

Kind Regards
Bart
Reply all
Reply to author
Forward
0 new messages