Hi all,
I am working on migrating a very old Couchbase database (version 4.6) to Couchbase 8.
My method for doing this is to use XDCR to transfer the documents from Couchbase 4.6 to Couchbase 6.
Then another XDCR from Couchbase 6 to Couchbase 8.
This is due to an incompatibility from 4.6 to anything above 6.0.
This works really well. The only issue I’m having is that roughly half of the documents are missing their xattrs._sync field.
I have the new Sync Gateway 4.0 connected to this Couchbase 8 database, and can access some, but not all documents. So the ones without the _sync are not reachable by our application through the Sync Gateway. Also, a _resync process done through the SG misses all of those as well.
If I run this query:
select count(*) from mydatabase where meta().id not like “_sync%”
I get a count of 319,181
However, this index sg_allDocs_x1 has a count of about 159k.
I discovered that this is because the meta().xattrs._sync is missing from the rest of the documents.
This is an example from the _raw endpoint of the Sync Gateway. The _sync field is simply null.
“_xattrs”: {
“_mou”: null,
“$document”: {
“CAS”: “0x187ffeef04e60000”,
“datatype”: [
“snappy”,
“json”
],
“deleted”: false,
“exptime”: 0,
“flags”: 0,
“last_modified”: “1765409881”,
“revid”: “1”,
“seqno”: “0x000000000000075c”,
“value_bytes”: 974,
“value_crc32c”: “0x883bc2f6”,
“vbucket_uuid”: “0x000052c9eb729c24”
},
“_sync”: null,
“_globalSync”: null,
“_vv”: null
}
I am attempting some hacky ways of adding this _sync field, but am wondering if there’s a built in way of doing it. Maybe some process or command I can run, etc. that will clean up and rebuild the documents’ _sync data and add it to those that are missing/null.
Any help would be appreciated.
Thanks!
