Re: [PATCH] lib: Simplify close and codify aborting atomic section
[notmuch-archives.git] / 66 / 8a91092fce51cdacc7eb46dba7dafa1597cec3
diff --git a/66/8a91092fce51cdacc7eb46dba7dafa1597cec3 b/66/8a91092fce51cdacc7eb46dba7dafa1597cec3
new file mode 100644 (file)
index 0000000..6eb6110
--- /dev/null
@@ -0,0 +1,144 @@
+Return-Path: <wking@tremily.us>\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 1309A431FAF\r
+       for <notmuch@notmuchmail.org>; Wed, 24 Sep 2014 11:18:55 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.1\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       RCVD_IN_DNSWL_NONE=-0.0001] 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 USBT1VmM-YhC for <notmuch@notmuchmail.org>;\r
+       Wed, 24 Sep 2014 11:18:47 -0700 (PDT)\r
+Received: from resqmta-po-10v.sys.comcast.net (resqmta-po-10v.sys.comcast.net\r
+       [96.114.154.169])\r
+       (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8EF68431FB6\r
+       for <notmuch@notmuchmail.org>; Wed, 24 Sep 2014 11:18:47 -0700 (PDT)\r
+Received: from resomta-po-05v.sys.comcast.net ([96.114.154.229])\r
+       by resqmta-po-10v.sys.comcast.net with comcast\r
+       id v6Hg1o0054xDoy8016JmzM; Wed, 24 Sep 2014 18:18:46 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by resomta-po-05v.sys.comcast.net with comcast\r
+       id v6Jk1o00Z152l3L016JlmV; Wed, 24 Sep 2014 18:18:46 +0000\r
+Received: by odin.tremily.us (Postfix, from userid 1000)\r
+       id 5E02013AAE54; Wed, 24 Sep 2014 11:18:44 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;\r
+       t=1411582724; bh=ESxq4zvkO7kDZZsV0WbZ6eHX4vMoVbfXfq+1N6BjDwM=;\r
+       h=Date:From:To:Cc:Subject:References:In-Reply-To;\r
+       b=ONVCOwS6udawzn9MEri4X5nJo6eqx99MUXh0nfpH69T0IpakTRAKynGdGX/BTaTfR\r
+       xeKtkVn4BFrnHITiRwix94jQu++EuHOUO+PaUMnZ4YI3FBQkRG/ZXtARWv9t1RtgY7\r
+       3w/sszkyb3riurpDmU57RmcYLw63uksPeImvi/aI=\r
+Date: Wed, 24 Sep 2014 11:18:44 -0700\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: David Bremner <david@tethera.net>\r
+Subject: Re: [PATCH] lib: Simplify close and codify aborting atomic section\r
+Message-ID: <20140924181844.GB20130@odin.tremily.us>\r
+References: <1411400615-20934-1-git-send-email-amdragon@mit.edu>\r
+       <20140922165954.GI20827@odin.tremily.us>\r
+       <20140922185050.GB7970@csail.mit.edu>\r
+       <20140922190022.GO20827@odin.tremily.us>\r
+       <87iokc28mg.fsf@maritornes.cs.unb.ca>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; micalg=pgp-sha1;\r
+       protocol="application/pgp-signature"; boundary="1UWUbFP1cBYEclgG"\r
+Content-Disposition: inline\r
+In-Reply-To: <87iokc28mg.fsf@maritornes.cs.unb.ca>\r
+OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8;\r
+       url=http://tremily.us/pubkey.txt\r
+User-Agent: Mutt/1.5.23 (2014-03-12)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20140121; t=1411582726;\r
+       bh=eRafiU43Gwq9vkf0njWP4NVZ12XLeJfHqI1u0bYFxUc=;\r
+       h=Received:Received:Received:Date:From:To:Subject:Message-ID:\r
+       MIME-Version:Content-Type;\r
+       b=R7oxq4ODApSoEEGXge3LQtWCg1wyoI9apqJKLQv8vlf9kJxxRM9MoERSyCFoAh71F\r
+       kjZuIihPwiFxdteZusNImvtJXlPxqnvEldnqpf+/4XZgbtBnSgOeV0QwOQGIYb4aiy\r
+       kJIvQqHLLdIeCULHhYL81VTD0HFt4+o6VM0qt7n4ejrRMLsW4d1cFO5e75PvxCuuVG\r
+       /ghysKsaedyEAZ8rM0jKbb1exBCoOgQOzOpJGjxhA4e9gK+xoSGmrndmMgVUkG4wT1\r
+       dErHt3xD0AWnfNQW9saTFDFXPa/AYlrwtCGQHyg6C/L590b8Fg/VB5GD0k7R7+rPnO\r
+       qHl/scA+QpIOw==\r
+Cc: notmuch@notmuchmail.org\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: Wed, 24 Sep 2014 18:18:55 -0000\r
+\r
+\r
+--1UWUbFP1cBYEclgG\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Wed, Sep 24, 2014 at 08:09:27PM +0200, David Bremner wrote:\r
+> W. Trevor King writes:\r
+> > Ah, I thought the implicit flush/commit was just in our code.\r
+> > Since it's also in the underlying Xapian close, then this patch\r
+> > looks pretty good to me.  I'd mention Xapian's explicit close in\r
+> > the notmuch.h message.  Xapain's docs say [1]:\r
+> >\r
+> >   For a WritableDatabase, if a transaction is active it will be\r
+> >   aborted, while if no transaction is active commit() will be\r
+> >   implicitly called.\r
+>=20\r
+> I'm not sure what you're asking for here by "explicit close". Isn't\r
+> what you quote a restatement of\r
+>=20\r
+> + * If the caller is currently in an atomic section (there was a\r
+> + * notmuch_database_begin_atomic without a matching\r
+> + * notmuch_database_end_atomic), this will abort the atomic section,\r
+> + * discarding any modifications made in the atomic section.\r
+>=20\r
+> in terms of underyling Xapian mechanics?\r
+\r
+Sorry, I didn't phrase that very well.  The notmuch docs (as of this\r
+patch) explain that we don't commit if we're in an atomic block.  The\r
+Xapian docs also say that, *and* they say that if we're not in atomic\r
+block the close *does* try to commit.  I think that's worth mentioning\r
+in our close docs.\r
+\r
+Cheers,\r
+Trevor\r
+\r
+--=20\r
+This email may be signed or encrypted with GnuPG (http://www.gnupg.org).\r
+For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\r
+\r
+--1UWUbFP1cBYEclgG\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+Content-Description: OpenPGP digital signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v2\r
+\r
+iQIcBAEBAgAGBQJUIwsBAAoJEG8/JgBt8ol8G+wP/15WCG6fH4ZKsKy9s5hBJz6X\r
+PkqY3ZE7ahjTIBJzRlnCLecOiSsh1NmBGswJuC0WdGfvfJmL4qTrXxaQR9qIZszx\r
+YLeBMdgeFxNX0TfvMI8UG7KPgOxe65uGYA33/EGScIluWnrKRq+xIv8itL5+0WaE\r
+q7YCiZ9HUTHhIKFR0UOBPqPkovAk52y6cZEssTZMo5CX/ULdgm3BeqOOFfH2PZIP\r
+6QHRPrhNiv9bCVOVNs+Yvvfsd77mdGdWH7T6SqE1E3YYeexga8nJanCy0bwKKgWV\r
+S7AYOKIdP3RQsjTNY1m+6+bhvLDNClMJFgSYFygYDYk/jog8hXvyeApwluSD19oM\r
+TJ/+Y7Hlkvt63GU61jHl85XoHvGAM3X/A02veVeyJFzSsE4FoMAfVcbnRNIGTtoh\r
+TDLUAB/FNGTvigIy8tkDoP1Y+zIcyK16oFiedLh3+IJ78iwZqGdXJKWm6AiXa6Np\r
+5thE4hwGZ5npMnLUnnIApZaXmo6nnBBZNaLdEvo5Dj2u+aP69KOsRlPbeU+9rEue\r
+s2rsDbBTD+J7z6dZsoTYEEVk9itO/lLl5/YHvaU1raOvjEycNkbhm6V5qjEnGUpI\r
+699Yer/p+mMrgdPCz9hcndIv87wKGi6+bZni6f3Ht0qIz/BVLqRTw/cy9/ZWpkI2\r
+pJJbArp9gJhUcL0p2C6w\r
+=EudI\r
+-----END PGP SIGNATURE-----\r
+\r
+--1UWUbFP1cBYEclgG--\r