database error
[notmuch-archives.git] / 27 / e03d72e533ef433fc8ff2b8f6d21f651f32d24
1 Return-Path: <bremner@tethera.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 059E840B964\r
6         for <notmuch@notmuchmail.org>; Fri,  8 Feb 2013 17:40:34 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id k3uCdQE9nvVY for <notmuch@notmuchmail.org>;\r
16         Fri,  8 Feb 2013 17:40:33 -0800 (PST)\r
17 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 7A1B040B961\r
21         for <notmuch@notmuchmail.org>; Fri,  8 Feb 2013 17:40:33 -0800 (PST)\r
22 Received: from fctnnbsc30w-156034082078.dhcp-dynamic.fibreop.nb.bellaliant.net\r
23         ([156.34.82.78] helo=zancas.localnet)\r
24         by tesseract.cs.unb.ca with esmtpsa\r
25         (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80)\r
26         (envelope-from <bremner@tethera.net>)\r
27         id 1U3zQa-0005pA-90; Fri, 08 Feb 2013 21:40:30 -0400\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)\r
29         (envelope-from <bremner@tethera.net>)\r
30         id 1U3zQU-0005Tq-JK; Fri, 08 Feb 2013 21:40:22 -0400\r
31 From: david@tethera.net\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH] contrib/nmbug: convert to use batch tagging.\r
34 Date: Fri,  8 Feb 2013 21:40:19 -0400\r
35 Message-Id: <1360374019-20988-1-git-send-email-david@tethera.net>\r
36 X-Mailer: git-send-email 1.7.10.4\r
37 X-Spam_bar: -\r
38 Cc: David Bremner <bremner@debian.org>\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Sat, 09 Feb 2013 01:40:34 -0000\r
52 \r
53 From: David Bremner <bremner@debian.org>\r
54 \r
55 In the case of large changes to the database from git, one of main\r
56 current bottlenecks is the large number of execs of notmuch tag. This\r
57 avoids that by using use the batch tagging facilities as of notmuch\r
58 0.15.\r
59 \r
60 We use "spawn" directly rather than inventing a "notmuch_pipe", since\r
61 it seems the only place we need to pipe to notmuch so far.\r
62 ---\r
63 \r
64 This is only lightly tested; please make sure you have backups of your\r
65 database.\r
66 \r
67 I'm not 100% sure about the indentation. No doubt Tomi will let me\r
68 know if it can be improved.\r
69 \r
70  contrib/nmbug/nmbug |   15 ++++++++++-----\r
71  1 file changed, 10 insertions(+), 5 deletions(-)\r
72 \r
73 diff --git a/contrib/nmbug/nmbug b/contrib/nmbug/nmbug\r
74 index f003ef9..c66c526 100755\r
75 --- a/contrib/nmbug/nmbug\r
76 +++ b/contrib/nmbug/nmbug\r
77 @@ -270,17 +270,22 @@ sub do_sync {\r
78      $D_action = '-';\r
79    }\r
80  \r
81 -  foreach my $pair (@{$status->{added}}) {\r
82 +  my $notmuch = spawn ({}, '|-', qw/notmuch tag --batch/)\r
83 +      or die 'notmuch tag --batch';\r
84  \r
85 -    notmuch ('tag', $A_action.$TAGPREFIX.$pair->{tag},\r
86 -            'id:'.$pair->{id});\r
87 +  foreach my $pair (@{$status->{added}}) {\r
88 +    print $notmuch $A_action.$TAGPREFIX.$pair->{tag}, " -- ",\r
89 +      'id:'.$pair->{id};\r
90    }\r
91  \r
92    foreach my $pair (@{$status->{deleted}}) {\r
93 -    notmuch ('tag', $D_action.$TAGPREFIX.$pair->{tag},\r
94 -            'id:'.$pair->{id});\r
95 +    print $notmuch $D_action.$TAGPREFIX.$pair->{tag},\r
96 +      'id:'.$pair->{id};\r
97    }\r
98  \r
99 +  unless (close $notmuch) {\r
100 +    die "'notmuch tag --batch' exited with nonzero value\n";\r
101 +  }\r
102  }\r
103  \r
104  \r
105 -- \r
106 1.7.10.4\r
107 \r