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 3/4] extindex: guard against false mismatch unrefs
Date: Sat, 16 Oct 2021 22:52:49 -1100	[thread overview]
Message-ID: <20211017095250.22252-4-e@80x24.org> (raw)
In-Reply-To: <20211017095250.22252-1-e@80x24.org>

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 | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index daff656d1ac5..cb5256a2c562 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -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) {

  parent reply	other threads:[~2021-10-17  9:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-17  9:52 [PATCH 0/4] extindex tweaks and small fixes Eric Wong
2021-10-17  9:52 ` [PATCH 1/4] extindex: use localtime to display lock time Eric Wong
2021-10-17  9:52 ` [PATCH 2/4] extindex: retry sync_inbox before reindex Eric Wong
2021-10-17  9:52 ` Eric Wong [this message]
2021-10-17  9:52 ` [PATCH 4/4] extindex: better locations for {quit} checks 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=20211017095250.22252-4-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).