From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 40B94200AA for ; Tue, 27 Oct 2020 07:55:02 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 52/52] searchidxshard: make warnings with eidx_key less confusing Date: Tue, 27 Oct 2020 07:54:53 +0000 Message-Id: <20201027075453.19163-53-e@80x24.org> In-Reply-To: <20201027075453.19163-1-e@80x24.org> References: <20201027075453.19163-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Seeing "Xorg.foo.bar" can be confusing in warnings if the eidx_key is only "org.foo.bar" with no relation to "Xorg" at all. Furthermore, printing "\0" to log or terminal output isn't very nice and could throw off some users/tools. --- lib/PublicInbox/SearchIdxShard.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/SearchIdxShard.pm b/lib/PublicInbox/SearchIdxShard.pm index 644d8b58..e194b7e0 100644 --- a/lib/PublicInbox/SearchIdxShard.pm +++ b/lib/PublicInbox/SearchIdxShard.pm @@ -87,8 +87,9 @@ sub shard_worker_loop ($$$$$) { } else { chomp $line; my $eidx_key; - if ($line =~ s/\AX(.+)\0//) { + if ($line =~ s/\AX=(.+)\0//) { $eidx_key = $1; + $v2w->{current_info} =~ s/\0/\\0/; } # n.b. $mid may contain spaces(!) my ($len, $bytes, $num, $oid, $ds, $ts, $tid, $mid) @@ -114,7 +115,7 @@ sub index_raw { my ($self, $msgref, $eml, $smsg, $ibx) = @_; if (my $w = $self->{w}) { if ($ibx) { - print $w 'X', $ibx->eidx_key, "\0" or die + print $w 'X=', $ibx->eidx_key, "\0" or die "failed to write shard: $!\n"; } $msgref //= \($eml->as_string);