Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 93631 invoked from network); 24 Jan 2011 21:06:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jan 2011 21:06:10 -0000 Received: (qmail 19879 invoked by uid 500); 24 Jan 2011 21:06:08 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 19829 invoked by uid 500); 24 Jan 2011 21:06: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 19821 invoked by uid 99); 24 Jan 2011 21:06:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jan 2011 21:06:08 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.215.52] (HELO mail-ew0-f52.google.com) (209.85.215.52) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jan 2011 21:06:01 +0000 Received: by ewy23 with SMTP id 23so2046241ewy.11 for ; Mon, 24 Jan 2011 13:05:40 -0800 (PST) MIME-Version: 1.0 Received: by 10.14.17.93 with SMTP id i69mr4906813eei.18.1295903139324; Mon, 24 Jan 2011 13:05:39 -0800 (PST) Received: by 10.14.45.73 with HTTP; Mon, 24 Jan 2011 13:05:39 -0800 (PST) X-Originating-IP: [65.47.31.86] In-Reply-To: <4D3DDA42.1040807@ianhobson.co.uk> References: <4D3DBBBE.30902@databill.com> <4D3DDA42.1040807@ianhobson.co.uk> Date: Mon, 24 Jan 2011 13:05:39 -0800 Message-ID: Subject: Re: Using the API to tell if a compact has been done From: Mark Anderson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable One approach I've been playing with is a patch to couchdb to record the sequence number at which the last compact was performed, and adding this value to the db info blob. This lets me get a sense of how much the database has aged since the last compaction, as well as being able to tell a compaction has completed successfully by a incremented compact sequence. If people are interested I can clean up and post it as a patch to 1.0.x A little background: I've been working on improving compaction of couchdb databases in my spare time. Opscode's particular (ab)use case generates a pretty heavy write update load, with large json blobs being frequently replaced. This not only causes a very rapid bloat of the couch files, but often causes load induced crashes of the compaction process (it seems to be bottlenecking on the couch ref counter). Knowing if a compaction finished successfully is very helpful in that circumstance. On Mon, Jan 24, 2011 at 12:00 PM, Ian Hobson wrote: > On 24/01/2011 17:49, Wayne Conrad wrote: >> >> I've subscribed again, from another email address, because the list >> decided that my first subscribtion was a eeeeevil spammer. =A0I hope tha= t's >> OK. =A0Anyhow... >> >> I've written a cron job that periodically compacts all databases on all >> servers, but it needs an automated test, and an automated test needs a w= ay >> to know that compaction happend (or, at least, was triggered). =A0Other = than >> seeing the file size change, is there anything I can do from the API tha= t >> will show that my cron job caused compaction to happen? >> > Hi Wayne, > > If you can create the database you are to compact, then you can use the > rev=3D??? parameter. > > Set up the database, and note the rev of a document =A0(=3D oldrev) > Update the document (creating _rev=3Dnewrev). oldrev is now on disk, but = not > normally available. > > Read the old version using the rev=3Doldrev parameter. > > Trigger the compaction and wait for it to finish (A 1 record database won= 't > take long to compact :) ) > > Read the old record again. This time it won't be found if the compaction = has > run. > > See > http://wiki.apache.org/couchdb/HTTP_Document_API#Accessing_Previous_Revis= ions > > Regards > > Ian > > >