2 out of 3 Couchbase Server servers crashed nearly at the same time around a month ago. Since then some documents stopped syncing. Most have an empty body and were tombstoned. And they look like this:
{
"meta": {
"id": "PSKh7fwzmdhzy4ROVJIMqClGMJN2::0kz4d65oyb37::shoppingListItem::rn4gntrl4ukv::d7779720a2cf",
"rev": "50779-15bba49a94ba00000000000000000000",
"expiration": 0,
"flags": 0,
"type": "json"
},
"xattrs": {
"_sync": {
"rev": "3-bcff03dc7def8cc702a0f23f3e67d305",
"flags": 1,
"sequence": 129308174,
"recent_sequences": [
129308174
],
"history": {
"revs": [
"2-b9bb0e2018ee8ab3291ace94a74f9042",
"3-bcff03dc7def8cc702a0f23f3e67d305",
"1-683e3e5b1f4e33cf7172e9e5960c2a65"
],
"parents": [
2,
0,
-1
],
"deleted": [
1
],
"channels": [
null,
null,
null
]
},
"cas": "0x0000ba949aa4bb15",
"value_crc32c": "0x297bd0aa",
"tombstoned_at": 1566026279,
"time_saved": "2019-08-17T09:17:59.267566545+02:00"
}
}
}
As this is used in a shopping list app users might delete items and add them in the future again. A document name is derived by the shopping list item name and thus deleted documents may be created again.
The other findings is that documents cannot to be found on the server but are on the user’s device. They sent custom logs. The custom logs show that the document has been updated locally. So the documents has a higher revision number, and some fields, etc.
I’m also logging everything I could have thought of in the SG function but the documents don’t appear there. So I don’t think they get rejected by the SG function.
For some users it helped when I ran this command:
curl -X POST "http://localhost:4985/my_db/_compact" -H "accept: application/json"
Tombstone Purge Interval is set to 30 days. The document above was deleted less than 24 hours ago. So a solution may be to set the interval very low and run the _compact command frequently via a cron tab. But this doesn’t sound right to me.
What are other options to explore? Stop service, make a backup, flush bucket, import backup? Might this help?
Thanks!
SG version 2.1.2
CB Server 6.0
CBL Android 1.4.4