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