You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Sean Clark Hess <se...@gmail.com> on 2010/02/23 20:04:15 UTC

Rename a database?

I need to import vast amounts of data into a couch database every night. The
company providing us the data does not provide a list of changes, so we need
to regenerate everything from scratch.

I was thinking that it would be nice if I could create a new database in
couch, copy in all the new data, then rename them once it is done. That way
my old data can stay live while the new data is importing.

Is there a way to rename databases? So, I would have an "imported_data"
database, create a "new_imported_database", then delete the old and rename
the new when the import finished.

Any other ideas?

Re: Rename a database?

Posted by Zachary Zolton <za...@gmail.com>.
The database index directories are named ".DBNAME_design". Given that
the names start with a dot, you'll wanna remember to use the "-a"
option if you're trying to use "ls" command on your data directory.

Beyond that, if you haven't pushed/indexed any views, for said
database, then they also might not exist yet...

Cheers,
Zach

On Tue, Feb 23, 2010 at 2:54 PM, Sean Clark Hess <se...@gmail.com> wrote:
> I found them, but didn't find the .DB_design directories. I only see a
> .couch file for each database.
>
> On Tue, Feb 23, 2010 at 12:52 PM, Markus Jelsma <ma...@buyways.nl> wrote:
>
>> No Red Hat here but try /var/lib/couchdb/. In any case, if you get there,
>> don't miss the .DB_design directories! Your views are there.
>>
>>
>> Sean Clark Hess said:
>> > really? Where are the couch data files stored? (redhat)
>> >
>> > On Tue, Feb 23, 2010 at 12:19 PM, Metin Akat <ak...@gmail.com>
>> > wrote:
>> >
>> >> Renaming the database file works.
>> >> Moving the file from one machine to another also works.
>> >>
>> >> On Tue, Feb 23, 2010 at 9:19 PM, Metin Akat <ak...@gmail.com>
>> >> wrote:
>> >> > On Tue, Feb 23, 2010 at 9:04 PM, Sean Clark Hess
>> >> <se...@gmail.com>
>> >> wrote:
>> >> >> I need to import vast amounts of data into a couch database every
>> >> night.
>> >> The
>> >> >> company providing us the data does not provide a list of changes,
>> >> so we
>> >> need
>> >> >> to regenerate everything from scratch.
>> >> >>
>> >> >> I was thinking that it would be nice if I could create a new
>> >> database in couch, copy in all the new data, then rename them once
>> >> it is done. That
>> >> way
>> >> >> my old data can stay live while the new data is importing.
>> >> >>
>> >> >> Is there a way to rename databases? So, I would have an
>> >> "imported_data" database, create a "new_imported_database", then
>> >> delete the old and
>> >> rename
>> >> >> the new when the import finished.
>> >> >>
>> >> >> Any other ideas?
>> >> >>
>> >> >
>>
>>
>>
>>
>

Re: Rename a database?

Posted by Sean Clark Hess <se...@gmail.com>.
I found them, but didn't find the .DB_design directories. I only see a
.couch file for each database.

On Tue, Feb 23, 2010 at 12:52 PM, Markus Jelsma <ma...@buyways.nl> wrote:

> No Red Hat here but try /var/lib/couchdb/. In any case, if you get there,
> don't miss the .DB_design directories! Your views are there.
>
>
> Sean Clark Hess said:
> > really? Where are the couch data files stored? (redhat)
> >
> > On Tue, Feb 23, 2010 at 12:19 PM, Metin Akat <ak...@gmail.com>
> > wrote:
> >
> >> Renaming the database file works.
> >> Moving the file from one machine to another also works.
> >>
> >> On Tue, Feb 23, 2010 at 9:19 PM, Metin Akat <ak...@gmail.com>
> >> wrote:
> >> > On Tue, Feb 23, 2010 at 9:04 PM, Sean Clark Hess
> >> <se...@gmail.com>
> >> wrote:
> >> >> I need to import vast amounts of data into a couch database every
> >> night.
> >> The
> >> >> company providing us the data does not provide a list of changes,
> >> so we
> >> need
> >> >> to regenerate everything from scratch.
> >> >>
> >> >> I was thinking that it would be nice if I could create a new
> >> database in couch, copy in all the new data, then rename them once
> >> it is done. That
> >> way
> >> >> my old data can stay live while the new data is importing.
> >> >>
> >> >> Is there a way to rename databases? So, I would have an
> >> "imported_data" database, create a "new_imported_database", then
> >> delete the old and
> >> rename
> >> >> the new when the import finished.
> >> >>
> >> >> Any other ideas?
> >> >>
> >> >
>
>
>
>

Re: Rename a database?

Posted by Markus Jelsma <ma...@buyways.nl>.
No Red Hat here but try /var/lib/couchdb/. In any case, if you get there,
don't miss the .DB_design directories! Your views are there.


Sean Clark Hess said:
> really? Where are the couch data files stored? (redhat)
>
> On Tue, Feb 23, 2010 at 12:19 PM, Metin Akat <ak...@gmail.com>
> wrote:
>
>> Renaming the database file works.
>> Moving the file from one machine to another also works.
>>
>> On Tue, Feb 23, 2010 at 9:19 PM, Metin Akat <ak...@gmail.com>
>> wrote:
>> > On Tue, Feb 23, 2010 at 9:04 PM, Sean Clark Hess
>> <se...@gmail.com>
>> wrote:
>> >> I need to import vast amounts of data into a couch database every
>> night.
>> The
>> >> company providing us the data does not provide a list of changes,
>> so we
>> need
>> >> to regenerate everything from scratch.
>> >>
>> >> I was thinking that it would be nice if I could create a new
>> database in couch, copy in all the new data, then rename them once
>> it is done. That
>> way
>> >> my old data can stay live while the new data is importing.
>> >>
>> >> Is there a way to rename databases? So, I would have an
>> "imported_data" database, create a "new_imported_database", then
>> delete the old and
>> rename
>> >> the new when the import finished.
>> >>
>> >> Any other ideas?
>> >>
>> >




Re: Rename a database?

Posted by Sean Clark Hess <se...@gmail.com>.
really? Where are the couch data files stored? (redhat)

On Tue, Feb 23, 2010 at 12:19 PM, Metin Akat <ak...@gmail.com> wrote:

> Renaming the database file works.
> Moving the file from one machine to another also works.
>
> On Tue, Feb 23, 2010 at 9:19 PM, Metin Akat <ak...@gmail.com> wrote:
> > On Tue, Feb 23, 2010 at 9:04 PM, Sean Clark Hess <se...@gmail.com>
> wrote:
> >> I need to import vast amounts of data into a couch database every night.
> The
> >> company providing us the data does not provide a list of changes, so we
> need
> >> to regenerate everything from scratch.
> >>
> >> I was thinking that it would be nice if I could create a new database in
> >> couch, copy in all the new data, then rename them once it is done. That
> way
> >> my old data can stay live while the new data is importing.
> >>
> >> Is there a way to rename databases? So, I would have an "imported_data"
> >> database, create a "new_imported_database", then delete the old and
> rename
> >> the new when the import finished.
> >>
> >> Any other ideas?
> >>
> >
>

Re: Rename a database?

Posted by Metin Akat <ak...@gmail.com>.
Renaming the database file works.
Moving the file from one machine to another also works.

On Tue, Feb 23, 2010 at 9:19 PM, Metin Akat <ak...@gmail.com> wrote:
> On Tue, Feb 23, 2010 at 9:04 PM, Sean Clark Hess <se...@gmail.com> wrote:
>> I need to import vast amounts of data into a couch database every night. The
>> company providing us the data does not provide a list of changes, so we need
>> to regenerate everything from scratch.
>>
>> I was thinking that it would be nice if I could create a new database in
>> couch, copy in all the new data, then rename them once it is done. That way
>> my old data can stay live while the new data is importing.
>>
>> Is there a way to rename databases? So, I would have an "imported_data"
>> database, create a "new_imported_database", then delete the old and rename
>> the new when the import finished.
>>
>> Any other ideas?
>>
>

Re: Rename a database?

Posted by Metin Akat <ak...@gmail.com>.
On Tue, Feb 23, 2010 at 9:04 PM, Sean Clark Hess <se...@gmail.com> wrote:
> I need to import vast amounts of data into a couch database every night. The
> company providing us the data does not provide a list of changes, so we need
> to regenerate everything from scratch.
>
> I was thinking that it would be nice if I could create a new database in
> couch, copy in all the new data, then rename them once it is done. That way
> my old data can stay live while the new data is importing.
>
> Is there a way to rename databases? So, I would have an "imported_data"
> database, create a "new_imported_database", then delete the old and rename
> the new when the import finished.
>
> Any other ideas?
>

Re: Rename a database?

Posted by Markus Jelsma <ma...@buyways.nl>.
I forgot to mention that readers of the old database will fail after
restart, the old file descriptor is obviously gone. You could probably
come up with this yourself however.

Again, please don't blaim me for any trouble ;-)


Markus Jelsma said:
> 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 disks.
>
> 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 <N....@vpro.nl> 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 [seanhess@gmail.com]
>>> Verzonden: dinsdag 23 februari 2010 23:49
>>> Aan: user@couchdb.apache.org
>>> 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.




Re: Rename a database?

Posted by Markus Jelsma <ma...@buyways.nl>.
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
disks.

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 <N....@vpro.nl> 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 [seanhess@gmail.com]
>> Verzonden: dinsdag 23 februari 2010 23:49
>> Aan: user@couchdb.apache.org
>> 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.




Re: Rename a database?

Posted by Sean Hess <se...@gmail.com>.
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 <N....@vpro.nl> 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 [seanhess@gmail.com]
> Verzonden: dinsdag 23 februari 2010 23:49
> Aan: user@couchdb.apache.org
> 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.

RE: Rename a database?

Posted by Nils Breunese <N....@vpro.nl>.
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 [seanhess@gmail.com]
Verzonden: dinsdag 23 februari 2010 23:49
Aan: user@couchdb.apache.org
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.

Re: Rename a database?

Posted by J Chris Anderson <jc...@gmail.com>.
On Feb 24, 2010, at 8:13 AM, Sean Clark Hess wrote:

> Would it be hard to add for databases? Maybe just have couch do the system
> mv command under the hood?
> 

I'd be +1 on this. It might not be completely atomic (renaming both the database and view files) but it could be considered an administrative operation.

We should discuss this on the dev@ list.

Chris

> On Wed, Feb 24, 2010 at 8:57 AM, Brian Candler <B....@pobox.com> wrote:
> 
>> On Wed, Feb 24, 2010 at 08:31:10AM -0700, Michael J. I. Jackson wrote:
>>> Seems I read something somewhere about HTTP MOVE (WebDav extension?)
>> being
>>> supported in a former incarnation.
>> 
>> Was for documents, not databases, IIRC.
>> 
>> 


Re: Rename a database?

Posted by Sean Clark Hess <se...@gmail.com>.
Would it be hard to add for databases? Maybe just have couch do the system
mv command under the hood?

On Wed, Feb 24, 2010 at 8:57 AM, Brian Candler <B....@pobox.com> wrote:

> On Wed, Feb 24, 2010 at 08:31:10AM -0700, Michael J. I. Jackson wrote:
> > Seems I read something somewhere about HTTP MOVE (WebDav extension?)
> being
> > supported in a former incarnation.
>
> Was for documents, not databases, IIRC.
>
>

Re: Rename a database?

Posted by Brian Candler <B....@pobox.com>.
On Wed, Feb 24, 2010 at 08:31:10AM -0700, Michael J. I. Jackson wrote:
> Seems I read something somewhere about HTTP MOVE (WebDav extension?) being
> supported in a former incarnation.

Was for documents, not databases, IIRC.


Re: OT: list archive permalinks (was: Re: Rename a database?)

Posted by Brian Candler <B....@pobox.com>.
On Wed, Feb 24, 2010 at 10:06:58AM -0600, Rhett Sutphin wrote:
> >Sadly the
> >mailinglist archives doesn't provide permalinks as far as I can
> >see

Read the message then click "message view" to get a permalink for an
individual message, e.g.

http://mail-archives.apache.org/mod_mbox/couchdb-user/201002.mbox/<31...@sourcegarden.de>

is the start of the 'HTTP MOVE' thread.

Unfortunately I can find no view for the whole thread, although you can keep
clicking on '>>' to the right of 'Thread' to get to the next messages in the
thread.


OT: list archive permalinks (was: Re: Rename a database?)

Posted by Rhett Sutphin <rh...@detailedbalance.net>.
Hi,

On Feb 24, 2010, at 9:41 AM, Nils Breunese wrote:

> Sadly the
> mailinglist archives doesn't provide permalinks as far as I can see,  
> but
> you should be able to find this thread when starting from
> http://mail-archives.apache.org/mod_mbox/couchdb-user/201002.mbox/browser
> (subject 'HTTP MOVE', started on February 21).

The official apache mailing list archives are pretty hard to  
reference.  There are other archives, though -- I like markmail:

http://markmail.org/search/?q=list%3Aorg.apache.couchdb.user+subject%3A%22HTTP+MOVE%22#query 
:list%3Aorg.apache.couchdb.user%20subject%3A%22HTTP%20MOVE%22+page:1+mid:mrrxbxm4k7zvqwqr+state:results

Rhett


Re: Rename a database?

Posted by Nils Breunese <N....@vpro.nl>.
Michael J. I. Jackson wrote:

> Seems I read something somewhere about HTTP MOVE (WebDav extension?) being
> supported in a former incarnation.

And it being removed, because it is not an atomic operation, which
yields problems when working with replication and distributed setups.
There was a thread about this on this list three days ago. Sadly the
mailinglist archives doesn't provide permalinks as far as I can see, but
you should be able to find this thread when starting from
http://mail-archives.apache.org/mod_mbox/couchdb-user/201002.mbox/browser
(subject 'HTTP MOVE', started on February 21).

Nils.

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.

Re: Rename a database?

Posted by "Michael J. I. Jackson" <mj...@gmail.com>.
Seems I read something somewhere about HTTP MOVE (WebDav extension?) being
supported in a former incarnation.

--
Michael J. I. Jackson
http://mjijackson.com/
@mjijackson


On Tue, Feb 23, 2010 at 3:49 PM, Sean Hess <se...@gmail.com> wrote:

> 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.
>
> On Feb 23, 2010, at 3:42 PM, Nils Breunese <N....@vpro.nl> wrote:
>
> > You could use the replication feature. imported_data is your live
> > database and you create new_imported_database for the import. Once
> > the import is done you drop the imported_data, create a fresh
> > imported_data database and replicate new_imported_database to
> > imported_data. Afterwards you can delete new_imported_database. This
> > does require more storage than renaming the database on the
> > filesystem level, but the replication method can be done entirely
> > via HTTP.
> >
> > Nils.
> > ________________________________________
> > Van: Sean Clark Hess [seanhess@gmail.com]
> > Verzonden: dinsdag 23 februari 2010 20:04
> > Aan: user@couchdb.apache.org
> > Onderwerp: Rename a database?
> >
> > I need to import vast amounts of data into a couch database every
> > night. The
> > company providing us the data does not provide a list of changes, so
> > we need
> > to regenerate everything from scratch.
> >
> > I was thinking that it would be nice if I could create a new
> > database in
> > couch, copy in all the new data, then rename them once it is done.
> > That way
> > my old data can stay live while the new data is importing.
> >
> > Is there a way to rename databases? So, I would have an
> > "imported_data"
> > database, create a "new_imported_database", then delete the old and
> > rename
> > the new when the import finished.
> >
> > Any other ideas?
> >
> > 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.
>

Re: Rename a database?

Posted by Sean Hess <se...@gmail.com>.
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.

On Feb 23, 2010, at 3:42 PM, Nils Breunese <N....@vpro.nl> wrote:

> You could use the replication feature. imported_data is your live
> database and you create new_imported_database for the import. Once
> the import is done you drop the imported_data, create a fresh
> imported_data database and replicate new_imported_database to
> imported_data. Afterwards you can delete new_imported_database. This
> does require more storage than renaming the database on the
> filesystem level, but the replication method can be done entirely
> via HTTP.
>
> Nils.
> ________________________________________
> Van: Sean Clark Hess [seanhess@gmail.com]
> Verzonden: dinsdag 23 februari 2010 20:04
> Aan: user@couchdb.apache.org
> Onderwerp: Rename a database?
>
> I need to import vast amounts of data into a couch database every
> night. The
> company providing us the data does not provide a list of changes, so
> we need
> to regenerate everything from scratch.
>
> I was thinking that it would be nice if I could create a new
> database in
> couch, copy in all the new data, then rename them once it is done.
> That way
> my old data can stay live while the new data is importing.
>
> Is there a way to rename databases? So, I would have an
> "imported_data"
> database, create a "new_imported_database", then delete the old and
> rename
> the new when the import finished.
>
> Any other ideas?
>
> 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.

RE: Rename a database?

Posted by Nils Breunese <N....@vpro.nl>.
You could use the replication feature. imported_data is your live database and you create new_imported_database for the import. Once the import is done you drop the imported_data, create a fresh imported_data database and replicate new_imported_database to imported_data. Afterwards you can delete new_imported_database. This does require more storage than renaming the database on the filesystem level, but the replication method can be done entirely via HTTP.

Nils.
________________________________________
Van: Sean Clark Hess [seanhess@gmail.com]
Verzonden: dinsdag 23 februari 2010 20:04
Aan: user@couchdb.apache.org
Onderwerp: Rename a database?

I need to import vast amounts of data into a couch database every night. The
company providing us the data does not provide a list of changes, so we need
to regenerate everything from scratch.

I was thinking that it would be nice if I could create a new database in
couch, copy in all the new data, then rename them once it is done. That way
my old data can stay live while the new data is importing.

Is there a way to rename databases? So, I would have an "imported_data"
database, create a "new_imported_database", then delete the old and rename
the new when the import finished.

Any other ideas?

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.