Can't purge old revisions


I’m wondering why metadata purge is not removing older revisions of document?
We are uploading new document with the same name using sync-gateway to couchbase.
Every day doc is deleted and new one uploaded with the same name.
As new doc is using the same name revision counter increases (metadata is bigger) and keeps getting bigger (30k+ old revisions).
Only way to remove revisions (actually everything) is to purge doc.
I would expect compaction to remove all old revisions prior to DELETE request?
Metadata purge is set to 1h.

Sync-GW is 1.3.1
Couchbase is 4.1.0


The /{db}/_compact endpoint is supposed to remove all obsolete revisions “older” than the revs_limit parameter.

The default revs_limit parameter is 1000 by default. How many revisions, at most, do you think there may be for a single document? You might want to change the revs_limit to a lower value and try again perhaps.



Thanks for answer. Yes you are correct, revision id is 30k+, but when I pulled all revisions there were 766 revisions.
Raw doc size 20MB (with all this metadata), that is the limit.


@ivica.dvorscak When you say ‘metadata purge’, I think you’re talking about the Couchbase Server operation. That’s unrelated to Sync Gateway’s revision history.

@jamiltz is correct that modifying the revs_limit will reduce the number of revisions retained in the revision history - that’s the Sync Gateway setting you want to change in order to reduce the maximum size of Sync Gateway’s metadata.

However, the /{db}/_compact endpoint is unrelated to revs_limit - it cleans up temporarily archived revision bodies. In general this shouldn’t be necessary, since those temporary backups are set to expire after 5 minutes.


We have set revs_limits to 3, but it seems that it is now working.
From /db/_config I can see that limit is really set.
When fetching doc with revs=true, I can still see all revs and not only 3.

Do you know why would this happen?


Hi, did you solve your problem? How did you decide?


We didn’t solve this issue and all revs were fetched. In the meantime we
have switched our app not to use Couchbase