Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow purging by partition #4180

Open
aalegriadg opened this issue Sep 19, 2022 · 4 comments
Open

Allow purging by partition #4180

aalegriadg opened this issue Sep 19, 2022 · 4 comments

Comments

@aalegriadg
Copy link

aalegriadg commented Sep 19, 2022

Summary

Currently the request to purge a number of documents in the database, must include the document IDs, and for each document ID, one or more revisions that must be purge . This request does not allow to include ids of partitions to purge.

https://docs.couchdb.org/en/stable/api/database/misc.html

Desired Behaviour

client.post(f"{url}/{self._database.database_name}/_purge", json=doc)

where:

json={partition1_id, partition2_id, partition3_id}

Result: Purged all documents from partition1_id, partition2_id y partition3_id

Additional context

In my project, we are working with temporary replication windows: Documents are stored by daily partitions and when they are considered old enough they are not replicated and furthermore, they are purged.

Therefore, it would be very useful to be able to make a purge request that allows as input argument the ids of the partitions to purge.

Benefit

It is more efficient to do a single purge query indicating the id of the partition to purge than:

  • Make a query of all the documents in a partition.
  • Create a json with the ids and revs of the documents.
  • Make the purge query including the json

Performing all these steps on a low computational device implies a high deletion time.

@jiangphcn
Copy link
Contributor

Hey @aalegriadg, thanks for reporting.

It may take time to support purging against partition/database inside CouchDB if it is an agreed approach in the community.

Is it possible to use script to get document list from partition/database and then purge them one by one as one quick way?

@aalegriadg
Copy link
Author

Hi!

Thank you for your reply

Based on your comment, I have modified the description,adding the benefits that this new query could bring.

As you can see, this functionality would be very useful for my team and we would be very willing to contribute to it.

@jiangphcn
Copy link
Contributor

@aalegriadg thanks for feedback and contribution. Want to check you or your team will make PR or let us work together for that?

@aalegriadg
Copy link
Author

We do not have in the team people with experience in Erlang, but we could fund the feature, trying to accelerate it, because we are very interested in it.

We would also be interested in a function that returns the existing partitions in the database, of the type get_all_partitions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants