]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
xap_helper: deal with Xapian::DocNotFoundError
authorEric Wong <e@80x24.org>
Thu, 31 Aug 2023 08:38:57 +0000 (08:38 +0000)
committerEric Wong <e@80x24.org>
Fri, 1 Sep 2023 06:04:14 +0000 (06:04 +0000)
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
lib/PublicInbox/xap_helper.h

index ef6a47a34a0c59252a9ea85a0ac4a1a0cb8b1325..36266e656c9235806ab39b1f74bb59000783e69e 100644 (file)
@@ -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 ($$$) {
index 17085adcae55cc755a6d1b072314999d521e2d06..871a381c7abaed76fb307e280d70e70a6a78b7d4 100644 (file)
@@ -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;
 }