From 2194b32f4f46e36d52780f896793e3d2231d259e Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 25 Aug 2014 18:16:29 +2000 Subject: [PATCH] Re: [PATCH v3 04/13] lib: Database version 3: Introduce fine-grained "features" --- d7/735eda02225e56f64081d9d2975c5e039ef091 | 132 ++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 d7/735eda02225e56f64081d9d2975c5e039ef091 diff --git a/d7/735eda02225e56f64081d9d2975c5e039ef091 b/d7/735eda02225e56f64081d9d2975c5e039ef091 new file mode 100644 index 000000000..5e85f6148 --- /dev/null +++ b/d7/735eda02225e56f64081d9d2975c5e039ef091 @@ -0,0 +1,132 @@ +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 74A2C431FAF + for ; Sun, 24 Aug 2014 15:16:39 -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 wRZMQHwwvaQB for ; + Sun, 24 Aug 2014 15:16:33 -0700 (PDT) +Received: from dmz-mailsec-scanner-7.mit.edu (dmz-mailsec-scanner-7.mit.edu + [18.7.68.36]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 2481F431FAE + for ; Sun, 24 Aug 2014 15:16:33 -0700 (PDT) +X-AuditID: 12074424-f79346d000004923-57-53fa64406de8 +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + (using TLS with cipher AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP + id 18.D1.18723.0446AF35; Sun, 24 Aug 2014 18:16:32 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s7OMGVWx001120; + Sun, 24 Aug 2014 18:16:32 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s7OMGTtC026194 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Sun, 24 Aug 2014 18:16:30 -0400 +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1XLg5N-0000eB-AW; Sun, 24 Aug 2014 18:16:29 -0400 +Date: Sun, 24 Aug 2014 18:16:29 -0400 +From: Austin Clements +To: David Bremner +Subject: Re: [PATCH v3 04/13] lib: Database version 3: Introduce fine-grained + "features" +Message-ID: <20140824221629.GP3015@mit.edu> +References: <1406859003-11561-1-git-send-email-amdragon@mit.edu> + <1406859003-11561-5-git-send-email-amdragon@mit.edu> + <87ppfqsv8s.fsf@maritornes.cs.unb.ca> + <87fvgmg0tx.fsf@awakening.csail.mit.edu> + <87zjeu4jyp.fsf@maritornes.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87zjeu4jyp.fsf@maritornes.cs.unb.ca> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IR4hTV1nVI+RVs8Oy1gsWN1m5Gi+s3ZzI7 + MHk8W3WL2WPLoffMAUxRXDYpqTmZZalF+nYJXBlvP7MWzBCsuHhgClsD41PeLkZODgkBE4l/ + d64wQdhiEhfurWfrYuTiEBKYzSSxcMozRghnI6PExo9XWCGc00wSWw5chCpbwiix+mo7G0g/ + i4CqxM6Vn9lBbDYBDYnftxaDzRUBil/dNhmshllAWuLb72awuLBAlMSz9fMZQWxeAW2J948u + Qq37xCixYMtOdoiEoMTJmU9YIJq1JG78ewnUzAE2aPk/DpAwp4CRRPP1PWDlogIqElNObmOb + wCg0C0n3LCTdsxC6FzAyr2KUTcmt0s1NzMwpTk3WLU5OzMtLLdI118vNLNFLTSndxAgKbHYX + lR2MzYeUDjEKcDAq8fCu5PwVLMSaWFZcmXuIUZKDSUmU900oUIgvKT+lMiOxOCO+qDQntfgQ + owQHs5IIbzsfUI43JbGyKrUoHyYlzcGiJM771toqWEggPbEkNTs1tSC1CCYrw8GhJMErkAzU + KFiUmp5akZaZU4KQZuLgBBnOAzT8fxLI8OKCxNzizHSI/ClGRSlxXnuQZgGQREZpHlwvLPG8 + YhQHekWY9zVIOw8wacF1vwIazAQ02LTnJ8jgkkSElFQDY8Zzi+cbCpT9KhySXYKFDBabLBPw + /Ldxj41JzZL3IkJXv919vFN+4QKhM53PtHhE7524xc+VG+s8gWE/l9tPPTFjlZpY3SRNkahz + KxY/Nq4Puc55/vThaHOjhZ7tKt/nHHNYsDNrKpfjiblM4tPaLuV/LV10d7GMx8UQictF7x9N + mTM9RKH8jRJLcUaioRZzUXEiAEnPgRoXAwAA +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: Sun, 24 Aug 2014 22:16:39 -0000 + +Quoth David Bremner on Aug 23 at 8:58 pm: +> Austin Clements writes: +> +> >>> @@ -1048,7 +1164,8 @@ notmuch_database_get_version (notmuch_database_t *notmuch) +> >>> notmuch_bool_t +> >>> notmuch_database_needs_upgrade (notmuch_database_t *notmuch) +> >>> { +> >>> - return notmuch->needs_upgrade; +> >>> + return notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE && +> >>> + (NOTMUCH_FEATURES_CURRENT & ~notmuch->features); +> >>> } +> >> +> >> Maybe I'm not thinking hard enough here, but how does this deal with a +> >> feature that is needed to open a database in read only mode? Maybe it +> >> needs a comment for people not as clever as Austin ;). +> > +> > I'm not quite sure what you mean. notmuch_database_needs_upgrade +> > returns false for read-only databases because you can't upgrade a +> > read-only database. This was true before this patch, too, though it was +> > less obvious. (Maybe that's not what you're asking?) +> +> Yes, that's what I was asking. I guess it's orthogonal to your patch +> series, but the logic of returning FALSE for read only databases is not +> very intuitive to me (in the sense that "needs upgrade" is not the +> opposite of "can't be upgraded". Your new comment later in the series +> is better, but it would IMHO be even better if you mentioned the read +> only case. + +That's a good point. Ideally this should be +"notmuch_database_can_upgrade" or something, which I think would +capture exactly what it means after this series. However, I don't +think it's worth breaking API compatibility given that this is already +how callers use this function (even though that violates the current +library spec). + +So, how's this for a more updated doc comment on needs_upgrade? + +/** + * Can the database be upgraded to a newer database version? + * + * If this function returns TRUE, then the caller may call + * notmuch_database_upgrade to upgrade the database. If the caller + * does not upgrade an out-of-date database, then some functions may + * fail with NOTMUCH_STATUS_UPGRADE_REQUIRED. This always returns + * FALSE for a read-only database because there's no way to upgrade a + * read-only database. + */ -- 2.26.2