From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1D044431FD4 for ; Thu, 23 Oct 2014 05:31:40 -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 1jXNvTE9oDqe for ; Thu, 23 Oct 2014 05:31:34 -0700 (PDT) Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu [18.7.68.37]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 162E5429E2E for ; Thu, 23 Oct 2014 05:31:01 -0700 (PDT) X-AuditID: 12074425-f79e46d000002583-b4-5448f5043af0 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP id E0.05.09603.405F8445; Thu, 23 Oct 2014 08:31:00 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id s9NCUtUc030515; Thu, 23 Oct 2014 08:30:56 -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 s9NCUsUX008990 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 23 Oct 2014 08:30:55 -0400 Received: from amthrax by drake.dyndns.org with local (Exim 4.84) (envelope-from ) id 1XhHXU-0007cG-Mp; Thu, 23 Oct 2014 08:30:48 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v3 9/9] lib: Remove unnecessary thread linking steps when using ghost messages Date: Thu, 23 Oct 2014 08:30:41 -0400 Message-Id: <1414067441-29054-10-git-send-email-aclements@csail.mit.edu> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1414067441-29054-1-git-send-email-aclements@csail.mit.edu> References: <1414067441-29054-1-git-send-email-aclements@csail.mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixG6nrsvy1SPEYGmnicXquTwW12/OZHZg 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mq6tOMFasFC0ov9DK1sD40uBLkZODgkBE4m+ P++YIGwxiQv31rN1MXJxCAnMZpL4taSLCcLZyCix+cxmFgjnDpPE9fVHGCGcJYwScy60s4P0 swnoS6xYO4kVxBYRkJbYeXc2mM0s4Cjxef8iNhBbWCBO4uipQ2D1LAKqEp0Le8HivAIeEk+v H2WEuENOYsPu/2A2J1B8z447YDVCAu4S258fZJ3AyL+AkWEVo2xKbpVubmJmTnFqsm5xcmJe XmqRroVebmaJXmpK6SZGcCi5qO5gnHBI6RCjAAejEg/vhVSPECHWxLLiytxDjJIcTEqivDEP gEJ8SfkplRmJxRnxRaU5qcWHGCU4mJVEeOMvAOV4UxIrq1KL8mFS0hwsSuK8m37whQgJpCeW pGanphakFsFkZTg4lCR4Gb8ANQoWpaanVqRl5pQgpJk4OEGG8wANv/UZZHhxQWJucWY6RP4U o6KUOG8ySEIAJJFRmgfXC4v1V4ziQK8I86qBrOABpgm47ldAg5lArt4ANrgkESEl1cBopu+1 XjCQ+3mi1gGJa59W1ScLnGmfvP0QX81z++aMRVfScx7r7T34/P0VtglKS3i/xYXxfZpRMrHC T+NteffTxV2ycRvYF8ydKSSUFeG0tvhCC8Ozmv5drHWF9zXdmg+sdNGW11kxk5ftuKulgedJ Hrkq1rKcSnvlsHzP27MSgw/1/fEsuKDEUpyRaKjFXFScCAC9dw+W0AIAAA== 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: Thu, 23 Oct 2014 12:31:40 -0000 From: Austin Clements Previously, it was necessary to link new messages to children to work around some (though not all) problems with the old metadata-based approach to stored thread IDs. With ghost messages, this is no longer necessary, so don't bother with child linking when ghost messages are in use. --- lib/database.cc | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index b673718..3601f9d 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -2136,11 +2136,11 @@ _consume_metadata_thread_id (void *ctx, notmuch_database_t *notmuch, * reference 'message'. * * In all cases, we assign to the current message the first thread ID - * found (through either parent or child). We will also merge any - * existing, distinct threads where this message belongs to both, - * (which is not uncommon when messages are processed out of order). + * found. We will also merge any existing, distinct threads where this + * message belongs to both, (which is not uncommon when messages are + * processed out of order). * - * Finally, if no thread ID has been found through parent or child, we + * Finally, if no thread ID has been found through referenced messages, we * call _notmuch_message_generate_thread_id to generate a new thread * ID. This should only happen for new, top-level messages, (no * References or In-Reply-To header in this message, and no previously @@ -2172,10 +2172,23 @@ _notmuch_database_link_message (notmuch_database_t *notmuch, if (status) goto DONE; - status = _notmuch_database_link_message_to_children (notmuch, message, - &thread_id); - if (status) - goto DONE; + if (! (notmuch->features & NOTMUCH_FEATURE_GHOSTS)) { + /* In general, it shouldn't be necessary to link children, + * since the earlier indexing of those children will have + * stored a thread ID for the missing parent. However, prior + * to ghost messages, these stored thread IDs were NOT + * rewritten during thread merging (and there was no + * performant way to do so), so if indexed children were + * pulled into a different thread ID by a merge, it was + * necessary to pull them *back* into the stored thread ID of + * the parent. With ghost messages, we just rewrite the + * stored thread IDs during merging, so this workaround isn't + * necessary. */ + status = _notmuch_database_link_message_to_children (notmuch, message, + &thread_id); + if (status) + goto DONE; + } /* If not part of any existing thread, generate a new thread ID. */ if (thread_id == NULL) { -- 2.1.0