From: Eric Wong Date: Fri, 10 Jan 2025 23:19:03 +0000 (+0000) Subject: (ext)index: eliminate most uses of `$sync->{ibx}' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c94890ec4308cb1eb2b8a11fafd365f83bd15463;p=thirdparty%2Fpublic-inbox.git (ext)index: eliminate most uses of `$sync->{ibx}' Yet another step towards eliminating the $sync structure. There's still a few remaining dependencies due to cross-inbox linkage but the goal is to reduce refcount traffic for the majority of Inbox object references. This field in $sync will be completely eliminated in the next few commits. --- diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 32cdd0907..76699c6b3 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -375,8 +375,8 @@ sub unindex_oid { # git->cat_async callback for 'd' sub last_commits { my ($self, $sync) = @_; my $heads = []; - my $ekey = $sync->{ibx}->eidx_key; - my $uv = $sync->{ibx}->uidvalidity; + my $ekey = $self->{ibx}->eidx_key; + my $uv = $self->{ibx}->uidvalidity; for my $i (0..$sync->{epoch_max}) { $heads->[$i] = $self->{oidx}->eidx_meta("lc-v2:$ekey//$uv;$i"); } @@ -1170,7 +1170,7 @@ sub update_last_commit { # overrides V2Writable my $unit = $sync->{unit} // return; my $latest_cmt = $stk ? $stk->{latest_cmt} : $self->{latest_cmt}; defined($latest_cmt) or return; - my $ibx = $sync->{ibx} or die 'BUG: {ibx} missing'; + my $ibx = $self->{ibx} or die 'BUG: {ibx} missing'; my $ekey = $ibx->eidx_key; my $uv = $ibx->uidvalidity; my $epoch = $unit->{epoch}; diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index e5d54dc6f..0606c99f3 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -912,12 +912,12 @@ sub sync_prepare ($$) { $sync->{ranges} = sync_ranges($self, $sync); my $pr = $self->{-opt}->{-progress}; my $regen_max = 0; - my $head = $sync->{ibx}->{ref_head} || 'HEAD'; + my $head = $self->{ibx}->{ref_head} || 'HEAD'; my $pfx; local $self->{D}; # delete state if ($pr) { - ($pfx) = ($sync->{ibx}->{inboxdir} =~ m!([^/]+)\z!g); - $pfx //= $sync->{ibx}->{inboxdir}; + ($pfx) = ($self->{ibx}->{inboxdir} =~ m!([^/]+)\z!g); + $pfx //= $self->{ibx}->{inboxdir}; } my $reindex_heads; @@ -927,7 +927,7 @@ sub sync_prepare ($$) { # what's in the per-inbox index. $reindex_heads = []; my $v = PublicInbox::Search::SCHEMA_VERSION; - my $mm = $sync->{ibx}->mm; + my $mm = $self->{ibx}->mm; for my $i (0..$sync->{epoch_max}) { $reindex_heads->[$i] = $mm->last_commit_xap($v, $i); } @@ -938,7 +938,7 @@ sub sync_prepare ($$) { } $self->{max_size} = $self->{-opt}->{max_size} and $self->{index_oid} = $self->can('index_oid'); - my $git_pfx = "$sync->{ibx}->{inboxdir}/git"; + my $git_pfx = "$self->{ibx}->{inboxdir}/git"; for (my $i = $sync->{epoch_max}; $i >= 0; $i--) { my $git_dir = "$git_pfx/$i.git"; -d $git_dir or next; # missing epochs are fine