unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v3 00/13] Implement and use database "features"
@ 2014-08-01  2:09 Austin Clements
  2014-08-01  2:09 ` [PATCH v3 01/13] test: Include generated dependencies for test sources Austin Clements
                   ` (13 more replies)
  0 siblings, 14 replies; 28+ messages in thread
From: Austin Clements @ 2014-08-01  2:09 UTC (permalink / raw)
  To: notmuch

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));

^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2014-08-24 23:03 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-01  2:09 [PATCH v3 00/13] Implement and use database "features" Austin Clements
2014-08-01  2:09 ` [PATCH v3 01/13] test: Include generated dependencies for test sources Austin Clements
2014-08-01  2:09 ` [PATCH v3 02/13] util: Const version of strtok_len Austin Clements
2014-08-06 13:43   ` David Bremner
2014-08-01  2:09 ` [PATCH v3 03/13] new: Don't report version after upgrade Austin Clements
2014-08-23 15:39   ` Jani Nikula
2014-08-23 22:59     ` Austin Clements
2014-08-24 12:56       ` Jani Nikula
2014-08-01  2:09 ` [PATCH v3 04/13] lib: Database version 3: Introduce fine-grained "features" Austin Clements
2014-08-23 16:02   ` Jani Nikula
2014-08-24  0:57     ` Austin Clements
2014-08-23 22:21   ` David Bremner
2014-08-24  0:58     ` Austin Clements
2014-08-24  3:58       ` David Bremner
2014-08-24 22:16         ` Austin Clements
2014-08-24 23:03           ` David Bremner
2014-08-01  2:09 ` [PATCH v3 05/13] test: Tool to build DB with specific version and features Austin Clements
2014-08-23 16:03   ` Jani Nikula
2014-08-01  2:09 ` [PATCH v3 06/13] test: Tests for future version and unknown feature handling Austin Clements
2014-08-01  2:09 ` [PATCH v3 07/13] lib: Simplify upgrade code using a transaction Austin Clements
2014-08-01  2:09 ` [PATCH v3 08/13] lib: Use database features to drive upgrade Austin Clements
2014-08-01  2:09 ` [PATCH v3 09/13] lib: Reorganize upgrade around document types Austin Clements
2014-08-01  2:10 ` [PATCH v3 10/13] lib: Report progress for combined upgrade operation Austin Clements
2014-08-01  2:10 ` [PATCH v3 11/13] lib: Support empty header values in database Austin Clements
2014-08-01  2:10 ` [PATCH v3 12/13] lib: Return an error from operations that require an upgrade Austin Clements
2014-08-01  2:10 ` [PATCH v3 13/13] lib: Update doc of notmuch_database_{needs_upgrade, upgrade} Austin Clements
2014-08-07 21:55 ` [PATCH v3 00/13] Implement and use database "features" Tomi Ollila
2014-08-08 18:18   ` Austin Clements

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).