From: Eric Wong Date: Thu, 31 Aug 2023 08:38:57 +0000 (+0000) Subject: xap_helper: deal with Xapian::DocNotFoundError X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36c0c299ee9a8bb9cd6a64c516e395e6f2ebe478;p=thirdparty%2Fpublic-inbox.git xap_helper: deal with Xapian::DocNotFoundError It's possible for a long mset streaming operation to hit missing documents after a database reopen if deletes hit the DB. --- diff --git a/lib/PublicInbox/XapHelper.pm b/lib/PublicInbox/XapHelper.pm index ef6a47a34..36266e656 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 17085adca..871a381c7 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; }