lib/PublicInbox/ExtSearchIdx.pm | 14 +++++++++++--- diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index f479cf9e1a3fd4ee42ff9e03eeba26b26c1b1411..4b46fa1622ea264c79e225c1de41a44287b0be95 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -292,8 +292,8 @@ } # 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 @@ for my $mid (@{$req->{mids}}) { 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 @@ my $new_smsg = $req->{new_smsg} = bless { 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); }