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 D0BAB1FC5D for ; Sat, 10 Aug 2024 09:00:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1723280414; bh=86ecV/dJFcEiTXOmxdAUdt+tnxGBu+z8y4gABFl4Djk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NiaKhxX0hlVSmNlMsARuuZ9f/gpu8YpibjC6kKOct9I/AZ6d5AoZrg3ZilRwmu5vl jy6q4lANH0J4kP+wu3wBeq5SgoKRMH7fzTGwBH+hyhIH9U7mJ4jFLbrEVHnojFpwTb W35fFa3RLGGwDUE/35qJECKgv2QeW1P1wPlLOxyI= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 07/11] extindex: avoid branch in ->index_eml Date: Sat, 10 Aug 2024 09:00:08 +0000 Message-ID: <20240810090012.23269-8-e@80x24.org> In-Reply-To: <20240810090012.23269-1-e@80x24.org> References: <20240810090012.23269-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We'll probably be stuffing more extindex-specific fields in here, so it simplifies our internal API. --- lib/PublicInbox/ExtSearchIdx.pm | 6 ++++-- lib/PublicInbox/SearchIdxShard.pm | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 934197c0..68700c8b 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -245,7 +245,8 @@ sub index_unseen ($) { my $oid = $new_smsg->{blob}; my $ibx = delete $req->{ibx} or die 'BUG: {ibx} unset'; $self->{oidx}->add_xref3($docid, $req->{xnum}, $oid, $ibx->eidx_key); - $idx->index_eml($eml, $new_smsg, $ibx->eidx_key); + $new_smsg->{eidx_key} = $ibx->eidx_key; + $idx->index_eml($eml, $new_smsg); check_batch_limit($req); } @@ -578,7 +579,8 @@ sub _reindex_finalize ($$$) { my $top_smsg = pop @$stable; $top_smsg == $smsg or die 'BUG: top_smsg != smsg'; my $ibx = _ibx_for($self, $sync, $smsg); - $idx->index_eml($eml, $smsg, $ibx->eidx_key); + $smsg->{eidx_key} = $ibx->eidx_key; + $idx->index_eml($eml, $smsg); for my $x (reverse @$stable) { $ibx = _ibx_for($self, $sync, $x); my $hdr = delete $x->{hdr} // die 'BUG: no {hdr}'; diff --git a/lib/PublicInbox/SearchIdxShard.pm b/lib/PublicInbox/SearchIdxShard.pm index ea261bda..7ee8a121 100644 --- a/lib/PublicInbox/SearchIdxShard.pm +++ b/lib/PublicInbox/SearchIdxShard.pm @@ -49,8 +49,7 @@ sub ipc_atfork_child { # called automatically before ipc_worker_loop } sub index_eml { - my ($self, $eml, $smsg, $eidx_key) = @_; - $smsg->{eidx_key} = $eidx_key if defined $eidx_key; + my ($self, $eml, $smsg) = @_; $self->ipc_do('add_xapian', $eml, $smsg); }