From: Austin Clements Date: Fri, 1 Aug 2014 02:09:50 +0000 (+2000) Subject: [PATCH v3 00/13] Implement and use database "features" X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=77bd233cd3ab0cdf355ff21e489d0ca5e810c87e;p=notmuch-archives.git [PATCH v3 00/13] Implement and use database "features" --- diff --git a/7e/211d5cb43be411b2dc0b54f1c018ef644e32a6 b/7e/211d5cb43be411b2dc0b54f1c018ef644e32a6 new file mode 100644 index 000000000..5bd14db03 --- /dev/null +++ b/7e/211d5cb43be411b2dc0b54f1c018ef644e32a6 @@ -0,0 +1,135 @@ +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 19B12431FCF + for ; Thu, 31 Jul 2014 19:10:19 -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 ApxhGS3X9hyG for ; + Thu, 31 Jul 2014 19:10:11 -0700 (PDT) +Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu + [18.7.68.35]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 9784B431FB6 + for ; Thu, 31 Jul 2014 19:10:11 -0700 (PDT) +X-AuditID: 12074423-f79bf6d000007580-d3-53daf702bcb3 +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-6.mit.edu (Symantec Messaging Gateway) with SMTP + id 61.55.30080.207FAD35; Thu, 31 Jul 2014 22:10:10 -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 s712AA36008863; + Thu, 31 Jul 2014 22:10:10 -0400 +Received: from drake.dyndns.org + (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com + [216.15.114.40]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s712A6KK029969 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Thu, 31 Jul 2014 22:10:09 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1XD2IH-00033S-Pm; Thu, 31 Jul 2014 22:10:05 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v3 00/13] Implement and use database "features" +Date: Thu, 31 Jul 2014 22:09:50 -0400 +Message-Id: <1406859003-11561-1-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 2.0.0 +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFlrKIsWRmVeSWpSXmKPExsUixCmqrcv0/VawQd90S4vVc3ksrt+cyezA + 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZcyec5OxoEWkYuPFU4wNjFMFuhg5OSQETCRO + /tnPCmGLSVy4t56ti5GLQ0hgNpPEljOdUM5GRonNvX3sEM4dJonXW/5AZeYyShy4vp0ZpJ9N + QENi2/7ljCC2iIC0xM67s8HmMgvISvw4/wfMFhawl1ja+R3MZhFQlThw5RuYzSvgING/4B8z + xB1yEg03PrFNYORdwMiwilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdMLzezRC81pXQTIyg02F2U + dzD+Oah0iFGAg1GJh3dG+K1gIdbEsuLK3EOMkhxMSqK8Nh+BQnxJ+SmVGYnFGfFFpTmpxYcY + JTiYlUR4X34AyvGmJFZWpRblw6SkOViUxHnfWlsFCwmkJ5akZqemFqQWwWRlODiUJHjPfAVq + FCxKTU+tSMvMKUFIM3FwggznARp+DaSGt7ggMbc4Mx0if4pRUUqcdw9IQgAkkVGaB9cLi91X + jOJArwjzPgSp4gHGPVz3K6DBTECDn9+6DjK4JBEhJdXAuHnvin3HXOv68/YfWh/7b0rJrczP + U7ZFe6WdPLaptIEjT1W9VDvc/WDGmW63t7eveOQs226xSis+ZHFdWtXWrVaiE17JxfEl2tWa + hily5ZrNtK76ESro7LgmnW3XlhPxTN+LLbXni5hmrpfnljCrOXzuxO95eg/32/+4Ln+87VB3 + 3oRbUcHPlFiKMxINtZiLihMBhVnICbgCAAA= +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: Fri, 01 Aug 2014 02:10:19 -0000 + +This is v3 of id:1406652492-27803-1-git-send-email-amdragon@mit.edu. +This fixes one issue and tidies up another thing in +notmuch_database_upgrade I found while working on change tracking +support. Most of the patches are logically identical to v2, but the +changes ripple through the patch context, so I'm sending a new series. + +First, this updates notmuch->features before starting the upgrade, +rather than after, so that functions called by upgrade will use the +new database features instead of the old (this didn't matter in this +series because nothing modified the database differently depending on +features). Second, this combines multiple _notmuch_message_sync calls +into one, which cleans up the code, should further improve upgrade +performance, and makes way for additional per-message upgrades. + +The diff from v2 is below (excluding patch 2, which David pushed). + +diff --git a/lib/database.cc b/lib/database.cc +index b323691..d90a924 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -1252,6 +1252,10 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, + /* Perform the upgrade in a transaction. */ + db->begin_transaction (true); + ++ /* Set the target features so we write out changes in the desired ++ * format. */ ++ notmuch->features = target_features; ++ + /* Perform per-message upgrades. */ + if (new_features & + (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_BOOL_FOLDER)) { +@@ -1280,7 +1284,6 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, + if (filename && *filename != '\0') { + _notmuch_message_add_filename (message, filename); + _notmuch_message_clear_data (message); +- _notmuch_message_sync (message); + } + talloc_free (filename); + } +@@ -1289,10 +1292,10 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, + * probabilistic and stemmed. Change it to the current + * boolean prefix. Add "path:" prefixes while at it. + */ +- if (new_features & NOTMUCH_FEATURE_BOOL_FOLDER) { ++ if (new_features & NOTMUCH_FEATURE_BOOL_FOLDER) + _notmuch_message_upgrade_folder (message); +- _notmuch_message_sync (message); +- } ++ ++ _notmuch_message_sync (message); + + notmuch_message_destroy (message); + +@@ -1348,7 +1351,6 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, + } + } + +- notmuch->features = target_features; + db->set_metadata ("features", _print_features (local, notmuch->features)); + db->set_metadata ("version", STRINGIFY (NOTMUCH_DATABASE_VERSION)); +