Re: [PATCH 1/3] database: Add notmuch_database_compact_close
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 2 Nov 2013 18:30:43 +0000 (11:30 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:56 +0000 (09:57 -0800)
3f/350445dd319251b6f0cea1575caca1acf1dbe6 [new file with mode: 0644]

diff --git a/3f/350445dd319251b6f0cea1575caca1acf1dbe6 b/3f/350445dd319251b6f0cea1575caca1acf1dbe6
new file mode 100644 (file)
index 0000000..ea8a7c1
--- /dev/null
@@ -0,0 +1,148 @@
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1A348431FBF\r
+       for <notmuch@notmuchmail.org>; Sat,  2 Nov 2013 11:31:03 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id Q8hI8uwNI80F for <notmuch@notmuchmail.org>;\r
+       Sat,  2 Nov 2013 11:30:55 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id B57B4431FAF\r
+       for <notmuch@notmuchmail.org>; Sat,  2 Nov 2013 11:30:55 -0700 (PDT)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by fire-doxen-postvirus (Postfix) with ESMTP id 42E6832803B;\r
+       Sat,  2 Nov 2013 11:30:55 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from finestructure.net (cpe-76-173-75-27.socal.res.rr.com\r
+       [76.173.75.27]) (Authenticated sender: jrollins)\r
+       by fire-doxen-submit (Postfix) with ESMTP id 59DA92E50DF9;\r
+       Sat,  2 Nov 2013 11:30:54 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id 9CF2B600B0; Sat,  2 Nov 2013 11:30:45 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Ben Gamari <bgamari.foss@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/3] database: Add notmuch_database_compact_close\r
+In-Reply-To: <1380745848-4972-2-git-send-email-bgamari.foss@gmail.com>\r
+References: <1380745848-4972-1-git-send-email-bgamari.foss@gmail.com>\r
+       <1380745848-4972-2-git-send-email-bgamari.foss@gmail.com>\r
+User-Agent: Notmuch/0.16+120~gfd733a4 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sat, 02 Nov 2013 11:30:43 -0700\r
+Message-ID: <87habuirl8.fsf@servo.finestructure.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha256; protocol="application/pgp-signature"\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 02 Nov 2013 18:31:03 -0000\r
+\r
+--=-=-=\r
+Content-Type: text/plain\r
+\r
+On Wed, Oct 02 2013, Ben Gamari <bgamari.foss@gmail.com> wrote:\r
+> +/* Compacts the given database, optionally saving the original database\r
+> + * in backup_path. Additionally, a callback function can be provided to\r
+> + * give the user feedback on the progress of the (likely long-lived)\r
+> + * compaction process.\r
+> + *\r
+> + * The backup path must point to a directory on the same volume as the\r
+> + * original database. Passing a NULL backup_path will result in the\r
+> + * uncompacted database being deleted after compaction has finished.\r
+> + * Note that the database write lock will be held during the\r
+> + * compaction process to protect data integrity.\r
+> + */\r
+> +notmuch_status_t\r
+> +notmuch_database_compact (const char* path,\r
+> +                      const char* backup_path,\r
+> +                      notmuch_compact_status_cb_t status_cb)\r
+> +{\r
+> +    void *local = talloc_new (NULL);\r
+> +    NotmuchCompactor compactor(status_cb);\r
+> +    char *notmuch_path, *xapian_path, *compact_xapian_path;\r
+> +    char *old_xapian_path = NULL;\r
+> +    notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;\r
+> +    notmuch_database_t *notmuch = NULL;\r
+> +    struct stat statbuf;\r
+> +\r
+> +    ret = notmuch_database_open(path, NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch);\r
+> +    if (ret) {\r
+> +    goto DONE;\r
+> +    }\r
+> +\r
+> +    if (! (notmuch_path = talloc_asprintf (local, "%s/%s", path, ".notmuch"))) {\r
+> +    ret = NOTMUCH_STATUS_OUT_OF_MEMORY;\r
+> +    goto DONE;\r
+> +    }\r
+> +\r
+> +    if (! (xapian_path = talloc_asprintf (local, "%s/%s", notmuch_path, "xapian"))) {\r
+> +    ret = NOTMUCH_STATUS_OUT_OF_MEMORY;\r
+> +    goto DONE;\r
+> +    }\r
+> +\r
+> +    if (! (compact_xapian_path = talloc_asprintf (local, "%s.compact", xapian_path))) {\r
+> +    ret = NOTMUCH_STATUS_OUT_OF_MEMORY;\r
+> +    goto DONE;\r
+> +    }\r
+> +\r
+> +    if (backup_path != NULL) {\r
+> +    if (! (old_xapian_path = talloc_asprintf (local, "%s/xapian.old", backup_path))) {\r
+> +        ret = NOTMUCH_STATUS_OUT_OF_MEMORY;\r
+> +        goto DONE;\r
+> +    }\r
+\r
+Hey, folks.  I'm obviously late for this, but I just got around to\r
+testing the new compact functionality now and I wanted to comment on the\r
+path for the old xapian directory.  It seems to me that\r
+\r
+  <notmuch_path>/xapian.old\r
+\r
+isn't the right place for it.  I would think that\r
+\r
+  <xapian_path>.old\r
+\r
+would be a much better place.  I'm not such a fan of dumping internal\r
+notmuch stuff into the main mail directory.  Keeping all notmuch stuff\r
+in <notmuch_path> seems more reasonable and polite.\r
+\r
+jamie.\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.15 (GNU/Linux)\r
+\r
+iQIcBAEBCAAGBQJSdUTTAAoJEO00zqvie6q8bX0P+wXFd5IbVkX1i5vM2NtuGHDC\r
+pgIgnB2RbKIzjTKiZ7LdojjPIkuf0tHFN415mpfsYruJQXQLiUgOtqwb1VIVJNB3\r
+T3QleWDEzcFN0X8Nh2tDh3nCXa3+/IXWkkp237HR6YaycA5UE18f4Q9Mx6wIHxz7\r
+SQvGGVFHcnRg5wNVOm3H/bnepJnWYe2j4lrFyDZHcMSq4e6/Ph3vTlIqX8mfznFC\r
+zZ+pArfNGYndT0+oqSSS9ngNlRbFAiOH7KeBUzrNd2igN+MVbdxCj4wxJPzX477Z\r
+GooAAFpQ0QLZSh9kjuzXqDMJAE0J6pUPSnKKt3QP85vUuDqss2g5rw16cFrMKg5Z\r
+bmTPrkbkamuJJlfab45NQo5QcHjPVss4Ov2nycorjhLATEHG3srA1GorY6aG6l6n\r
+MlsGm7S7EQmbtEwVdBW66GtCzbFNExvKSLkY3jXB4CesnsPyRxxH6/uEFDhIKzdf\r
+qoFtnYc5PKOcj8wJu1fyMUM0cc4CdXtSFb/Ukfsx+nIr1gOs2F+3risy/m2SP8u/\r
+9d6wH1p+TulqmBSIx0w4vjko1HifY8yRMcxgDswdciDVja6CECAPdHUu/RKmlBwl\r
+hyH4ic9RoMGaSSo4TJBwEnzgz3u7pmqonkcqWfnDizL8hxjYS7xKuICWHwjLzSq8\r
+ajIn9+13a1Zj23+d5Z8e\r
+=KQ4Y\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r