about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-18 05:09:04 +0000
committerEric Wong <e@80x24.org>2021-10-18 05:15:13 +0000
commitc51814c647ec83a137be7de3a1baeb7336d318ea (patch)
tree61c822fb05e5f6edbaf78c3461100dafeddfe0ff
parent1f07fa568f1c466b44bb69c89ad847a233437014 (diff)
downloadpublic-inbox-c51814c647ec83a137be7de3a1baeb7336d318ea.tar.gz
There seems to be a bug in v2 inbox reindexing somewhere...
-rw-r--r--lib/PublicInbox/ExtSearchIdx.pm14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index f479cf9e..4b46fa16 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);
 }