]> Sergey Matveev's repositories - public-inbox.git/commitdiff
extsearchidx: use more appropriate max for dedupe
authorEric Wong <e@80x24.org>
Sun, 25 Jul 2021 00:11:03 +0000 (00:11 +0000)
committerEric Wong <e@80x24.org>
Sun, 25 Jul 2021 00:19:22 +0000 (00:19 +0000)
The over.msgid table may contain ghost Message-IDs and also
Message-IDs of deleted spam messages, so over->max isn't a
good aproproximation of dedupe progress.

lib/PublicInbox/ExtSearchIdx.pm

index 1c2a97588e3432960d87ad50390f20bf35317adf..51dbf54f2a1a6dada2d98c1d460b0fe633b2f30f 100644 (file)
@@ -896,7 +896,10 @@ sub eidx_dedupe ($$$) {
        my ($iter, $cur_mid);
        my $min_id = 0;
        my $idx = 0;
-       local $sync->{-regen_fmt} = "dedupe %u/".$self->{oidx}->max."\n";
+       my ($max_id) = $self->{oidx}->dbh->selectrow_array(<<EOS);
+SELECT MAX(id) FROM msgid
+EOS
+       local $sync->{-regen_fmt} = "dedupe %u/$max_id\n";
 
        # note: we could write this query more intelligently,
        # but that causes lock contention with read-only processes