]> Sergey Matveev's repositories - public-inbox.git/commitdiff
*index: avoid per-epoch --batch-check processes
authorEric Wong <e@80x24.org>
Fri, 13 Nov 2020 11:11:42 +0000 (11:11 +0000)
committerEric Wong <e@80x24.org>
Sun, 15 Nov 2020 02:56:00 +0000 (02:56 +0000)
Since all.git (v2) and ALL.git (extindex) encompass every single
epoch or indexed inbox; and is_ancestor() only uses hexadecimal
OIDs; there is no good reason to use $unit->{git} for an
epoch-local $git->check.

This prevents dozens/hundreds of --batch-check processes from
being left running after indexing and can improve locality
if size checks are being done (since that uses --batch-check,
too).

Theoretically several epochs may have conflicting OIDs, but
we're screwed in those cases, anyways, so we might as well
detect it earlier (though I'm not sure what the behavior would
be :x).

lib/PublicInbox/ExtSearchIdx.pm
lib/PublicInbox/V2Writable.pm

index 14ffdadb36eebff00606beae037f0838b116d87d..2d230dc18045e5bff145f4e2a0bcb6d513e2178c 100644 (file)
@@ -361,7 +361,7 @@ sub update_last_commit { # overrides V2Writable
                die "Unsupported inbox version: $v";
        }
        my $last = $self->{oidx}->eidx_meta($meta_key);
-       if (defined $last && is_ancestor($unit->{git}, $last, $latest_cmt)) {
+       if (defined $last && is_ancestor($self->git, $last, $latest_cmt)) {
                my @cmd = (qw(rev-list --count), "$last..$latest_cmt");
                chomp(my $n = $unit->{git}->qx(@cmd));
                return if $n ne '' && $n == 0;
index 87b76501a5e1fb984acc6eab0c13197cd1015694..cf44c95bc8ebfa6aca7d402798a2a9d5f51514fc 100644 (file)
@@ -966,7 +966,7 @@ sub update_last_commit {
        my $latest_cmt = $stk ? $stk->{latest_cmt} : ${$sync->{latest_cmt}};
        defined($latest_cmt) or return;
        my $last = last_epoch_commit($self, $unit->{epoch});
-       if (defined $last && is_ancestor($unit->{git}, $last, $latest_cmt)) {
+       if (defined $last && is_ancestor($self->git, $last, $latest_cmt)) {
                my @cmd = (qw(rev-list --count), "$last..$latest_cmt");
                chomp(my $n = $unit->{git}->qx(@cmd));
                return if $n ne '' && $n == 0;
@@ -1003,7 +1003,7 @@ sub log_range ($$$) {
        my $range = "$cur..$tip";
        $pr->("$i.git checking contiguity... ") if $pr;
        my $git = $unit->{git};
-       if (is_ancestor($git, $cur, $tip)) { # common case
+       if (is_ancestor($sync->{self}->git, $cur, $tip)) { # common case
                $pr->("OK\n") if $pr;
                my $n = $git->qx(qw(rev-list --count), $range);
                chomp($n);