1 Return-Path: <jrollins@finestructure.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 1A348431FBF
\r
6 for <notmuch@notmuchmail.org>; Sat, 2 Nov 2013 11:31:03 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id Q8hI8uwNI80F for <notmuch@notmuchmail.org>;
\r
16 Sat, 2 Nov 2013 11:30:55 -0700 (PDT)
\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
19 by olra.theworths.org (Postfix) with ESMTP id B57B4431FAF
\r
20 for <notmuch@notmuchmail.org>; Sat, 2 Nov 2013 11:30:55 -0700 (PDT)
\r
21 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
22 by fire-doxen-postvirus (Postfix) with ESMTP id 42E6832803B;
\r
23 Sat, 2 Nov 2013 11:30:55 -0700 (PDT)
\r
24 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new
\r
25 Received: from finestructure.net (cpe-76-173-75-27.socal.res.rr.com
\r
26 [76.173.75.27]) (Authenticated sender: jrollins)
\r
27 by fire-doxen-submit (Postfix) with ESMTP id 59DA92E50DF9;
\r
28 Sat, 2 Nov 2013 11:30:54 -0700 (PDT)
\r
29 Received: by finestructure.net (Postfix, from userid 1000)
\r
30 id 9CF2B600B0; Sat, 2 Nov 2013 11:30:45 -0700 (PDT)
\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
32 To: Ben Gamari <bgamari.foss@gmail.com>, notmuch@notmuchmail.org
\r
33 Subject: Re: [PATCH 1/3] database: Add notmuch_database_compact_close
\r
34 In-Reply-To: <1380745848-4972-2-git-send-email-bgamari.foss@gmail.com>
\r
35 References: <1380745848-4972-1-git-send-email-bgamari.foss@gmail.com>
\r
36 <1380745848-4972-2-git-send-email-bgamari.foss@gmail.com>
\r
37 User-Agent: Notmuch/0.16+120~gfd733a4 (http://notmuchmail.org) Emacs/24.3.1
\r
38 (x86_64-pc-linux-gnu)
\r
39 Date: Sat, 02 Nov 2013 11:30:43 -0700
\r
40 Message-ID: <87habuirl8.fsf@servo.finestructure.net>
\r
42 Content-Type: multipart/signed; boundary="=-=-=";
\r
43 micalg=pgp-sha256; protocol="application/pgp-signature"
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Sat, 02 Nov 2013 18:31:03 -0000
\r
59 Content-Type: text/plain
\r
61 On Wed, Oct 02 2013, Ben Gamari <bgamari.foss@gmail.com> wrote:
\r
62 > +/* Compacts the given database, optionally saving the original database
\r
63 > + * in backup_path. Additionally, a callback function can be provided to
\r
64 > + * give the user feedback on the progress of the (likely long-lived)
\r
65 > + * compaction process.
\r
67 > + * The backup path must point to a directory on the same volume as the
\r
68 > + * original database. Passing a NULL backup_path will result in the
\r
69 > + * uncompacted database being deleted after compaction has finished.
\r
70 > + * Note that the database write lock will be held during the
\r
71 > + * compaction process to protect data integrity.
\r
74 > +notmuch_database_compact (const char* path,
\r
75 > + const char* backup_path,
\r
76 > + notmuch_compact_status_cb_t status_cb)
\r
78 > + void *local = talloc_new (NULL);
\r
79 > + NotmuchCompactor compactor(status_cb);
\r
80 > + char *notmuch_path, *xapian_path, *compact_xapian_path;
\r
81 > + char *old_xapian_path = NULL;
\r
82 > + notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
\r
83 > + notmuch_database_t *notmuch = NULL;
\r
84 > + struct stat statbuf;
\r
86 > + ret = notmuch_database_open(path, NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much);
\r
91 > + if (! (notmuch_path = talloc_asprintf (local, "%s/%s", path, ".notmuch"))) {
\r
92 > + ret = NOTMUCH_STATUS_OUT_OF_MEMORY;
\r
96 > + if (! (xapian_path = talloc_asprintf (local, "%s/%s", notmuch_path, "xapian"))) {
\r
97 > + ret = NOTMUCH_STATUS_OUT_OF_MEMORY;
\r
101 > + if (! (compact_xapian_path = talloc_asprintf (local, "%s.compact", xapian_path))) {
\r
102 > + ret = NOTMUCH_STATUS_OUT_OF_MEMORY;
\r
106 > + if (backup_path != NULL) {
\r
107 > + if (! (old_xapian_path = talloc_asprintf (local, "%s/xapian.old", backup_path))) {
\r
108 > + ret = NOTMUCH_STATUS_OUT_OF_MEMORY;
\r
112 Hey, folks. I'm obviously late for this, but I just got around to
\r
113 testing the new compact functionality now and I wanted to comment on the
\r
114 path for the old xapian directory. It seems to me that
\r
116 <notmuch_path>/xapian.old
\r
118 isn't the right place for it. I would think that
\r
122 would be a much better place. I'm not such a fan of dumping internal
\r
123 notmuch stuff into the main mail directory. Keeping all notmuch stuff
\r
124 in <notmuch_path> seems more reasonable and polite.
\r
129 Content-Type: application/pgp-signature
\r
131 -----BEGIN PGP SIGNATURE-----
\r
132 Version: GnuPG v1.4.15 (GNU/Linux)
\r
134 iQIcBAEBCAAGBQJSdUTTAAoJEO00zqvie6q8bX0P+wXFd5IbVkX1i5vM2NtuGHDC
\r
135 pgIgnB2RbKIzjTKiZ7LdojjPIkuf0tHFN415mpfsYruJQXQLiUgOtqwb1VIVJNB3
\r
136 T3QleWDEzcFN0X8Nh2tDh3nCXa3+/IXWkkp237HR6YaycA5UE18f4Q9Mx6wIHxz7
\r
137 SQvGGVFHcnRg5wNVOm3H/bnepJnWYe2j4lrFyDZHcMSq4e6/Ph3vTlIqX8mfznFC
\r
138 zZ+pArfNGYndT0+oqSSS9ngNlRbFAiOH7KeBUzrNd2igN+MVbdxCj4wxJPzX477Z
\r
139 GooAAFpQ0QLZSh9kjuzXqDMJAE0J6pUPSnKKt3QP85vUuDqss2g5rw16cFrMKg5Z
\r
140 bmTPrkbkamuJJlfab45NQo5QcHjPVss4Ov2nycorjhLATEHG3srA1GorY6aG6l6n
\r
141 MlsGm7S7EQmbtEwVdBW66GtCzbFNExvKSLkY3jXB4CesnsPyRxxH6/uEFDhIKzdf
\r
142 qoFtnYc5PKOcj8wJu1fyMUM0cc4CdXtSFb/Ukfsx+nIr1gOs2F+3risy/m2SP8u/
\r
143 9d6wH1p+TulqmBSIx0w4vjko1HifY8yRMcxgDswdciDVja6CECAPdHUu/RKmlBwl
\r
144 hyH4ic9RoMGaSSo4TJBwEnzgz3u7pmqonkcqWfnDizL8hxjYS7xKuICWHwjLzSq8
\r
145 ajIn9+13a1Zj23+d5Z8e
\r
147 -----END PGP SIGNATURE-----
\r