Bulk Purge of Tombstones


I have a very large amount of documents that have accumulated over time that are tombstoned and are definitely no longer needed by the client. I believe simply using a N1QL query in the workbench would cause the sync gateway to be out of sync with the bucket, and the _purge endpoint of the SG Admin API seems cumbersome to use unless i can somehow get all of the uuid’s into the post body (again, there is alot of these)

It would be easiest to just bulk delete the tombstones via the workbench and then perhaps kick the SG but I don’t know if that would be enough to stop those now missing tombstones from being attempted to sync.


Any ideas here? I tried just doing a straight N1QL delete on a development server and it got rid of the tombstones, but if I hit the _changes endpoint on the sync gateway I still see the tombstones there. So I essentially would need to take the bucket offline, resync, and bring it back online. Completely infeasible for production.


Hate to say it, but I’m experiencing the same issue

We have 100,000 legitimate documents, but those documents need to be refreshed weekly-- so an admin deletes all 100,000 and another 100,000 are uploaded.

The problem we are facing is that those documents are just tombstoned, and pushed, and then Couchbase Server stores all of our tombstoned revisions, and those are getting pulled into our clients as well, and we’ll quickly end up with 500,000+ documents, mostly tombstoned?

We are currently looking into updating documents rather than deleting them, but in the meantime, it’d be nice if we could

  1. Purge these tombstones? Though the problem would be if a client has a document that has been purged out of the server, then it would be pushed up? So probably not a good idea to purge tombstones from server
  2. Stop clients from pulling tombstone revisions. Ideally, a client has documents, pull replication starts, and it notices the server has tombstone revisions. If we could then delete and purge only these documents, that’d be great. The main issue is that now the clients are pulling all of these tombstone revisions that they don’t even care about

It’s possible I’m misunderstanding something, or missing something, or that this is just a limitation of Couchbase, but nevertheless this is something we need a solution for