* [PATCH] xap_helper: deal with Xapian::DocNotFoundError
@ 2023-08-31 8:38 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-08-31 8:38 UTC (permalink / raw)
To: meta
It's possible for a long mset streaming operation to hit missing
documents after a database reopen if deletes hit the DB.
---
lib/PublicInbox/XapHelper.pm | 12 +++++++++---
lib/PublicInbox/xap_helper.h | 4 ++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/lib/PublicInbox/XapHelper.pm b/lib/PublicInbox/XapHelper.pm
index ef6a47a3..36266e65 100644
--- a/lib/PublicInbox/XapHelper.pm
+++ b/lib/PublicInbox/XapHelper.pm
@@ -37,9 +37,15 @@ sub cmd_test_inspect {
}
sub iter_retry_check ($) {
- die unless ref($@) =~ /\bDatabaseModifiedError\b/;
- $_[0]->{srch}->reopen;
- undef; # retries
+ if (ref($@) =~ /\bDatabaseModifiedError\b/) {
+ $_[0]->{srch}->reopen;
+ undef; # retries
+ } elsif (ref($@) =~ /\bDocNotFoundError\b/) {
+ warn "doc not found: $@";
+ 0; # continue to next doc
+ } else {
+ die;
+ }
}
sub dump_ibx_iter ($$$) {
diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h
index 17085adc..871a381c 100644
--- a/lib/PublicInbox/xap_helper.h
+++ b/lib/PublicInbox/xap_helper.h
@@ -256,6 +256,8 @@ static enum exc_iter dump_ibx_iter(struct req *req, const char *ibx_id,
} catch (const Xapian::DatabaseModifiedError & e) {
req->srch->db->reopen();
return ITER_RETRY;
+ } catch (const Xapian::DocNotFoundError & e) { // oh well...
+ warnx("doc not found: %s", e.get_description().c_str());
}
return ITER_OK;
}
@@ -456,6 +458,8 @@ static enum exc_iter dump_roots_iter(struct req *req,
} catch (const Xapian::DatabaseModifiedError & e) {
req->srch->db->reopen();
return ITER_RETRY;
+ } catch (const Xapian::DocNotFoundError & e) { // oh well...
+ warnx("doc not found: %s", e.get_description().c_str());
}
return ITER_OK;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-08-31 8:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-31 8:38 [PATCH] xap_helper: deal with Xapian::DocNotFoundError Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).