You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Matthias Eck <ma...@gmail.com> on 2012/06/01 23:12:16 UTC

Documents with 1000 revisions

Hello,

I noticed that a very small number of documents in my database have
1000 revisions, which somehow prevents them from being updated again.
It is unclear where that came from, but I was wondering if it is
possible to somehow compact just the document instead of compacting
the whole database i.e. delete all but the last document revision.

Thanks,
Matthias

Re: Documents with 1000 revisions

Posted by Matthieu Rakotojaona <ma...@gmail.com>.
On Sat, Jun 2, 2012 at 12:09 AM, Jens Alfke <je...@couchbase.com> wrote:
> I'm pretty sure CouchDB doesn't have any limit on the number of revisions of a document.

Yes, it has a (tunable) limit of revisions, set by default to 1000:

https://wiki.apache.org/couchdb/HTTP_database_API#Accessing_Database-specific_options

-- 
Matthieu RAKOTOJAONA

Re: Documents with 1000 revisions

Posted by Matthias Eck <ma...@gmail.com>.
Hello,

I was trying to edit the documents with 1000 revisions in Futon and
always got an error message about an update conflict (and the edit
never went through).
Now after database compaction, that problem seems to have gone away.

Thanks,
Matthias



On Sat, Jun 2, 2012 at 2:52 AM, Robert Newson <rn...@apache.org> wrote:
> CouchDB only remembers the last 1000 _rev values by default (even
> after compaction). The reason it remembers past _rev values at all is
> so we can determine common ancestry when merging due to replication.
> The reason we cut off at 1000 is to avoid the unbounded storage
> problem of keeping them all.
>
> None of this stops you updating a document as many times as you like.
> Please show whatever is preventing you from updating, I'm prepared to
> bet that it is not CouchDB itself.
>
> B.
>
> On 1 June 2012 23:25, Dave Cottlehuber <da...@muse.net.nz> wrote:
>> On 2 June 2012 00:09, Jens Alfke <je...@couchbase.com> wrote:
>>>
>>> On Jun 1, 2012, at 2:12 PM, Matthias Eck wrote:
>>>
>>>> I noticed that a very small number of documents in my database have
>>>> 1000 revisions, which somehow prevents them from being updated again.
>>>
>>> I'm pretty sure CouchDB doesn't have any limit on the number of revisions of a document. Perhaps the API/library you're using to access it has a bug that breaks with 4-digit revision numbers? What API are you using?
>>
>> There is a per-DB limit, _revs_limit,
>> http://wiki.apache.org/couchdb/HTTP_database_API.  Hopefully somebody
>> will can explain exactly the significance of this, wrt to replication,
>> stemming, compaction etc.
>>
>> A+
>> Dave

Re: Documents with 1000 revisions

Posted by Robert Newson <rn...@apache.org>.
CouchDB only remembers the last 1000 _rev values by default (even
after compaction). The reason it remembers past _rev values at all is
so we can determine common ancestry when merging due to replication.
The reason we cut off at 1000 is to avoid the unbounded storage
problem of keeping them all.

None of this stops you updating a document as many times as you like.
Please show whatever is preventing you from updating, I'm prepared to
bet that it is not CouchDB itself.

B.

On 1 June 2012 23:25, Dave Cottlehuber <da...@muse.net.nz> wrote:
> On 2 June 2012 00:09, Jens Alfke <je...@couchbase.com> wrote:
>>
>> On Jun 1, 2012, at 2:12 PM, Matthias Eck wrote:
>>
>>> I noticed that a very small number of documents in my database have
>>> 1000 revisions, which somehow prevents them from being updated again.
>>
>> I'm pretty sure CouchDB doesn't have any limit on the number of revisions of a document. Perhaps the API/library you're using to access it has a bug that breaks with 4-digit revision numbers? What API are you using?
>
> There is a per-DB limit, _revs_limit,
> http://wiki.apache.org/couchdb/HTTP_database_API.  Hopefully somebody
> will can explain exactly the significance of this, wrt to replication,
> stemming, compaction etc.
>
> A+
> Dave

Re: Documents with 1000 revisions

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 2 June 2012 00:09, Jens Alfke <je...@couchbase.com> wrote:
>
> On Jun 1, 2012, at 2:12 PM, Matthias Eck wrote:
>
>> I noticed that a very small number of documents in my database have
>> 1000 revisions, which somehow prevents them from being updated again.
>
> I'm pretty sure CouchDB doesn't have any limit on the number of revisions of a document. Perhaps the API/library you're using to access it has a bug that breaks with 4-digit revision numbers? What API are you using?

There is a per-DB limit, _revs_limit,
http://wiki.apache.org/couchdb/HTTP_database_API.  Hopefully somebody
will can explain exactly the significance of this, wrt to replication,
stemming, compaction etc.

A+
Dave

Re: Documents with 1000 revisions

Posted by Jens Alfke <je...@couchbase.com>.
On Jun 1, 2012, at 2:12 PM, Matthias Eck wrote:

> I noticed that a very small number of documents in my database have
> 1000 revisions, which somehow prevents them from being updated again.

I'm pretty sure CouchDB doesn't have any limit on the number of revisions of a document. Perhaps the API/library you're using to access it has a bug that breaks with 4-digit revision numbers? What API are you using?

> It is unclear where that came from, but I was wondering if it is
> possible to somehow compact just the document instead of compacting
> the whole database i.e. delete all but the last document revision.

Not really; compaction by nature affects the entire database (it copies the current revisions to a new file and replaces the old database file with the new one.) But unless your app has a need to access old revisions, compacting the whole database shouldn't cause a problem.

—Jens