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, T_SCC_BODY_TEXT_LINE 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 45E2A1F452 for ; Thu, 30 Nov 2023 11:41:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1701344469; bh=0wJTkLZfzspurHRnFFyUK+RNjqBFWuCbzZdzFtmcbk4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vVPcDILAtQNXRIdQVyfn8BK8kuRFRHXm8DMRPyhWntOpGM8nDjBynGeoOgzpDNGNz dgikzHp3eyMxP6uZE7WmRZ6o4xG7eI90K+E3m1TT4jhsORl2l3hTP+rZSnKjr/IEqk ZjSQ7Le+AIjjAtJFg4z9E1Ntjs3aRreOhf5OLkAk= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 01/15] cindex: fix store_repo+repo_stored on no-op Date: Thu, 30 Nov 2023 11:40:54 +0000 Message-ID: <20231130114109.2577708-2-e@80x24.org> In-Reply-To: <20231130114109.2577708-1-e@80x24.org> References: <20231130114109.2577708-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It's possible to update the fingerprint for a given repo when we have no commits to index on because they were already done for another repo. Thus we'll always vivify $repo_ctx->{active} before calling store_repo since $active may've been undef. --- lib/PublicInbox/CodeSearchIdx.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index 7d696099..bd67a57e 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -613,14 +613,14 @@ sub next_repos { # OnDestroy cb sub index_done { # OnDestroy cb called when done indexing each code repo my ($repo_ctx, $drs) = @_; - my ($self, $repo, $active) = @$repo_ctx{qw(self repo active)}; - return if $DO_QUIT; + my ($self, $repo, $active) = @$repo_ctx{qw(self repo active)}; + # $active may be undef here, but it's fine to vivify my $n = grep { ! $repo_ctx->{shard_ok}->{$_} } keys %$active; die "E: $repo->{git_dir} $n shards failed" if $n; $repo_ctx->{shard_ok} = {}; # reset for future shard_done $n = $repo->{shard_n}; - $active->{$n} = undef; + $repo_ctx->{active}->{$n} = undef; # may vivify $repo_ctx->{active} my ($c, $p) = PublicInbox::PktOp->pair; $c->{ops}->{repo_stored} = [ $self, $repo_ctx, $drs ]; $IDX_SHARDS[$n]->wq_io_do('store_repo', [ $p->{op_p} ], $repo);