From: Austin Clements Date: Mon, 22 Sep 2014 18:50:50 +0000 (+0000) Subject: Re: [PATCH] lib: Simplify close and codify aborting atomic section X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bdc35ce441ff0bdb740940d921e65a13478e17ae;p=notmuch-archives.git Re: [PATCH] lib: Simplify close and codify aborting atomic section --- diff --git a/1d/ad271754ca6d42db3c7d56c9420fea2be189aa b/1d/ad271754ca6d42db3c7d56c9420fea2be189aa new file mode 100644 index 000000000..06f2655a3 --- /dev/null +++ b/1d/ad271754ca6d42db3c7d56c9420fea2be189aa @@ -0,0 +1,70 @@ +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 1109C431FC0 + for ; Mon, 22 Sep 2014 11:50:56 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.3 +X-Spam-Level: +X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3] 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 FvGeX6Z7Odgz for ; + Mon, 22 Sep 2014 11:50:52 -0700 (PDT) +Received: from outgoing.csail.mit.edu (outgoing.csail.mit.edu [128.30.2.149]) + by olra.theworths.org (Postfix) with ESMTP id 91494431FB6 + for ; Mon, 22 Sep 2014 11:50:52 -0700 (PDT) +Received: from [104.131.20.129] (helo=awakeningjr) + by outgoing.csail.mit.edu with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) + (Exim 4.72) (envelope-from ) + id 1XW8hH-00077r-BS; Mon, 22 Sep 2014 14:50:51 -0400 +Received: from amthrax by awakeningjr with local (Exim 4.84) + (envelope-from ) + id 1XW8hG-00076x-JI; Mon, 22 Sep 2014 18:50:50 +0000 +Date: Mon, 22 Sep 2014 18:50:50 +0000 +From: Austin Clements +To: "W. Trevor King" +Subject: Re: [PATCH] lib: Simplify close and codify aborting atomic section +Message-ID: <20140922185050.GB7970@csail.mit.edu> +References: <1411400615-20934-1-git-send-email-amdragon@mit.edu> + <20140922165954.GI20827@odin.tremily.us> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20140922165954.GI20827@odin.tremily.us> +User-Agent: Mutt/1.5.23 (2014-03-12) +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 18:50:56 -0000 + +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. +> +> 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). + +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.