couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joan Touzet <woh...@apache.org>
Subject Re: Error deleting and recreating a database
Date Thu, 11 Jul 2019 16:02:19 GMT
Hi Alessandro,

On 2019-07-11 11:15, alessandro collina wrote:
> Hi,
> 
> I would like to know how it is possible to delete all documents in a
> database with a single request.

If you are on CouchDB 2.3.0+, you can use clustered purge to remove up
to 100 documents/1000 revisions at a time. Those numbers are
configurable, see the docs:

http://docs.couchdb.org/en/latest/cluster/purging.html
https://docs.couchdb.org/en/latest/api/database/misc.html

> I tried to delete the whole database (using curl to send http method
> DELETE) and then recreate it.
> 
> Sometimes unfortunately this approach returns a wrong behaviour: it
> seems that erasing is not effective and the subsequent (re)creation
> request gives me a "file already exists" error. But not always does this
> behaviour appear: the database is often correctly erased and (re)created.
> 
> I tried to put some long delay between deleting and creating but it does
> not works: the problem still remains.

Unfortunately, deleting a database, then trying to recreate it, is a
known anti-pattern for CouchDB 2.x. There's no easy fix for it in CouchDB.


Mime
View raw message