user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: "Eric Wong (Contractor, The Linux Foundation)" <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] searchidx: correct warning for over-vivification
Date: Fri, 30 Mar 2018 20:55:13 +0000	[thread overview]
Message-ID: <20180330205513.19317-1-e@80x24.org> (raw)

We will vivify multiple ghosts if a message has multiple
Message-IDs.
---
 lib/PublicInbox/SearchIdx.pm | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index a234c8c..c75a4ce 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -544,9 +544,9 @@ sub link_and_save {
 	$doc->add_boolean_term('XPATH' . $xpath) if defined $xpath;
 	$doc->add_boolean_term('Q' . $_) foreach @$mids;
 
-	my $vivified = 0;
 	$self->{skel} and die "Should not have read-only skel here\n";;
 	foreach my $mid (@$mids) {
+		my $vivified = 0;
 		$self->each_smsg_by_mid($mid, sub {
 			my ($cur) = @_;
 			my $type = $cur->type;
@@ -568,10 +568,8 @@ sub link_and_save {
 			++$vivified;
 			1;
 		});
-	}
-	if ($vivified > 1) {
-		my $id = '<'.join('> <', @$mids).'>';
-		warn "BUG: vivified multiple ($vivified) ghosts for $id\n";
+		$vivified > 1 and warn
+			"BUG: vivified multiple ($vivified) ghosts for $mid\n";
 	}
 	# not really important, but we return any vivified ghost docid, here:
 	return $doc_id if defined $doc_id;
-- 
EW


                 reply	other threads:[~2018-03-30 20:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180330205513.19317-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).