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 56644102E5 for ; Fri, 31 Jan 2014 19:27:52 +0000 (UTC) Received: (qmail 15862 invoked by uid 500); 31 Jan 2014 19:27:50 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 15791 invoked by uid 500); 31 Jan 2014 19:27:50 -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 15782 invoked by uid 99); 31 Jan 2014 19:27:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Jan 2014 19:27:50 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bcitrin@gmail.com designates 209.85.192.176 as permitted sender) Received: from [209.85.192.176] (HELO mail-pd0-f176.google.com) (209.85.192.176) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Jan 2014 19:27:46 +0000 Received: by mail-pd0-f176.google.com with SMTP id w10so4633861pde.35 for ; Fri, 31 Jan 2014 11:27:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=+kwRudSddEI8o6DzWytpWagYlmpS6ipm9Blbm3hvR50=; b=cBrbdSZxKZiMw4FEcVlEO/jFX6PFnOnCWRW6dbKidjmURP39Z1aJGuvPrCAhZBKjuZ CfOI/NVOXQco/jdtvTFD15FyimBEIsXPgUfoSSr6fUTXSGfV5k/gDRVncceKyToLp+Sh UUMyZelG2L2T8Bn9r7if0z2752xpfu3wRvjnWPQdReBR4ixoOdq1P2FoFgAslRByngWR Hm5ECGiZUdiPY5xNnwiapnjHHrs+5G9xdutQkFTzsdlxvF4kB+PFKuwQOkazOKudtqqs 76fPC7gyLy4sniGG97trKlhvgTFA6UEs4bT+ReVd7tr3vTg+RXJXaTa/LfuZWmQbr6H5 4JWQ== MIME-Version: 1.0 X-Received: by 10.68.225.9 with SMTP id rg9mr22879691pbc.122.1391196445973; Fri, 31 Jan 2014 11:27:25 -0800 (PST) Received: by 10.70.85.130 with HTTP; Fri, 31 Jan 2014 11:27:25 -0800 (PST) In-Reply-To: References: <4AD73424-F7BB-49F4-ABC9-43A88D34BDCA@couchbase.com> Date: Fri, 31 Jan 2014 21:27:25 +0200 Message-ID: Subject: Re: Replication vs. Compaction From: Boaz Citrin To: "user@couchdb.apache.org" Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org @Jason - the purpose is that compaction will not catch up with heavy write rate and will affect performance. So I replicate/copy to a side database, compact it, then replicate the new changes from the original and switchover. I wonder if I can omit the compaction if replication gives the same result. Will replication remove old revisions too? On Fri, Jan 31, 2014 at 9:08 PM, Jason Smith wrote: > Anyway I think the broader point is, compaction is for compacting databases > (removing old document revisions), and replication is for making a copy of > a database (or subset). If compaction is causing downtime then that is a > different bug to talk about, but it should be totally transparent. > > Jens (incidentally it's nice to talk with you again): the compactor will > notice that it has not caught up yet, and it will run again from the old > "end" to the real end. Of course, there may be changes during that run too, > so it will repeat. Usually each iteration has a much, much smaller window. > In practice, you tend to see one "not caught up" message in the logs, and > then it's done. However there is a pathological situation where you are > updating faster than the compactor can run, and you will get an infinite > loop (plus very heavy i/o and filesystem waste as the compactor is > basically duplicating your .couch into a .couch.compact forever). > > > On Sat, Feb 1, 2014 at 12:59 AM, Jens Alfke wrote: > >> >> On Jan 31, 2014, at 9:46 AM, Mark Hahn wrote: >> >> > It wouldn't matter if it did. Within the same server linux >> short-circuits >> > http to make it the same as unix sockets, i.e. very little overhead. >> >> I think you mean it short-circuits TCP :) >> There's extra work involved in HTTP generation & parsing no matter what >> transport you're sending it over. And then the replicator is doing a bunch >> of JSON and multipart generation/parsing. >> Whereas the compactor, I would imagine, is mostly just making raw >> read/write calls while walking the b-tree. >> >> Anyway; this makes me wonder what happens when changes are made to a >> database during compaction. The compaction processes working off of a >> snapshot of the database from the point that it started, so it's not going >> to copy over new changes. Does that mean they get lost, or does the >> compactor have extra smarts to run a second phase where it copies over all >> revs created since the snapshot? >> >> --Jens