Forcing re-push of docs deleted from server

Context:

  • CBL Android 2.8.6
  • Couchbase 6.6.2
  • Sync Gateway 2.5.1

I’m not sure whether this is something CBL, Sync Gateway, or Couchbase-related (or a combination), but thought I’d start here. Please re-direct as required. :slight_smile:

We are currently running a test case to check our push filtering implementation. Something like this:

  • On Android device, create doc A
  • Replication runs and pushes doc A via Sync Gateway to Couchbase.
  • Delete doc from Couchbase server: DELETE from db WHERE meta().id = A
  • On Android device, reset replication checkpoint and re-sync.

What we’re hoping for is for doc A to be re-pushed (as it no longer exists on the server), but this never happens. We haven’t found a way to force the app to re-push this doc.

I’ve added logging in the app checking what docs sync looks at pushing, but doc A is never in that list. Checking isDocumentPending(docA) returns false.

Inspecting the local app DB via cblite CLI shows this:

% revs --remotes A
Document "A"
 * 1-4e1243bd22c66e76c2ba9eddc1f91394e57f9f83   ---KL #1118, 4KB  [CURRENT]  [REMOTE#1]
[REMOTE#1] = wss://our-sync-gateway/_blipsync

Appreciate any help on where to start working out why doc A is not being pushed and/or how to get it to push. Is there another way to purge docs from the server/simulate a doc never having been pushed to the server? Should I be looking at the app-side, at Sync Gateway, or Couchbase server?

Regards,
David

In shared bucket access mode, when you delete a document on the server, you are not purging it, it creates a server tombstone. A tombstone is a document where the body is gone but metadata remains. Tombstones are synced down to clients so now all clients are in consistent state. If you have a push-only replication, then expectation is that the writes are not coming in from the server side. Otherwise you need push-pull to ensure everything is in consistent state.

When you create a tombstone, you effectively have a new revision of the document that’s newer than what’s on client- in this case, this latest revision is delete state which is probably why you aren’t seeing the document get resurrected when client tries to push up document. If you were to edit the document on client, it should get pushed up - try that.

If you want to purge the document on server, you can use the /{db}/_purge to remove the tombstone on server following a delete. There are automatic purge options available as well but this should suffice for your testing/debugging needs