]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
extindex: move {checkpoint_unlocks} to $self
authorEric Wong <e@80x24.org>
Thu, 12 Dec 2024 10:10:39 +0000 (10:10 +0000)
committerEric Wong <e@80x24.org>
Fri, 13 Dec 2024 19:58:10 +0000 (19:58 +0000)
One small step towards eliminating the $sync structure.

lib/PublicInbox/ExtSearchIdx.pm
lib/PublicInbox/V2Writable.pm

index 1c2a9a26d3d74b53240490f011e22b1e2c7cabdc..a172ba6243c27b6813be648508c4740939b12fff 100644 (file)
@@ -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);
        }
 
index c894b6482eb7549601218b8a6595aeff6cd24920..87118ec46ceb85a1ceb6ba0b600e02a3037c5a54 100644 (file)
@@ -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