[PATCH 11/11] lib: Remove unnecessary thread linking steps when using ghost messages
authorAustin Clements <aclements@csail.mit.edu>
Fri, 3 Oct 2014 14:19:18 +0000 (10:19 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:04:55 +0000 (10:04 -0800)
41/8fbfb9e18ce3352049ed02168bb6a5c868a0a6 [new file with mode: 0644]

diff --git a/41/8fbfb9e18ce3352049ed02168bb6a5c868a0a6 b/41/8fbfb9e18ce3352049ed02168bb6a5c868a0a6
new file mode 100644 (file)
index 0000000..96539db
--- /dev/null
@@ -0,0 +1,123 @@
+Return-Path: <aclements@csail.mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8E7EC431FDA\r
+       for <notmuch@notmuchmail.org>; Fri,  3 Oct 2014 07:19:32 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id FLQdPi1R40Kv for <notmuch@notmuchmail.org>;\r
+       Fri,  3 Oct 2014 07:19:25 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu\r
+       [18.9.25.12])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8283E431FB6\r
+       for <notmuch@notmuchmail.org>; Fri,  3 Oct 2014 07:19:25 -0700 (PDT)\r
+X-AuditID: 1209190c-f795e6d000006c66-50-542eb06b2f55\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       (using TLS with cipher AES256-SHA (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 24.34.27750.B60BE245; Fri,  3 Oct 2014 10:19:23 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id s93EJNat020196; \r
+       Fri, 3 Oct 2014 10:19:23 -0400\r
+Received: from drake.dyndns.org\r
+       (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [216.15.114.40]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s93EJLsa023326\r
+       (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT);\r
+       Fri, 3 Oct 2014 10:19:22 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.84)\r
+       (envelope-from <aclements@csail.mit.edu>)\r
+       id 1Xa3hZ-0002KM-DJ; Fri, 03 Oct 2014 10:19:21 -0400\r
+From: Austin Clements <aclements@csail.mit.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 11/11] lib: Remove unnecessary thread linking steps when using\r
+       ghost messages\r
+Date: Fri,  3 Oct 2014 10:19:18 -0400\r
+Message-Id: <1412345958-8278-12-git-send-email-aclements@csail.mit.edu>\r
+X-Mailer: git-send-email 2.1.0\r
+In-Reply-To: <1412345958-8278-1-git-send-email-aclements@csail.mit.edu>\r
+References: <1412345958-8278-1-git-send-email-aclements@csail.mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsUixG6nrpu9QS/EYOJ3M4vrN2cyOzB6PFt1\r
+       izmAMYrLJiU1J7MstUjfLoErY83F36wFr3grpp7azdzA+Iari5GTQ0LARGLChvOsELaYxIV7\r
+       69m6GLk4hARmM0ls/LSEESQhJLCBUWLD6QoI+zaTxIfl4hBFSxglls16zQ6SYBPQl1ixdhLY\r
+       JBEBaYmdd2cD2RwczAJqEn+6VEDCwgKxEr83rwQrZxFQlXizvp8NxOYVcJe48/U2M8QRchIb\r
+       dv8H28sJFL9w9ykbxF43iVXHutkmMPIvYGRYxSibklulm5uYmVOcmqxbnJyYl5dapGuol5tZ\r
+       opeaUrqJERQynJI8OxjfHFQ6xCjAwajEw/vhhm6IEGtiWXFl7iFGSQ4mJVHeysV6IUJ8Sfkp\r
+       lRmJxRnxRaU5qcWHGCU4mJVEeBesBMrxpiRWVqUW5cOkpDlYlMR5N/3gCxESSE8sSc1OTS1I\r
+       LYLJynBwKEnwtq8HahQsSk1PrUjLzClBSDNxcIIM5wEaDlbDW1yQmFucmQ6RP8WoKCXO+3Ad\r
+       UEIAJJFRmgfXC4vpV4ziQK8I83aBtPMA0wFc9yugwUxAg9/Z64IMLklESEk1MGZ9ELrJtvJW\r
+       4lOrjatPvfjCN4P1WfuPFf5L1B1Sp0T/3tAk6szRNfua2U/21xwrp01NKJF4eU0q2dg79tW7\r
+       A28fvu7fEPp5Bv+6WX2/T5wqPqnW/oh9nlhd8wtFscXJm15EM7W1bbuq8+JASoHLxOP3lm5w\r
+       qD2xfuU+tb/F5acEir/LWzyddqtfiaU4I9FQi7moOBEAqHFuJ8QCAAA=\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 03 Oct 2014 14:19:33 -0000\r
+\r
+From: Austin Clements <amdragon@mit.edu>\r
+\r
+Previously, it was necessary to link new messages to children to work\r
+around some (though not all) problems with the old metadata-based\r
+approach to stored thread IDs.  With ghost messages, this is no longer\r
+necessary, so don't bother with child linking when ghost messages are\r
+in use.\r
+---\r
+ lib/database.cc | 21 +++++++++++++++++----\r
+ 1 file changed, 17 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index ff6a7f6..4655f59 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -2167,10 +2167,23 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,\r
+     if (status)\r
+       goto DONE;\r
\r
+-    status = _notmuch_database_link_message_to_children (notmuch, message,\r
+-                                                       &thread_id);\r
+-    if (status)\r
+-      goto DONE;\r
++    if (! (notmuch->features & NOTMUCH_FEATURE_GHOSTS)) {\r
++      /* In general, it shouldn't be necessary to link children,\r
++       * since the earlier indexing of those children will have\r
++       * stored a thread ID for the missing parent.  However, prior\r
++       * to ghost messages, these stored thread IDs were NOT\r
++       * rewritten during thread merging (and there was no\r
++       * performant way to do so), so if indexed children were\r
++       * pulled into a different thread ID by a merge, it was\r
++       * necessary to pull them *back* into the stored thread ID of\r
++       * the parent.  With ghost messages, we just rewrite the\r
++       * stored thread IDs during merging, so this workaround isn't\r
++       * necessary. */\r
++      status = _notmuch_database_link_message_to_children (notmuch, message,\r
++                                                           &thread_id);\r
++      if (status)\r
++          goto DONE;\r
++    }\r
\r
+     /* If not part of any existing thread, generate a new thread ID. */\r
+     if (thread_id == NULL) {\r
+-- \r
+2.1.0\r
+\r