cloudant / sync-android

A JSON-based document datastore for Android applications
Apache License 2.0
267 stars 91 forks source link

Revisions limit for local document store in Cloudant Sync #579

Closed jjrodrig closed 2 years ago

jjrodrig commented 6 years ago

Cloudant/CouchDB allows to restrict the maximum number of revisions per document. This can be defined with the _revs_limit endpoint.

Provides Cloudant Sync a similar mechanism? It would be very helpful to try keep the local document store small when documents with frequent updates are managed.

Also, purge operation could be helpful, Is there any plan to include it?

Please include the following information in your ticket.

tomblench commented 6 years ago

@jjrodrig there is currently no concept of revs_limit and the revs tree grows indefinitely without any limit on its depth. For typical uses we don't see this as a problem as trees tend to have relatively small depths. In most cases it is an anti-pattern to have highly mutable documents which cause deep revision trees. See this article (Rule 12) for more information.

Currently we don't have a purge operation, but after compaction only the revision metadata (rev id, doc id, and a few other flags) remains, which has a small storage overhead.

jjrodrig commented 6 years ago

Thanks @tomblench for your answer We have two use cases in our application:

As general design rule in our system we try to keep the server databases small trying to improve the filtered replication process. We have implemented a purging process in the server but I don’t see any mechanism to do the same in the mobile device.

I see that you have a started work about Purge operation. Do you discard to include it in the library?

ricellis commented 6 years ago

We had considered adding a purge to the local datastore previously and started a prototype, but that work was dropped and purge functionality is not currently in plan.

alexiri commented 5 years ago

Hi @ricellis, have there been any updates to this? Are there any plans to work on purging and compaction?

ricellis commented 5 years ago

Compaction is already available to remove the bodies and attachments of obsolete revisions. We have no plans to make any changes to the overall revision tree. FWIW Cloudant no longer allows customization of the _revs_limit server side either (although it is still capped at 1000).

We have no new features planned for this library at this time, but if that changes this feature request is well known and it will definitely be up for consideration.

ricellis commented 2 years ago

This library is now end-of-life and this issue won't be fixed. This issue has been tagged EOL in case any forks want to import it.