From: Eric Wong Date: Thu, 12 Dec 2024 10:10:39 +0000 (+0000) Subject: extindex: move {checkpoint_unlocks} to $self X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c32510a5d6f7508afdf1ee178078603fd5fdd6bd;p=thirdparty%2Fpublic-inbox.git extindex: move {checkpoint_unlocks} to $self One small step towards eliminating the $sync structure. --- diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 1c2a9a26d..a172ba624 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 c894b6482..87118ec46 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