From: Austin Clements Date: Mon, 6 Oct 2014 23:17:18 +0000 (+1800) Subject: [PATCH v2 12/12] lib: Remove unnecessary thread linking steps when using ghost messages X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3126a682089e95fc98bb0ec895509e56bd035460;p=notmuch-archives.git [PATCH v2 12/12] lib: Remove unnecessary thread linking steps when using ghost messages --- diff --git a/f7/40f837d94da95b9be953385dc109ef6d1bb920 b/f7/40f837d94da95b9be953385dc109ef6d1bb920 new file mode 100644 index 000000000..a62d343b2 --- /dev/null +++ b/f7/40f837d94da95b9be953385dc109ef6d1bb920 @@ -0,0 +1,121 @@ +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 CA3AC431FBD + for ; Mon, 6 Oct 2014 16:17:42 -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 QEdN+9r3Ua9Y for ; + Mon, 6 Oct 2014 16:17:42 -0700 (PDT) +Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu + [18.9.25.13]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id F0187431FC2 + for ; Mon, 6 Oct 2014 16:17:30 -0700 (PDT) +X-AuditID: 1209190d-f79c06d000006f95-0d-5433230a1b4e +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-2.mit.edu (Symantec Messaging Gateway) with SMTP + id 44.74.28565.A0323345; Mon, 6 Oct 2014 19:17:30 -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 s96NHPmP030744; + Mon, 6 Oct 2014 19:17:25 -0400 +Received: from drake.dyndns.org ([12.185.136.2]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s96NHNfm014477 + (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); + Mon, 6 Oct 2014 19:17:24 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.84) + (envelope-from ) + id 1XbHWs-0001K4-EG; Mon, 06 Oct 2014 17:17:22 -0600 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v2 12/12] lib: Remove unnecessary thread linking steps when + using ghost messages +Date: Mon, 6 Oct 2014 17:17:18 -0600 +Message-Id: <1412637438-4821-13-git-send-email-aclements@csail.mit.edu> +X-Mailer: git-send-email 2.1.0 +In-Reply-To: <1412637438-4821-1-git-send-email-aclements@csail.mit.edu> +References: <1412637438-4821-1-git-send-email-aclements@csail.mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixCmqrculbBxicPauvsWN1m5Gi+s3ZzI7 + MHk8W3WL2WPLoffMAUxRXDYpqTmZZalF+nYJXBm3zn9gKnjFW3FwczdbA+Mbri5GTg4JAROJ + qydnsEHYYhIX7q0Hsrk4hARmM0ksXfaaEcLZwCgxd/dkJghnKZPE7Pk9UM4SRokD8/rZQfrZ + BPQlVqydxApiiwhIS+y8OxvMZhawlLj6tZ0JxBYWSJBY3rsZKM7BwSKgKtFx1REkzCvgLtG6 + fD87xBlyEht2/2cEsTmB4muuTAYbIyTgJvH851OWCYz8CxgZVjHKpuRW6eYmZuYUpybrFicn + 5uWlFuka6eVmluilppRuYgSHkiTvDsZ3B5UOMQpwMCrx8EbsMAwRYk0sK67MPcQoycGkJMo7 + h904RIgvKT+lMiOxOCO+qDQntfgQowQHs5IIL9dvoxAh3pTEyqrUonyYlDQHi5I476YffCFC + AumJJanZqakFqUUwWRkODiUJXmMloKGCRanpqRVpmTklCGkmDk6Q4TxAw/8pAtXwFhck5hZn + pkPkTzEqSonzBoMkBEASGaV5cL2wWH/FKA70ijBvEMgKHmCagOt+BTSYCWiw6Rx9kMEliQgp + qQbGzBNHD8xVXrTmvWRw0hnJPRv/TNT6et6EP1zi6XST86zb7P2NdlRVqa+8eG7rv+83o2pe + rp06VyXgjLb6o8gbRhxaGXXV6im+dpYXrv6K5Th6hG/9sV3ZurcXTOcONFZmSr5qujx/7+U5 + a1j3+DU94rTvsEkXn/6Cb/P9tV8zrz9MZw45//jSGiWW4oxEQy3mouJEAHPzeZbQAgAA +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: Mon, 06 Oct 2014 23:17:43 -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 | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +diff --git a/lib/database.cc b/lib/database.cc +index 1316529..6e51a72 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -2169,10 +2169,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 +