Q: deleted document still sync to client as a normal document


#1

hi,
when I deleted couchbase lite local database file, then resync data from the server, a deleted document always synced from the server as a normal document. and I get this document from sg by admin port(4985), the document below:

[root@sync-gateway-54569bfddb-rxhxl sync_gateway]# curl -X GET “http://admin:ydd123456@127.0.0.1:4985/kitchen/_raw/MsgGoods.17e354d9-6736-4b4f-986e-f2fd035c3a25
{"_deleted":true,"_sync":{“rev”:“3-a8563dcf1f9b94e1bfad528aefa2c2ab”,“flags”:1,“sequence”:8941,“recent_sequences”:[8893,8941],“history”:{“revs”:[“1-70042501a8cbb176b41e1378a5ab79f6f8b81b85”,“2-77fc2d0d2074fadc70003bff6ea904f60d7d8b16”,“3-a8563dcf1f9b94e1bfad528aefa2c2ab”],“parents”:[-1,0,1],“deleted”:[1,2],“channels”:[null,null,null]},“cas”:“0x00003fe6293d7e15”,“value_crc32c”:“0x00000000”,“tombstoned_at”:1548742572,“time_saved”:“2019-01-29T06:16:12.027300323Z”}}

and when I get this document from 4984 port, it’ll prompt this document has been deleted.
I can get this document from couchbase lite with the body. and this document displayed in Android apps.

how can I resolve this issue?

best regards!


#2

Deletion will not remove the document completely, instead it adds a special tombstone revision to the database, as bookkeeping so that the change can be replicated to other databases. All properties are removed, and subsequent calls to the getDocument(id) method will return nil.

If you want to remove the document completely use purge. Purge removes all traces of the document. The purge will NOT be replicated to other databases.

Delete documentation

Purge documentation

I can get this document from couchbase lite with the body. and this document displayed in Android apps.

Could you please elaborate on the body you are receiving? Are you receiving the pre-tombstone document body?


#3

hi,
I reinstall the couchbase server and sync_gateway, this issue has resolved.
I don’t know where this document saved, this document not existed in the bucket. maybe in memcached? this document always resyncs from the server when removed the couchbase lite local database.
thanks for your reply.