You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Daniel Gonzalez <go...@gonvaled.com> on 2014/09/11 08:14:29 UTC

Manually deleting a _design directory

Hi,

I have a couchdb instance which I am no longer using for data processing.
That is, I need the data to be there, but the views are no longer needed,
since I have moved the data processing to another server. I would like to
free the space used by the views (currently nearly 5 GB).

1. Can I simply delete the design directories? (rm -rf .*_design)
2. Will this affect the documents themselves? (I guess not, this is just
view data, not document data)
3. Can I do this in a running couchdb instance?
4. Will this really free-up disk space, or does couchdb keep view file
handles open, so that a restart is needed?

I understand that doing so will still leave the _design documents in the
databases, and that triggering those documents will recreate the views, but
I am not concerned about this at this moment: I just want to quickly
free-up some disk space.

Thanks!
Daniel Gonzalez

Re: Manually deleting a _design directory

Posted by Alexander Shorin <kx...@gmail.com>.
On Thu, Sep 11, 2014 at 10:14 AM, Daniel Gonzalez <go...@gonvaled.com> wrote:
> 1. Can I simply delete the design directories? (rm -rf .*_design)
> 2. Will this affect the documents themselves? (I guess not, this is just
> view data, not document data)
> 3. Can I do this in a running couchdb instance?
> 4. Will this really free-up disk space, or does couchdb keep view file
> handles open, so that a restart is needed?

You can delete these files, but it's not recommended since CouchDB
process may still hold file descriptors opened on these files. Better
delete design document in CouchDB and cleanup outdated views[1].

With deletion .*_design you remove view indexes. If design document
still exists in database and CouchDB doesn't keeps fd on any of these
files, it will rebuild index from scratch on next request to a view.

If you'd done it having CouchDB in run, you need to restart it to let
it release file descriptors. Or you can find fd in
/proc/<couchdbpid>/fd and close them via gdb.

[1]: http://docs.couchdb.org/en/latest/api/database/compact.html#post--db-_view_cleanup

--
,,,^..^,,,

Re: Manually deleting a _design directory

Posted by Daniel Gonzalez <go...@gonvaled.com>.
Thanks!

Unfortunately I have no dev instance at the moment.
There are 20 databases with an average of 5 design documents. That is more
than 2 clicks (not to talk about possible click errors)

On Thu, Sep 11, 2014 at 8:25 AM, Sanjuan, Hector <he...@here.com>
wrote:

> Hi,
>
> afaik from what I've played around nothing will break and things work as
> you expect them.
>
> 1. yes
> 2. no
> 3. yes
> 4. I think yes, it will free up space as long as the view is not being
> used, but the easiest is that you test it in a dev instance.
>
> As a side note, db compaction also frees a lot of space...
>
> Also, why don't you just delete the _design docs as that is the way to
> remove a view if you don't need it? should be matter of 2 clicks..
>
> H
>
>
> ________________________________________
> From: Daniel Gonzalez <go...@gonvaled.com>
> Sent: Thursday, September 11, 2014 08:14
> To: user@couchdb.apache.org
> Subject: Manually deleting a _design directory
>
> Hi,
>
> I have a couchdb instance which I am no longer using for data processing.
> That is, I need the data to be there, but the views are no longer needed,
> since I have moved the data processing to another server. I would like to
> free the space used by the views (currently nearly 5 GB).
>
> 1. Can I simply delete the design directories? (rm -rf .*_design)
> 2. Will this affect the documents themselves? (I guess not, this is just
> view data, not document data)
> 3. Can I do this in a running couchdb instance?
> 4. Will this really free-up disk space, or does couchdb keep view file
> handles open, so that a restart is needed?
>
> I understand that doing so will still leave the _design documents in the
> databases, and that triggering those documents will recreate the views, but
> I am not concerned about this at this moment: I just want to quickly
> free-up some disk space.
>
> Thanks!
> Daniel Gonzalez
>

RE: Manually deleting a _design directory

Posted by "Sanjuan, Hector" <he...@here.com>.
Hi,

afaik from what I've played around nothing will break and things work as you expect them. 

1. yes
2. no
3. yes
4. I think yes, it will free up space as long as the view is not being used, but the easiest is that you test it in a dev instance.

As a side note, db compaction also frees a lot of space...

Also, why don't you just delete the _design docs as that is the way to remove a view if you don't need it? should be matter of 2 clicks..

H


________________________________________
From: Daniel Gonzalez <go...@gonvaled.com>
Sent: Thursday, September 11, 2014 08:14
To: user@couchdb.apache.org
Subject: Manually deleting a _design directory

Hi,

I have a couchdb instance which I am no longer using for data processing.
That is, I need the data to be there, but the views are no longer needed,
since I have moved the data processing to another server. I would like to
free the space used by the views (currently nearly 5 GB).

1. Can I simply delete the design directories? (rm -rf .*_design)
2. Will this affect the documents themselves? (I guess not, this is just
view data, not document data)
3. Can I do this in a running couchdb instance?
4. Will this really free-up disk space, or does couchdb keep view file
handles open, so that a restart is needed?

I understand that doing so will still leave the _design documents in the
databases, and that triggering those documents will recreate the views, but
I am not concerned about this at this moment: I just want to quickly
free-up some disk space.

Thanks!
Daniel Gonzalez