From: Tomi Ollila Date: Wed, 13 Feb 2013 14:47:27 +0000 (+0200) Subject: Re: [PATCH] contrib/nmbug: convert to use batch tagging. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=42c7fcbe693017654ad406803de39f33835a9ff3;p=notmuch-archives.git Re: [PATCH] contrib/nmbug: convert to use batch tagging. --- diff --git a/b3/806438fa5695c292c832a97080df3a6fbbdea0 b/b3/806438fa5695c292c832a97080df3a6fbbdea0 new file mode 100644 index 000000000..2d3b62ef2 --- /dev/null +++ b/b3/806438fa5695c292c832a97080df3a6fbbdea0 @@ -0,0 +1,123 @@ +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 D5884431FC9 + for ; Wed, 13 Feb 2013 06:47:40 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 3ryCz639nk8A for ; + Wed, 13 Feb 2013 06:47:40 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 13641431FC7 + for ; Wed, 13 Feb 2013 06:47:40 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id AB06B10007D; + Wed, 13 Feb 2013 16:47:27 +0200 (EET) +From: Tomi Ollila +To: david@tethera.net, notmuch@notmuchmail.org +Subject: Re: [PATCH] contrib/nmbug: convert to use batch tagging. +In-Reply-To: <1360374019-20988-1-git-send-email-david@tethera.net> +References: <1360374019-20988-1-git-send-email-david@tethera.net> +User-Agent: Notmuch/0.15+20~g7e29ae9 (http://notmuchmail.org) Emacs/24.2.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +Cc: David Bremner +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: Wed, 13 Feb 2013 14:47:41 -0000 + +On Sat, Feb 09 2013, david@tethera.net wrote: + +> From: David Bremner +> +> In the case of large changes to the database from git, one of main +> current bottlenecks is the large number of execs of notmuch tag. This +> avoids that by using use the batch tagging facilities as of notmuch +> 0.15. +> +> We use "spawn" directly rather than inventing a "notmuch_pipe", since +> it seems the only place we need to pipe to notmuch so far. +> --- + +The code LGTM. Is there any quoting differences between these 2 +tagging methods ? + +> This is only lightly tested; please make sure you have backups of your +> database. + +Do I dare to test -- I'm lazy taking backups (I don't know how to take +one -- and especially how to restore one ;) + +> I'm not 100% sure about the indentation. No doubt Tomi will let me +> know if it can be improved. + +No doubt... + +Tomi + +> +> contrib/nmbug/nmbug | 15 ++++++++++----- +> 1 file changed, 10 insertions(+), 5 deletions(-) +> +> diff --git a/contrib/nmbug/nmbug b/contrib/nmbug/nmbug +> index f003ef9..c66c526 100755 +> --- a/contrib/nmbug/nmbug +> +++ b/contrib/nmbug/nmbug +> @@ -270,17 +270,22 @@ sub do_sync { +> $D_action = '-'; +> } +> +> - foreach my $pair (@{$status->{added}}) { +> + my $notmuch = spawn ({}, '|-', qw/notmuch tag --batch/) +> + or die 'notmuch tag --batch'; +> +> - notmuch ('tag', $A_action.$TAGPREFIX.$pair->{tag}, +> - 'id:'.$pair->{id}); +> + foreach my $pair (@{$status->{added}}) { +> + print $notmuch $A_action.$TAGPREFIX.$pair->{tag}, " -- ", +> + 'id:'.$pair->{id}; +> } +> +> foreach my $pair (@{$status->{deleted}}) { +> - notmuch ('tag', $D_action.$TAGPREFIX.$pair->{tag}, +> - 'id:'.$pair->{id}); +> + print $notmuch $D_action.$TAGPREFIX.$pair->{tag}, +> + 'id:'.$pair->{id}; +> } +> +> + unless (close $notmuch) { +> + die "'notmuch tag --batch' exited with nonzero value\n"; +> + } +> } +> +> +> -- +> 1.7.10.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch