From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/3] extindex: move {checkpoint_unlocks} to $self
Date: Thu, 12 Dec 2024 10:10:39 +0000 [thread overview]
Message-ID: <20241212101040.1109774-3-e@80x24.org> (raw)
In-Reply-To: <20241212101040.1109774-1-e@80x24.org>
One small step towards eliminating the $sync structure.
---
lib/PublicInbox/ExtSearchIdx.pm | 8 ++++----
lib/PublicInbox/V2Writable.pm | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index 1c2a9a26..a172ba62 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -528,15 +528,15 @@ SELECT num FROM over WHERE num >= ? ORDER BY num ASC LIMIT 10000
warn "# eliminated $nr stale Xapian documents\n" if $nr != 0;
}
-sub eidx_gc {
+sub eidx_gc { # top-level entry point
my ($self, $opt) = @_;
$self->{cfg} or die "E: GC requires ->attach_config\n";
$opt->{-idx_gc} = 1;
+ local $self->{checkpoint_unlocks} = 1;
my $sync = {
need_checkpoint => \(my $need_checkpoint),
check_intvl => 10,
next_check => now() + 10,
- checkpoint_unlocks => 1,
-opt => $opt,
self => $self,
};
@@ -1159,11 +1159,11 @@ sub eidx_sync { # main entry point
}
if (my $msgids = delete($opt->{dedupe})) {
- local $sync->{checkpoint_unlocks} = 1;
+ local $self->{checkpoint_unlocks} = 1;
eidx_dedupe($self, $sync, $msgids);
}
if (delete($opt->{reindex})) {
- local $sync->{checkpoint_unlocks} = 1;
+ local $self->{checkpoint_unlocks} = 1;
eidx_reindex($self, $sync);
}
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index c894b648..87118ec4 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -707,7 +707,7 @@ sub reindex_checkpoint ($$) {
my $mm_tmp = $sync->{mm_tmp};
$mm_tmp->atfork_prepare if $mm_tmp;
die 'BUG: {im} during reindex' if $self->{im};
- if ($self->{ibx_map} && !$sync->{checkpoint_unlocks}) {
+ if ($self->{ibx_map} && !$self->{checkpoint_unlocks}) {
checkpoint($self, 1); # no need to release lock on pure index
} else {
$self->done; # release lock
next prev parent reply other threads:[~2024-12-12 10:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-12 10:10 [PATCH 0/3] indexing cleanups Eric Wong
2024-12-12 10:10 ` [PATCH 1/3] searchidx: update_checkpoint: take bytes arg directly Eric Wong
2024-12-12 10:10 ` Eric Wong [this message]
2024-12-12 10:10 ` [PATCH 3/3] searchidx: consolidate checkpoint accounting 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=20241212101040.1109774-3-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.
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).