From: W. Trevor King Date: Mon, 22 Sep 2014 19:00:22 +0000 (+1700) Subject: Re: [PATCH] lib: Simplify close and codify aborting atomic section X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4d6fcae7c0f47cc4049f1411e1a4dd391736edc5;p=notmuch-archives.git Re: [PATCH] lib: Simplify close and codify aborting atomic section --- diff --git a/f8/e123bd22aad7f0e31525cea39ecb5c8be7986f b/f8/e123bd22aad7f0e31525cea39ecb5c8be7986f new file mode 100644 index 000000000..8aa51e0b8 --- /dev/null +++ b/f8/e123bd22aad7f0e31525cea39ecb5c8be7986f @@ -0,0 +1,148 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 14135431FC0 + for ; Mon, 22 Sep 2014 12:00:29 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.1 +X-Spam-Level: +X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id TxXEoqq9AeG0 for ; + Mon, 22 Sep 2014 12:00:25 -0700 (PDT) +Received: from resqmta-po-04v.sys.comcast.net (resqmta-po-04v.sys.comcast.net + [96.114.154.163]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 1158D431FB6 + for ; Mon, 22 Sep 2014 12:00:25 -0700 (PDT) +Received: from resomta-po-08v.sys.comcast.net ([96.114.154.232]) + by resqmta-po-04v.sys.comcast.net with comcast + id uJyo1o004516pyw01K0QYv; Mon, 22 Sep 2014 19:00:24 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by resomta-po-08v.sys.comcast.net with comcast + id uK0P1o008152l3L01K0Pjx; Mon, 22 Sep 2014 19:00:24 +0000 +Received: by odin.tremily.us (Postfix, from userid 1000) + id 1533E13A7891; Mon, 22 Sep 2014 12:00:22 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin; + t=1411412423; bh=L0pza3r2wiztdH8PAeBCdOolv1u+hBM3gHCkZ/9B7SI=; + h=Date:From:To:Cc:Subject:References:In-Reply-To; + b=rQq0K0zb6f6u6j33d94snCkyCuMuDqoSfX8vMDsfcSZ1tjbG5YvY0JZkKtrYBfw6U + s/aD460zMjyFBsSq807qpoItliTY05R+mCr/lpvmqfcXXsRTu/4d/euWTNH4PE9Xnh + +SSmBgRLMfyqLJ7gEL5tvCvQGblQmiWmy7cXlxz4= +Date: Mon, 22 Sep 2014 12:00:22 -0700 +From: "W. Trevor King" +To: Austin Clements +Subject: Re: [PATCH] lib: Simplify close and codify aborting atomic section +Message-ID: <20140922190022.GO20827@odin.tremily.us> +References: <1411400615-20934-1-git-send-email-amdragon@mit.edu> + <20140922165954.GI20827@odin.tremily.us> + <20140922185050.GB7970@csail.mit.edu> +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="5PFZVUeDPxlnBcQp" +Content-Disposition: inline +In-Reply-To: <20140922185050.GB7970@csail.mit.edu> +OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8; + url=http://tremily.us/pubkey.txt +User-Agent: Mutt/1.5.23 (2014-03-12) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; + s=q20140121; t=1411412424; + bh=0K3jMy7/3YhBPLD15lLqIXDY/1ZRCDxMS9iIkPOap0o=; + h=Received:Received:Received:Date:From:To:Subject:Message-ID: + MIME-Version:Content-Type; + b=JR35izmixUIMyvRGG2ZsZKsTDvg9EE6c8JIFLeXmpW64oyqANIeuVo2gTMRFt2mDp + AyO/Ux2vciZvf+0Cv0eE/FG6aKqkWdTanUIcrRpyGidOh9utMfNUTYnz9VMZ3CR2uF + k+bLOGCerhNw1LMrPln6hZILB6ozH8I9STtAT8HHQ04ORtzmzIewi84Ty8daVt9aV5 + V3t/A1GPGBQOdK5vFgUGbGN8IajsCa4dnHx3A0Jxh6g32iXG765aFelQZGu8Z51pC5 + Ko6sqUL3uH8XokXiLCTGDcWMZHNJZMUuoOOu064qitBSXXUD+T2GzAVDj9rBFOpHhc + v1M2GtzAzMJEA== +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 22 Sep 2014 19:00:29 -0000 + + +--5PFZVUeDPxlnBcQp +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +On Mon, Sep 22, 2014 at 06:50:50PM +0000, Austin Clements wrote: +> Quoth W. Trevor King on Sep 22 at 9:59 am: +> > On Mon, Sep 22, 2014 at 11:43:35AM -0400, Austin Clements wrote: +> > > This patch simplifies notmuch_database_close to just call +> > > Database::close. This works for both read-only and read/write +> > > databases, takes care of committing changes, unifies the +> > > exception handling path, and codifies aborting outstanding +> > > transactions. +> >=20 +> > If we're dropping the flush call here, where will it be triggered +> > instead? We'll need to flush/commit our changes to the database +> > at some point before closing. Do clients now need an explicit +> > flush/commit command (explicit, client-initiated flushes sound +> > like a good idea to me). +>=20 +> The call to Database::close implicitly flushes/commits, as mentioned +> in the comment in the patch, so there's no need for any new APIs or +> client changes. The call to Database::flush in +> notmuch_database_close was entirely redundant with the call to +> Database::close. + +Ah, I thought the implicit flush/commit was just in our code. Since +it's also in the underlying Xapian close, then this patch looks pretty +good to me. I'd mention Xapian's explicit close in the notmuch.h +message. Xapain's docs say [1]: + + For a WritableDatabase, if a transaction is active it will be + aborted, while if no transaction is active commit() will be + implicitly called. + +Cheers, +Trevor + +[1]: http://xapian.org/docs/apidoc/html/classXapian_1_1Database.html#a59f5f= +8b137723dcaaabdbdccbc0cf1eb + +--=20 +This email may be signed or encrypted with GnuPG (http://www.gnupg.org). +For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy + +--5PFZVUeDPxlnBcQp +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2 + +iQIcBAEBAgAGBQJUIHHEAAoJEG8/JgBt8ol8TD0P/25sw/RjQN+51URpyT4wAGJg +i89pJ/QBSFz2sk9F/K2GzuOA8LzMqWr1lImQIdi1ypMjHGmmfxkuNWUYWvgQHpc1 +KLKaSXql6FAY5KD4mtPGFlLUa9CKNWOqBKwrVRBSjs7UqT8fN+C24XbYA6qnCB0C +Z84TLTxa/4UOpu8nZABASSkWmWcmXphpSdUKzBSLLG6o9iSmaY3YyEXVSfREEV2S +OqmuzOGlxO03hS3j/zOdOrs8CHYrsDvq0kWZZWS7hBIDidZbuXpAsrRJTxpwUScd +o/wjLCfzogyvQhLZZC81LLtACVNkkfhZqES+Bb01cO+/Aoh+GSs0/xn1Qz3kazH1 +/IA41Cod+EiE5Wmdx+3D6fK/fkM0NkUcXaE4S6x/AfPYfoeOkKNTBmuA5FjK4N/I +vRiHJAaneUZ6O7wd5xuCe6tgOfXZuNcubdC5p2i9pB+3n03SbzLadBF/ezE8vG2z +srwI37UuPPx/CH1OTtBN8SOab3dbPuuyfI77kbgzhOaPsIsUSiAQutTojEX0p8VE +4rmuv8lfP2gRawO+if7WQUViRSYJrBsLK4U7kl+uEaCKa3uW1rRAXXUtwJfYjwVU +XJwY+wA3pHOibfiFaHcGV0XRMkOQ4XnP8PMBI6NVy9rEjwjuD6wzcpHALYpJcAkj +ZRS7f4VOe+/2kmh3Ot/7 +=YbTe +-----END PGP SIGNATURE----- + +--5PFZVUeDPxlnBcQp--