From: Eric Wong Date: Fri, 10 Jan 2025 23:20:59 +0000 (+0000) Subject: (ext)index: eliminate $sync->{ibx} X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=62c59b751c259a53180d7698a0fcef41c6c92535;p=thirdparty%2Fpublic-inbox.git (ext)index: eliminate $sync->{ibx} Perhaps the trickiest field to eliminate from $sync {ibx} due to the way -extindex handles cross-posted messages. We now eliminate the per-request $req->{ibx} for non-crossposted messages and use local-ized $self->{ibx} directly. --- diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index c0eae0e3c..946f5a4b3 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -223,7 +223,7 @@ sub do_xpost ($$) { my $self = $req->{self}; my $docid = $smsg->{num}; my $oid = $req->{oid}; - my $xibx = $req->{ibx}; + my $xibx = $req->{ibx} // $self->{ibx}; my $eml = $req->{eml}; if (my $new_smsg = $req->{new_smsg}) { # 'm' on cross-posted message my $eidx_key = $xibx->eidx_key; @@ -253,7 +253,7 @@ sub index_unseen ($) { my $idx = $self->idx_shard($docid); $self->{oidx}->add_overview($eml, $new_smsg); my $oid = $new_smsg->{blob}; - my $ibx = delete $req->{ibx} or die 'BUG: {ibx} unset'; + my $ibx = ($req->{ibx} // $self->{ibx}) or die 'BUG: {ibx} unset'; my $ekey = $new_smsg->{eidx_key} = $ibx->eidx_key; $self->{oidx}->add_xref3($docid, $req->{xnum}, $oid, $ekey); $idx->index_eml($eml, $new_smsg); @@ -326,8 +326,8 @@ sub ck_existing { # git->cat_async callback # return the number if so sub cur_ibx_xnum ($$;$) { my ($req, $bref, $mismatch) = @_; - my $ibx = $req->{ibx} or die 'BUG: current {ibx} missing'; - + my $ibx = ($req->{ibx} // $req->{self}->{ibx}) or + die 'BUG: current {ibx} missing'; $req->{eml} = PublicInbox::Eml->new($bref); $req->{chash} = content_hash($req->{eml}); $req->{mids} = mids($req->{eml}); @@ -397,7 +397,6 @@ sub _sync_inbox ($$$) { if (defined(my $err = _ibx_index_reject($ibx))) { return "W: skipping $ekey ($err)"; } - $sync->{ibx} = $ibx; # FIXME: eliminate local $self->{ibx} = $ibx; $self->{nrec} = 0; local $self->{epoch_max}; diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index ded3f2c1f..80ee346d0 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -1237,7 +1237,7 @@ sub index_sync { local $self->{todo}; # sync_prepare local $self->{ranges}; local $self->{unindexed}; - my $sync = { self => $self, ibx => $self->{ibx} }; + my $sync = { self => $self }; my $quit = PublicInbox::SearchIdx::quit_cb $self; local $SIG{QUIT} = $quit; local $SIG{INT} = $quit;