Document revision issue

Hi,

I am running couch base 3.0.1 with sync gateway 1.1.0 and noticed that i am getting duplicate revision numbers.

Can you please give me some advice on why it is happening?

Please see document information here:

{
"_sync": {
“rev”: “12-0442696a50ff9f50e6bf03b74f1f2ce9”,
“new_rev”: “2-b5971e331af61e68f1d3f0f7fe0dfd48”,
“flags”: 28,
“sequence”: 1962,
“recent_sequences”: [
3,
4,
319,
397,
398,
411,
650,
651,
654,
655,
658,
664,
1478,
1962
],
“history”: {
“revs”: [
“2-204a9a1aa61dd435355a34158cc19ade”,
“5-e52cd1e3a8511604fd2f99d9bf9006e8”,
“4-6adbfef01c480c5590c4c173de08a19c”,
“9-272d05f80de0ae8c99803dec955d2cfd”,
“6-06a47434603430cae68986f0ee2babc0”,
“7-875c9cc247f8d0c118391de232406114”,
“1-0e95bc0511487eecd70f4a9edef038df”,
“8-37db2090ce85617a29327bac47cb2136”,
“12-0442696a50ff9f50e6bf03b74f1f2ce9”,
“3-d297871cff58fb70b9ea7c90640bc854”,
“1-db78006f15d25fb7922a0f83e225a097”,
“2-b5971e331af61e68f1d3f0f7fe0dfd48”,
“10-9ec56e04a4209eb8fb5ae15e7bc9b5a5”,
“11-2dc30599b0313be950f89a8db3d6aa73”
],

Thanks,
Karunakar

@Karunakar

This document has conflicting revisions, here is a good explanation of how the rev tree metadata is stored in a document.

Thank you Andy.

I have gone through that document before posting it but the problem i could not find out who caused this conflict.

Application (IOS or Android device) can not update these documents as these are ready only.

I use Sync Gateway API to publish updates to the documents though Admin port to only one couchbase server (Node A) and that couchbase server replicates data with rest of the couchbase nodes (Node B and C).

I have gone through 3 nodes couchbase sync gateway logs and found out that actually update happened on couchbase server Node B and then pushed that update to Couchbase Node A and C and that the puzzle here as sync gateway API never have connection to Couchbase Node B to update documents.

I could not find much information regarding who updated those documents with wrong version number and why couchbase recorded older revision number when previous revision number was 12-* and should increment to 13-* instead it started with 2-*

“rev”: “12-0442696a50ff9f50e6bf03b74f1f2ce9”,
“new_rev”: “2-b5971e331af61e68f1d3f0f7fe0dfd48”,

After this issue happend i have manually updated document through Sync Gateway API through admin port and it recorded version 13-*

See below

{
"_sync": {
“rev”: “13-1d7d0ff95f149c3686a61141ea28d8cb”,
“flags”: 24,
“sequence”: 4439,
“recent_sequences”: [
3,
4,
319,
397,
398,
411,
650,
651,
654,
655,
658,
664,
1478,
1962,
4439
],
“history”: {
“revs”: [
“4-6adbfef01c480c5590c4c173de08a19c”,
“1-0e95bc0511487eecd70f4a9edef038df”,
“10-9ec56e04a4209eb8fb5ae15e7bc9b5a5”,
“13-1d7d0ff95f149c3686a61141ea28d8cb”,
“9-272d05f80de0ae8c99803dec955d2cfd”,
“7-875c9cc247f8d0c118391de232406114”,
“12-0442696a50ff9f50e6bf03b74f1f2ce9”,
“1-db78006f15d25fb7922a0f83e225a097”,
“2-204a9a1aa61dd435355a34158cc19ade”,
“6-06a47434603430cae68986f0ee2babc0”,
“8-37db2090ce85617a29327bac47cb2136”,
“5-e52cd1e3a8511604fd2f99d9bf9006e8”,
“3-d297871cff58fb70b9ea7c90640bc854”,
“2-b5971e331af61e68f1d3f0f7fe0dfd48”,
“11-2dc30599b0313be950f89a8db3d6aa73”
],

Is there any way i can find out where this update initiated and how can i prevent this issue in future as it is still happening in our environment.

Thanks for your help.

Thanks,
Karunakar

@Karunakar

Are Nodes A,B,C above Sync Gateway instances or Couchbase Server instances.

If they are SG instances, do they all use the same Couchbase Server cluster as a backing store?

You say the documents are being replicated between the nodes A,B,C can you expand on how replication is being done.

Andy

Hi Andy,

Thank you for getting back to my post.

Node A,B and C are in same cluster and there is no XDCR setup as all three servers located in same network.

Yes, Node A,B and C all three servers have sync gateway installed and three nodes have same bucket name and same cluster server store.

Internal sync gateway API updates documents on Node A and then those updates are pushed to Node B and C by Node A. All three servers are internal DMZ servers and i am using hardware Load Balancer for sync gateway.

Please see attached flow process of my setup.

Thanks,
Karunakar

Hi,

Can you please help me to figure out this issue?

Thanks,
Karunakar