about summary refs log tree commit homepage
path: root/lib/PublicInbox/Search.pm
diff options
authorEric Wong <e@80x24.org>2021-05-28 19:47:23 +0000
committerEric Wong <e@80x24.org>2021-05-28 22:37:53 +0000
commit5944277a4dc986f9adf9ba69a1e6e44899ad98c1 (patch)
tree45c8fe978d381e61eb3e7658ef89fa51f7a2103d /lib/PublicInbox/Search.pm
parent82e141cdf4a00de174b0a919689d846bb387cbf5 (diff)
Xapian DBs may be modified by a parallel process while we're
reading it, and Xapian's MVCC model places the burden on readers
to retry operations.

We'll also have retry_reopen croak instead of die on errors,
which ought to help us track down some "Document not found"
errors I've occasionally seen when using "lei <q|up>".
Diffstat (limited to 'lib/PublicInbox/Search.pm')
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index fbcff2c3..59a5a3b0 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -9,6 +9,7 @@ use parent qw(Exporter);
 our @EXPORT_OK = qw(retry_reopen int_val get_pct xap_terms);
 use List::Util qw(max);
 use POSIX qw(strftime);
+use Carp ();
 # values for searching, changing the numeric value breaks
 # compatibility with old indices (so don't change them it)
@@ -405,16 +406,16 @@ sub retry_reopen {
                 # Exception: The revision being read has been discarded -
                 # you should call Xapian::Database::reopen()
                 if (ref($@) =~ /\bDatabaseModifiedError\b/) {
-                        warn "reopen try #$i on $@\n";
+                        warn "# reopen try #$i on $@\n";
                 } else {
                         # let caller decide how to spew, because ExtMsg queries
                         # get wonky and trigger:
                         # "something terrible happened at .../Xapian/Enquire.pm"
-                        die;
+                        Carp::croak($@);
-        die "Too many Xapian database modifications in progress\n";
+        Carp::croak("Too many Xapian database modifications in progress\n");
 sub _do_enquire {