couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Petty <adamjpe...@gmail.com>
Subject Re: Compaction documentation vs behaviour
Date Tue, 27 Jan 2009 18:39:32 GMT
Hello,

Is it possible to set the compaction to leave *n* doc revs?  I've looked
around breifly - but wasn't sure.  We'd like to use the doc revs for "undo"
or "history" features but still be able to compact the db file.

--Adam

On Tue, Jan 27, 2009 at 12:53 PM, Chris Anderson <jchris@apache.org> wrote:

> On Tue, Jan 27, 2009 at 5:30 AM, Matt Goodall <matt.goodall@gmail.com>
> wrote:
> > Hi,
> >
> > Both the wiki, http://wiki.apache.org/couchdb/Compaction, and Futon
> > warn that compacting removes deleted documents. However, a deleted
> > document is still represented in _all_docs_by_seq after compaction.
>
> Perhaps the wording should be more clear. Compaction removes old revs
> of all documents. So in the case of a deleted document, the head rev
> is the one that marks it as deleted, but before compaction, the
> original version of the document (in your example, rev 143469513) is
> kept in the file. After compaction, only the latest rev remains.
>
> Compaction preserves any conflict-revs as well.
>
> >
> > $ curl -X "PUT" -d "{}" "http://localhost:5984/compaction/doc"
> > {"ok":true,"id":"doc","rev":"143469513"}
> > $ curl -X "DELETE" "http://localhost:5984/compaction/doc?rev=143469513"
> > {"ok":true,"id":"doc","rev":"1135956802"}
> > $ curl -X "POST" "http://localhost:5984/compaction/_compact"
> > {"ok":true}
> > $ curl "http://localhost:5984/compaction/_all_docs_by_seq"
> > {"total_rows":0,"offset":0,"rows":[
> > {"id":"doc","key":2,"value":{"rev":"1135956802","deleted":true}}
> > ]}
> >
> > Presumably, the wiki & Futon are incorrect as it makes complete sense
> > to keep deleted documents around for replication, but I'll wait for a
> > response to this email before I create a ticket.
> >
> > - Matt
> >
>
>
>
> --
> Chris Anderson
> http://jchris.mfdz.com
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message