summaryrefslogtreecommitdiff
path: root/src/block/block_vrfy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/block/block_vrfy.c')
-rw-r--r--src/block/block_vrfy.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/block/block_vrfy.c b/src/block/block_vrfy.c
index a8e59ad0af7..af58864b9dc 100644
--- a/src/block/block_vrfy.c
+++ b/src/block/block_vrfy.c
@@ -20,8 +20,10 @@ static int __verify_set_file_size(WT_SESSION_IMPL *, WT_BLOCK *, WT_CKPT *);
/* The bit list ignores the first block: convert to/from a frag/offset. */
#define WT_wt_off_TO_FRAG(block, off) \
((off) / (block)->allocsize - 1)
+#ifdef HAVE_VERBOSE
#define WT_FRAG_TO_OFF(block, frag) \
(((wt_off_t)(frag + 1)) * (block)->allocsize)
+#endif
/*
* __wt_block_verify_start --
@@ -35,6 +37,14 @@ __wt_block_verify_start(WT_SESSION_IMPL *session,
WT_CONFIG_ITEM cval;
wt_off_t size;
+ /* Configuration: strict behavior on any error. */
+ WT_RET(__wt_config_gets(session, cfg, "strict", &cval));
+ block->verify_strict = cval.val != 0;
+
+ /* Configuration: dump the file's layout. */
+ WT_RET(__wt_config_gets(session, cfg, "dump_layout", &cval));
+ block->verify_layout = cval.val != 0;
+
/*
* Find the last checkpoint in the list: if there are none, or the only
* checkpoint we have is fake, there's no work to do. Don't complain,
@@ -105,9 +115,6 @@ __wt_block_verify_start(WT_SESSION_IMPL *session,
*/
WT_RET(__verify_last_avail(session, block, ckpt));
- /* Configuration: strict behavior on any error. */
- WT_RET(__wt_config_gets(session, cfg, "strict", &cval));
- block->verify_strict = cval.val != 0;
return (0);
}
@@ -152,11 +159,23 @@ __verify_set_file_size(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckpt)
{
WT_BLOCK_CKPT *ci, _ci;
WT_DECL_RET;
+ WT_DECL_ITEM(tmp);
ci = &_ci;
WT_RET(__wt_block_ckpt_init(session, ci, ckpt->name));
WT_ERR(__wt_block_buffer_to_ckpt(session, block, ckpt->raw.data, ci));
+ if (block->verify_layout) {
+ WT_ERR(__wt_scr_alloc(session, 0, &tmp));
+ WT_ERR(__wt_msg(session, "%s: physical size %s", block->name,
+ __wt_buf_set_size(
+ session, (uint64_t)block->size, true, tmp)));
+ WT_ERR(
+ __wt_msg(session, "%s: correcting to %s checkpoint size %s",
+ block->name, ckpt->name, __wt_buf_set_size(
+ session, (uint64_t)ci->file_size, true, tmp)));
+ }
+
/*
* Verify is read-only. Set the block's file size information as if we
* truncated the file during checkpoint load, so references to blocks
@@ -165,6 +184,7 @@ __verify_set_file_size(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckpt)
block->size = block->extend_size = ci->file_size;
err: __wt_block_ckpt_destroy(session, ci);
+ __wt_scr_free(session, &tmp);
return (ret);
}
@@ -253,9 +273,9 @@ __wt_verify_ckpt_load(
}
/*
- * We don't need to list of blocks on a checkpoint's avail list, but we
- * read it to ensure it wasn't corrupted. We could confirm correctness
- * of intermediate avail lists (that is, if they're logically the result
+ * We don't need the blocks on a checkpoint's avail list, but we read it
+ * to ensure it wasn't corrupted. We could confirm correctness of the
+ * intermediate avail lists (that is, if they're logically the result
* of the allocations and discards to this point). We don't because the
* only avail list ever used is the one for the last checkpoint, which
* is separately verified by checking it against all of the blocks found
@@ -443,6 +463,7 @@ __verify_filefrag_chk(WT_SESSION_IMPL *session, WT_BLOCK *block)
__bit_set(block->fragfile, last);
}
+#ifdef HAVE_VERBOSE
if (!WT_VERBOSE_ISSET(session, WT_VERB_VERIFY))
continue;
@@ -450,6 +471,7 @@ __verify_filefrag_chk(WT_SESSION_IMPL *session, WT_BLOCK *block)
"file range %" PRIuMAX "-%" PRIuMAX " never verified",
(uintmax_t)WT_FRAG_TO_OFF(block, first),
(uintmax_t)WT_FRAG_TO_OFF(block, last));
+#endif
}
if (count == 0)
return (0);
@@ -534,6 +556,7 @@ __verify_ckptfrag_chk(WT_SESSION_IMPL *session, WT_BLOCK *block)
__bit_clear(block->fragckpt, last);
}
+#ifdef HAVE_VERBOSE
if (!WT_VERBOSE_ISSET(session, WT_VERB_VERIFY))
continue;
@@ -541,6 +564,7 @@ __verify_ckptfrag_chk(WT_SESSION_IMPL *session, WT_BLOCK *block)
"checkpoint range %" PRIuMAX "-%" PRIuMAX " never verified",
(uintmax_t)WT_FRAG_TO_OFF(block, first),
(uintmax_t)WT_FRAG_TO_OFF(block, last));
+#endif
}
if (count == 0)