]> git.notmuchmail.org Git - notmuch/commit
lib: Implement ghost-based thread linking
authorAustin Clements <amdragon@mit.edu>
Thu, 23 Oct 2014 12:30:37 +0000 (08:30 -0400)
committerDavid Bremner <david@tethera.net>
Sat, 25 Oct 2014 17:27:07 +0000 (19:27 +0200)
commit58a4277d3b2ad88bc285f2dae998626b0aa73299
tree7fc290519ff484008c2c4c8cc36f636edd9b5c53
parentbc9c50602d20ce712188ea2cc3c5d30647d4d3f5
lib: Implement ghost-based thread linking

This updates the thread linking code to use ghost messages instead of
user metadata to link messages into threads.

In contrast with the old approach, this is actually correct.
Previously, thread merging updated only the thread IDs of message
documents, not thread IDs stored in user metadata.  As originally
diagnosed by Mark Walters [1] and as demonstrated by the broken
T260-thread-order test, this can cause notmuch to fail to link
messages even though they're in the same thread.  In principle the old
approach could have been fixed by updating the user metadata thread
IDs as well, but these are not indexed and hence this would have
required a full scan of all stored thread IDs.  Ghost messages solve
this problem naturally by reusing the exact same thread ID and message
ID representation and indexing as regular messages.

Furthermore, thanks to this greater symmetry, ghost messages are also
algorithmically simpler.  We continue to support the old user metadata
format, so this patch can't delete any code, but when we do remove
support for the old format, several functions can simply be deleted.

[1] id:8738h7kv2q.fsf@qmul.ac.uk
lib/database.cc