Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D5F2010490 for ; Sat, 31 Aug 2013 18:15:09 +0000 (UTC) Received: (qmail 57873 invoked by uid 500); 31 Aug 2013 18:15:08 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 57842 invoked by uid 500); 31 Aug 2013 18:15:08 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 57833 invoked by uid 99); 31 Aug 2013 18:15:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Aug 2013 18:15:07 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [209.85.128.170] (HELO mail-ve0-f170.google.com) (209.85.128.170) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Aug 2013 18:15:02 +0000 Received: by mail-ve0-f170.google.com with SMTP id 15so2238512vea.29 for ; Sat, 31 Aug 2013 11:14:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=LOhj59s1tz9+AYrBXCCtHQYypgDcuLV6l1WLynWWkpU=; b=Eg28Kmg0PCzfeizL8Frfxmz6eu/HS04Lo2z0zbEFRQt6ucfd8FfHZotvf0GlMjz7sU HnoGb4I0c9jdDEF9m4JNlLYJXa/Jcs3b/1tNJ1jYipX2/MafY/PsM45dHk68zGZhbIN8 N2lm7aJvWqfItyK0zFXOjGE2vInYziB5v3SAsxMnhPTVqR7t5RY1AMWStWTdReRe+GE7 LJnEy6cyFx18gzWRXiib5YxkGhtwB3NcVzz92OgUfHl/ovL+rAOW+8ZOUTMvgrqyj+N7 s3FicKIR/3JP/ETpDaBnF0wRSTIVIKZyXVGe6OKT9wOyFV5XZxP7Nn/Pts9Cs1wTKBTK oZsQ== X-Gm-Message-State: ALoCoQnLCEIap0zT9DdfCzh/5BvZNAEsYdhL3zW93nSnvEBIQCgZ+FXozWb05vCiOYjFvh0jRcwV MIME-Version: 1.0 X-Received: by 10.58.106.82 with SMTP id gs18mr14391386veb.18.1377972861014; Sat, 31 Aug 2013 11:14:21 -0700 (PDT) Received: by 10.58.240.70 with HTTP; Sat, 31 Aug 2013 11:14:20 -0700 (PDT) In-Reply-To: References: <40D9BD04-119C-4912-8F30-688F76FFC444@couchbase.com> Date: Sat, 31 Aug 2013 19:14:20 +0100 Message-ID: Subject: Re: Which revisions does _revs_limit prune? From: Dale Harvey To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=047d7b6d88c8e4272004e5424e71 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b6d88c8e4272004e5424e71 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable * stem the tree by turning the ... On 31 August 2013 19:13, Dale Harvey wrote: > So the way I implemented this in PouchDB gives Paul Davis's advice, is to > stem the trees but turning the revision tree into a set of revision lists= , > listing all the individual paths from head to root, then stemming each li= st > to the rev limit, then merging them back into a single tree > > I worked off a refactor branch of couch that never got merged, but from a > glance it looks like this is how it is done in > https://github.com/apache/couchdb/blob/master/src/couchdb/couch_key_tree.= erl > > I keep meaning to write a test to reproduce this, but I am fairly certain > this has the problem with a document that is generating a lot of conflict= s > (by being deleted and recreated continuously), can dos CouchDB as shallow > branches never get pruned, but I may possibly be missing something > > > > On 31 August 2013 19:05, Robert Newson wrote: > >> The best I can find right now is from couch_key_tree where the >> truncation occurs; >> >> %% What makes this a bit more complicated is that there is a limit to th= e >> %% number of revisions kept, specified in couch_db.hrl (default is 1000)= . >> When >> %% this limit is exceeded only the last 1000 are kept. This comes in to >> play >> %% when branches are merged. The comparison has to begin at the same >> place in >> %% the branches. A revision id is of the form N-XXXXXXX where N is the >> current >> %% revision. So each path will have a start number, calculated in >> %% couch_doc:to_path using the formula N - length(RevIds) + 1 So, .eg. i= f >> a doc >> %% was edit 1003 times this start number would be 4, indicating that 3 >> %% revisions were truncated. >> %% >> %% This comes into play in @see merge_at/3 which recursively walks down >> one >> %% tree or the other until they begin at the same revision. >> >> >> On 31 August 2013 19:02, Jens Alfke wrote: >> > The only description I can find about revs_limit is "the maximum numbe= r >> of document revisions that will be tracked by CouchDB, even after >> compaction has occurred." Nothing I've been able to find online says whi= ch >> revisions are thrown out to reach this limit =97 it could be the oldest = ones, >> or the ones most deeply buried, for example. >> > >> > I=92m guessing it=92s most likely the oldest [earliest added] revision= s, >> but it=92s not always clear what those are. For example, if a document w= ith a >> big rev tree gets replicated into this database, all of its revisions ar= e >> the same age as far as the local db is concerned, because they all got >> added in the same PUT operation. >> > >> > Anyone know for sure? >> > >> > =97Jens >> > > --047d7b6d88c8e4272004e5424e71--