apache / apache/couchdb

Allow purging by partition

Open
#4,180 4 comments 10 reactions 0 assignees View on GitHub
enhancement needs-triage
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

[NOTE]: # ( ^^ Provide a general summary of the request in the title above. ^^ )

## 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

[NOTE]: # ( Provide a brief overview of what the new feature is all about. )

## 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`

[NOTE]: # ( Tell us how the new feature should work. Be specific. )
[TIP]: # ( Do NOT give us access or passwords to your actual CouchDB! )

## 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.

[TIP]: # ( Why does this feature matter to you? What unique circumstances do you have? )

## 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.

Contributor guide

Open the contributing guide

Research direction

Start with the database miscellaneous API documentation at the linked URL and the `_purge` request shown in the issue. Trace how partition identifiers are handled by the purge endpoint and clarify the request shape and response behavior. Done means one purge request can identify multiple partitions and purge their documents without first listing document IDs and revisions.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
api, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.