user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/2] extindex: show mismatches for messages deleted from inbox
Date: Mon, 18 Oct 2021 05:09:04 +0000	[thread overview]
Message-ID: <20211018050905.21275-2-e@80x24.org> (raw)
In-Reply-To: <20211018050905.21275-1-e@80x24.org>

There seems to be a bug in v2 inbox reindexing somewhere...
---
 lib/PublicInbox/ExtSearchIdx.pm | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index f479cf9e1a3f..4b46fa1622ea 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -292,8 +292,8 @@ sub ck_existing { # git->cat_async callback
 
 # is the messages visible in the inbox currently being indexed?
 # return the number if so
-sub cur_ibx_xnum ($$) {
-	my ($req, $bref) = @_;
+sub cur_ibx_xnum ($$;$) {
+	my ($req, $bref, $mismatch) = @_;
 	my $ibx = $req->{ibx} or die 'BUG: current {ibx} missing';
 
 	$req->{eml} = PublicInbox::Eml->new($bref);
@@ -303,6 +303,7 @@ sub cur_ibx_xnum ($$) {
 		my ($id, $prev);
 		while (my $x = $ibx->over->next_by_mid($mid, \$id, \$prev)) {
 			return $x->{num} if $x->{blob} eq $req->{oid};
+			push @$mismatch, $x if $mismatch;
 		}
 	}
 	undef;
@@ -317,8 +318,15 @@ sub index_oid { # git->cat_async callback for 'm'
 		blob => $oid,
 	}, 'PublicInbox::Smsg';
 	$new_smsg->set_bytes($$bref, $size);
-	defined($req->{xnum} = cur_ibx_xnum($req, $bref)) or return;
 	++${$req->{nr}};
+	my $mismatch = [];
+	$req->{xnum} = cur_ibx_xnum($req, $bref, $mismatch) // do {
+		warn "# deleted\n";
+		warn "# mismatch $_->{blob}\n" for @$mismatch;
+		${$req->{latest_cmt}} = $req->{cur_cmt} //
+			die "BUG: {cur_cmt} unset ($oid)\n";
+		return;
+	};
 	do_step($req);
 }
 

  reply	other threads:[~2021-10-18  5:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18  5:09 [PATCH 0/2] fix v2 mirrors of reused Message-IDs Eric Wong
2021-10-18  5:09 ` Eric Wong [this message]
2021-10-18  5:09 ` [PATCH 2/2] v2: mirrors don't clobber msgs w/ " Eric Wong

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=20211018050905.21275-2-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).