Hi all,

Some more information about my problem and some logs.

I have a conflict as you can see 

On the device, 
http://192.168.43.82:5984/customersregistered/90a80a29-6821-4f7c-9ef1-750ea428d018?conflicts=true

{"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"]}

On the sync gateway : 
http://localhost:4985/customers/_changes?style=all_docs

{"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
On the device, 
http://192.168.43.82:5984/customersregistered/90a80a29-6821-4f7c-9ef1-750ea428d018?conflicts=true

{"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


Le vendredi 4 avril 2014 18:08:43 UTC+1, Bart Arribe a écrit :
>
> 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<https://groups.google.com/forum/#!searchin/mobile-couchbase/resolve$20conflict/mobile-couchbase/1HwBYVGKNRo/1d0Qkd_wlDQJ>.
>  
> 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
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/d76878a3-9933-4050-a2ce-62a7f666f594%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to