diff options
author | Eric Wong <e@80x24.org> | 2021-10-16 22:52:48 -1100 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-10-17 19:04:46 +0000 |
commit | 1e077113dc88703c47a0164cc2bb2ff03c2a45a1 (patch) | |
tree | 3a1ca4920a0578379aeac57564229f93ea97d81e /lib/PublicInbox | |
parent | 84897536c91023566556d3564da6f3d4316f557e (diff) | |
download | public-inbox-1e077113dc88703c47a0164cc2bb2ff03c2a45a1.tar.gz |
Ensure the num highwater mark of the target inbox is stable before using it. Otherwise we may end up repeating work done to index a message.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/ExtSearchIdx.pm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 67d72036..daff656d 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -859,14 +859,20 @@ sub _reindex_check_ibx ($$$) { my $slice = 10000; my $opt = { limit => $slice }; my ($beg, $end) = (1, $slice); - my $err = sync_inbox($self, $sync, $ibx) and return; - my $max = $ibx->mm->num_highwater; + my $ekey = $ibx->eidx_key; + my ($max, $max0); + do { + $max0 = $ibx->mm->num_highwater; + sync_inbox($self, $sync, $ibx) and return; # warned + $max = $ibx->mm->num_highwater; + return if $sync->{quit}; + } while ($max > $max0 && + warn("# $ekey moved $max0..$max, resyncing..\n")); $end = $max if $end > $max; # first, check if we missed any messages in target $ibx my $msgs; my $pr = $sync->{-opt}->{-progress}; - my $ekey = $ibx->eidx_key; local $sync->{-regen_fmt} = "$ekey checking %u/$max\n"; ${$sync->{nr}} = 0; my $fast = $sync->{-opt}->{fast}; |