From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2871A1F4D3 for ; Thu, 12 Dec 2024 10:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1733998241; bh=q+dmfdHCMXffLlWbeYZKodEMJHgQ1ujok5ck4PwiUrw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EjgxHxDOQ0FDlGuzdKQLVAEpBlOuH+i6Yjc1IqPI6LU0vneXHE7SScMICs2hKfS1R ESfYmgvzVyhTsEqTMQ9SMUZun0AuujhHwFyYJkthhOt6PuYWP4Of3rw2lE3Sv8uUzg Dp6+cusyPWcZQYTtKLPkXOoB+Snxt5VexKy1KUrw= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/3] extindex: move {checkpoint_unlocks} to $self Date: Thu, 12 Dec 2024 10:10:39 +0000 Message-ID: <20241212101040.1109774-3-e@80x24.org> In-Reply-To: <20241212101040.1109774-1-e@80x24.org> References: <20241212101040.1109774-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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