]> Sergey Matveev's repositories - public-inbox.git/commitdiff
searchidxshard: make warnings with eidx_key less confusing
authorEric Wong <e@80x24.org>
Tue, 27 Oct 2020 07:54:53 +0000 (07:54 +0000)
committerEric Wong <e@80x24.org>
Sat, 7 Nov 2020 10:22:16 +0000 (10:22 +0000)
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

index 644d8b58e65883c55ea09b4f780ba4736b2a9028..e194b7e0aa1f0ab2e3e464e6fbc163ea36655824 100644 (file)
@@ -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);