]> Sergey Matveev's repositories - public-inbox.git/commitdiff
extindex: guard against false mismatch unrefs
authorEric Wong <e@80x24.org>
Sun, 17 Oct 2021 09:52:49 +0000 (22:52 -1100)
committerEric Wong <e@80x24.org>
Sun, 17 Oct 2021 19:04:48 +0000 (19:04 +0000)
I'm not sure if this is a bug or not (or it could be
an old bug in the v2 indexing code).

lib/PublicInbox/ExtSearchIdx.pm

index daff656d1ac54749090a137a85ea8a8542564a68..cb5256a2c5625826b90d6aea26e75bf5863aeef9 100644 (file)
@@ -921,6 +921,16 @@ ibx_id = ? AND xnum >= ? AND xnum <= ?
                        my ($xnum, $hex) = unpack('JH*', $k);
                        my $bin = pack('H*', $hex);
                        my $exp = $mismatch{$xnum};
+                       if (defined $exp) {
+                               my $smsg = $ibx->over->get_art($xnum) // next;
+                               # $xnum may be expired by another process
+                               if ($smsg->{blob} eq $hex) {
+                                       warn <<"";
+BUG: (non-fatal) $ekey #$xnum $smsg->{blob} still matches (old exp: $exp)
+
+                                       next;
+                               } # else: continue to unref
+                       }
                        my $m = defined($exp) ? "mismatch (!= $exp)" : 'stale';
                        warn("# $xnum:$hex (#@$docids): $m\n");
                        for my $i (@$docids) {