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 B9BA39F23 for ; Sat, 10 Mar 2012 19:02:29 +0000 (UTC) Received: (qmail 62847 invoked by uid 500); 10 Mar 2012 19:02:28 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 62812 invoked by uid 500); 10 Mar 2012 19:02:28 -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 62803 invoked by uid 99); 10 Mar 2012 19:02:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Mar 2012 19:02:28 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of matthieu.rakotojaona@gmail.com designates 74.125.82.180 as permitted sender) Received: from [74.125.82.180] (HELO mail-we0-f180.google.com) (74.125.82.180) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Mar 2012 19:02:20 +0000 Received: by werf3 with SMTP id f3so2614618wer.11 for ; Sat, 10 Mar 2012 11:02:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=4m8ackwCBGwW+N2VoXpL7UEcu0HLvQIbdWqZkhiqDcw=; b=WuqY374ShrgdkGKV3k4/YQ/4JrUdxBAb1iFDnEIz2V28GI1YnqaFuqGGRYpEuR1uht kOi56JfyvhPLWD43VVmF+bGeizynzGrKk65Z61+0Knsju3Be9D9vw65eGwKb/mMYmW1U FWSM38OGfKclp++MkDJZhwCFBaDh4qpPPbnkk9fBlK6dzj7AQatzic2hOId+IS5qIuLF rmJzwEvorki7MpqyOsHyP6Fmimh7RE3qfcdx914JapvplZp/LdulB2uHxEt83RevgFXD znr2SVgcelpuFt4OMmYqEnsWpmS6jMZlk4uLUMzdGySqL+0Pj9LXl2xb5SGNjjPNoOmf UcxA== Received: by 10.216.133.39 with SMTP id p39mr3837469wei.40.1331406120321; Sat, 10 Mar 2012 11:02:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.87.14 with HTTP; Sat, 10 Mar 2012 11:01:40 -0800 (PST) In-Reply-To: References: From: Matthieu Rakotojaona Date: Sat, 10 Mar 2012 20:01:40 +0100 Message-ID: Subject: Re: Compaction To: user@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hello, Wow, thank you for the very comprehensive answer. On Thu, Mar 8, 2012 at 10:39 PM, Paul Davis w= rote: >> And the initial purpose to my mail comes here. I just added a few >> documents in my db (1.7+M) and found that the disk_size gives me ~2.5GB. >> while the data_size is around 660 Mo. From what I read, a compaction is >> supposed to leave you with data_size ~=3D disk_size; yet, after numerous >> compaction, it doesn't shrink a bit. >> > > I bet you have random document ids which will indeed cause the > database file to end up with a significant amount of garbage left > after compaction. I'll describe why below. Yup. I already had my ids, but they were not ordered as I read through the file. Now that couchDB stores my rows with its own-generated IDs (with the 'sequential' algorithm), the new size of my whole DB shrank down to 500 MB. Very neat. >> * If yes, can you move the temporary db.compact.couch file somewhere >> =C2=A0 =C2=A0 =C2=A0 =C2=A0else and link to it so that couchdb thinks no= thing has changed ? >> > > I'm not sure what you mean here. In case I see that I will lack storage space, like what happened to me, I would like the .compact file to be created and used in another disk, but I didn't see this in the config file. So I thought something like that would do the trick : 1. Launch compaction 2. Pause it (actually, stop the server for now) 3. Move the .compact created file somewhere else, and symlink to it 4. Continue compaction This flow could also be useful if we want to use an SSD to do a (faster) compaction, later writing the DB back to a classic HDD. I resorted to mounting some directory on my data disk to /var/lib/couchdb, which I'm not really proud of. --=20 Matthieu RAKOTOJAONA