about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiXSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-07-07 09:40:30 +0000
committerEric Wong <e@80x24.org>2022-07-07 09:47:58 +0000
commit6313d8bbc5f3816eb4936443fca57b411f4f6286 (patch)
tree02a5f01b8c85d610b78807aa8cbfc4a13d556cdf /lib/PublicInbox/LeiXSearch.pm
parente85ea061aa504e490bccbaad8d249ce039c0ab53 (diff)
downloadpublic-inbox-6313d8bbc5f3816eb4936443fca57b411f4f6286.tar.gz
This may help track down deduplication or other bugs in lei
which lead to occasionally missing messages.

Link: https://public-inbox.org/meta/CAL_JsqJH8xx_2NyZffNsRXbGXiv3kjmCETvKXt3Yfb0uToLm9Q@mail.gmail.com/
Diffstat (limited to 'lib/PublicInbox/LeiXSearch.pm')
-rw-r--r--lib/PublicInbox/LeiXSearch.pm20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 41e79856..6f877019 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # Combine any combination of PublicInbox::Search,
@@ -163,8 +163,9 @@ sub mset_progress {
 }
 
 sub l2m_progress {
-        my ($lei, $nr) = @_;
-        $lei->{-nr_write} += $nr;
+        my ($lei, $nr_write, $nr_seen) = @_;
+        $lei->{-nr_write} += $nr_write;
+        $lei->{-nr_seen} += $nr_seen;
 }
 
 sub query_one_mset { # for --threads and l2m w/o sort
@@ -447,13 +448,16 @@ Error closing $lei->{ovv}->{dst}: \$!=$! \$?=$?
                 }
                 if ($lei->{-progress}) {
                         my $tot = $lei->{-mset_total} // 0;
-                        my $nr = $lei->{-nr_write} // 0;
+                        my $nr_w = $lei->{-nr_write} // 0;
+                        my $d = ($lei->{-nr_seen} // 0) - $nr_w;
+                        my $x = "$tot matches";
+                        $x .= ", $d duplicates" if $d;
                         if ($l2m) {
-                                my $m = "# $nr written to " .
-                                        "$lei->{ovv}->{dst} ($tot matches)";
-                                $nr ? $lei->qfin($m) : $lei->qerr($m);
+                                my $m = "# $nr_w written to " .
+                                        "$lei->{ovv}->{dst} ($x)";
+                                $nr_w ? $lei->qfin($m) : $lei->qerr($m);
                         } else {
-                                $lei->qerr("# $tot matches");
+                                $lei->qerr("# $x");
                         }
                 }
                 $lei->start_mua if $l2m && !$l2m->lock_free;