couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Jelsma" <>
Subject Re: Rename a database?
Date Wed, 24 Feb 2010 01:06:00 GMT
Size does matter and it is certainly not just bound only by the speed of
the harddrive.

I've just created a 0.9GB database with about 300.000 documents. It takes
quite a while for it to replicate locally, it took 3m20s while copying a
2GB file takes less than 30s (on the same disk). CouchDB, of course, does
a lot of work for replication such as reading, checking for conflicts and
appending. A 12GB file will certainly take a long time on a system like
this machine although it has lots of RAM, fast CPU and relatively fast

There is, however, a trick you might consider. But you may be asking for
trouble on this one, so be careful.

On Unix you can simply move (rename) a file while the readers are
unaffected. Since CouchDB keeps the files open there _shouldn't_ be a
problem. But keep in mind, writes to the old file (db name) will not show
up in the newly move file, it will also not trigger an error (tested and
confirmed here with a 10MB database).

I am not sure why writes fail but don't trigger an error, perhaps i
haven't given it enough though at this moment.

Please, don't execute the things above without verification. Test it
yourself with a reasonable comparable database and hopefully get some
additional feedback in this method from CouchDB developers.

Although i have executed this (even multiple times) in this test set up,
and verified it works without a single problem, it doesn't proof it's
actually a good practice.

Sean Hess said:
> The databases total to about 12 GB before any views are generated. How
> long would it take to replicate that if it was local? Would it be
> bound only by the harddrive speed?
> On Feb 23, 2010, at 4:07 PM, Nils Breunese <> wrote:
>> In my experience replication is nearly instantaneous, especially since
>> in this case it's to the local machine. But I don't know how large
>> your databases are.
>> You could even run the import on another machine and replicate the
>> resulting database to the production machine afterwards to offload the
>> production server from the import load. You could even replicate it to
>> a separate database the production machine afterwards and the
>> replicate to the 'real' live database if the difference in downtime
>> due to network latency is significant enough.
>> Nils.
>> ________________________________________
>> Van: Sean Hess []
>> Verzonden: dinsdag 23 februari 2010 23:49
>> Aan:
>> Onderwerp: Re: Rename a database?
>> I need the system to stay live the whole time, so the rename has to be
>> nearly instantaneous. I do wish there was an http way to do it though.
>> De informatie vervat in deze  e-mail en meegezonden bijlagen is
>> uitsluitend bedoeld voor gebruik door de geadresseerde en kan
>> vertrouwelijke informatie bevatten. Openbaarmaking,
>> vermenigvuldiging, verspreiding en/of verstrekking van deze
>> informatie aan derden is voorbehouden aan geadresseerde. De VPRO staat
>> niet in voor de juiste en volledige overbrenging van de inhoud van een
>> verzonden e-mail, noch voor tijdige ontvangst daarvan.

View raw message