summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/btree/bt_vrfy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/btree/bt_vrfy.c')
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_vrfy.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_vrfy.c b/src/third_party/wiredtiger/src/btree/bt_vrfy.c
index 97b1be8bffe..d5e3438e413 100644
--- a/src/third_party/wiredtiger/src/btree/bt_vrfy.c
+++ b/src/third_party/wiredtiger/src/btree/bt_vrfy.c
@@ -29,11 +29,14 @@ typedef struct {
bool dump_blocks;
bool dump_layout;
bool dump_pages;
+ bool read_corrupt;
/* Page layout information. */
uint64_t depth, depth_internal[100], depth_leaf[100];
WT_ITEM *tmp1, *tmp2, *tmp3, *tmp4; /* Temporary buffers */
+
+ int verify_err;
} WT_VSTUFF;
static void __verify_checkpoint_reset(WT_VSTUFF *);
@@ -78,6 +81,10 @@ __verify_config(WT_SESSION_IMPL *session, const char *cfg[], WT_VSTUFF *vs)
WT_RET(__wt_config_gets(session, cfg, "dump_pages", &cval));
vs->dump_pages = cval.val != 0;
+ WT_RET(__wt_config_gets(session, cfg, "read_corrupt", &cval));
+ vs->read_corrupt = cval.val != 0;
+ vs->verify_err = 0;
+
WT_RET(__wt_config_gets(session, cfg, "stable_timestamp", &cval));
vs->stable_timestamp = WT_TS_NONE; /* Ignored unless a value has been set */
if (cval.val != 0) {
@@ -260,6 +267,13 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[])
session, ret = __verify_tree(session, &btree->root, &addr_unpack, vs));
/*
+ * If the read_corrupt mode was turned on, we may have continued traversing and
+ * verifying the pages of the tree despite encountering an error. Set the error.
+ */
+ if (vs->verify_err != 0)
+ ret = vs->verify_err;
+
+ /*
* We have an exclusive lock on the handle, but we're swapping root pages in-and-out of
* that handle, and there's a race with eviction entering the tree and seeing an invalid
* root page. Eviction must work on trees being verified (else we'd have to do our own
@@ -585,7 +599,18 @@ celltype_err:
/* Verify the subtree. */
++vs->depth;
- WT_RET(__wt_page_in(session, child_ref, 0));
+ ret = __wt_page_in(session, child_ref, 0);
+
+ /*
+ * If configured, continue traversing through the pages of the tree even after
+ * encountering errors reading in the page.
+ */
+ if (vs->read_corrupt && ret != 0) {
+ if (vs->verify_err == 0)
+ vs->verify_err = ret;
+ continue;
+ } else
+ WT_RET(ret);
ret = __verify_tree(session, child_ref, unpack, vs);
WT_TRET(__wt_page_release(session, child_ref, 0));
--vs->depth;
@@ -615,7 +640,18 @@ celltype_err:
/* Verify the subtree. */
++vs->depth;
- WT_RET(__wt_page_in(session, child_ref, 0));
+ ret = __wt_page_in(session, child_ref, 0);
+
+ /*
+ * If configured, continue traversing through the pages of the tree even after
+ * encountering errors reading in the page.
+ */
+ if (vs->read_corrupt && ret != 0) {
+ if (vs->verify_err == 0)
+ vs->verify_err = ret;
+ continue;
+ } else
+ WT_RET(ret);
ret = __verify_tree(session, child_ref, unpack, vs);
WT_TRET(__wt_page_release(session, child_ref, 0));
--vs->depth;