diff options
-rw-r--r-- | src/third_party/wiredtiger/dist/api_data.py | 5 | ||||
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_debug.c | 142 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_vrfy.c | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/config/config_def.c | 17 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/extern.h | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/wiredtiger.in | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/utilities/util_verify.c | 41 |
8 files changed, 144 insertions, 82 deletions
diff --git a/src/third_party/wiredtiger/dist/api_data.py b/src/third_party/wiredtiger/dist/api_data.py index 3cb49dfdfd1..2c3792db158 100644 --- a/src/third_party/wiredtiger/dist/api_data.py +++ b/src/third_party/wiredtiger/dist/api_data.py @@ -1576,6 +1576,11 @@ methods = { Display page addresses, time windows, and page types as pages are verified, using the application's message handler, intended for debugging''', type='boolean'), + Config('dump_app_data', 'false', r''' + Display application data as pages or blocks are verified, using the application's message + handler, intended for debugging. Disabling this does not guarantee that no user data will + be output''', + type='boolean'), Config('dump_blocks', 'false', r''' Display the contents of on-disk blocks as they are verified, using the application's message handler, intended for debugging''', diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 79fb13d35e4..d0eeb026d2e 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "a6a947392a951f99d498e70e6fdad1532c91d768" + "commit": "13657e7b915455b2e877061fe0f8fc00abff223c" } diff --git a/src/third_party/wiredtiger/src/btree/bt_debug.c b/src/third_party/wiredtiger/src/btree/bt_debug.c index d7b77055ee8..bf62f5fc521 100644 --- a/src/third_party/wiredtiger/src/btree/bt_debug.c +++ b/src/third_party/wiredtiger/src/btree/bt_debug.c @@ -36,20 +36,27 @@ struct __wt_dbg { const char *value_format; WT_ITEM *t1, *t2; /* Temporary space */ + +/* AUTOMATIC FLAG VALUE GENERATION START 0 */ +#define WT_DEBUG_TREE_LEAF 0x1u /* Debug leaf pages */ +#define WT_DEBUG_TREE_WALK 0x2u /* Descend the tree */ +#define WT_DEBUG_UNREDACT 0x4u /* Dump application data when walking the tree */ + /* AUTOMATIC FLAG VALUE GENERATION STOP 32 */ + uint32_t flags; }; static const /* Output separator */ char *const sep = "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; static int __debug_col_skip(WT_DBG *, WT_INSERT_HEAD *, const char *, bool, WT_CURSOR *); -static int __debug_config(WT_SESSION_IMPL *, WT_DBG *, const char *); +static int __debug_config(WT_SESSION_IMPL *, WT_DBG *, const char *, uint32_t); static int __debug_modify(WT_DBG *, const uint8_t *); -static int __debug_page(WT_DBG *, WT_REF *, uint32_t); +static int __debug_page(WT_DBG *, WT_REF *); static int __debug_page_col_fix(WT_DBG *, WT_REF *); -static int __debug_page_col_int(WT_DBG *, WT_PAGE *, uint32_t); +static int __debug_page_col_int(WT_DBG *, WT_PAGE *); static int __debug_page_col_var(WT_DBG *, WT_REF *); static int __debug_page_metadata(WT_DBG *, WT_REF *); -static int __debug_page_row_int(WT_DBG *, WT_PAGE *, uint32_t); +static int __debug_page_row_int(WT_DBG *, WT_PAGE *); static int __debug_page_row_leaf(WT_DBG *, WT_PAGE *); static int __debug_ref(WT_DBG *, WT_REF *); static int __debug_row_skip(WT_DBG *, WT_INSERT_HEAD *); @@ -128,7 +135,9 @@ __debug_item_key(WT_DBG *ds, const char *tag, const void *data_arg, size_t size) session = ds->session; return (ds->f(ds, "\t%s%s{%s}\n", tag == NULL ? "" : tag, tag == NULL ? "" : " ", - __wt_key_string(session, data_arg, size, ds->key_format, ds->t1))); + F_ISSET(ds, WT_DEBUG_UNREDACT) ? + __wt_key_string(session, data_arg, size, ds->key_format, ds->t1) : + "REDACTED")); } /* @@ -149,6 +158,9 @@ __debug_item_value(WT_DBG *ds, const char *tag, const void *data_arg, size_t siz return (ds->f(ds, "\t%s%s{%s}\n", tag == NULL ? "" : tag, tag == NULL ? "" : " ", __wt_buf_set_printable(session, data_arg, size, false, ds->t1))); + if (!F_ISSET(ds, WT_DEBUG_UNREDACT)) + return (ds->f(ds, "\t%s%s{REDACTED}\n", tag == NULL ? "" : tag, tag == NULL ? "" : " ")); + /* * If the format is 'S', it's a string and our version of it may not yet be nul-terminated. */ @@ -236,7 +248,7 @@ __dmsg_file(WT_DBG *ds, const char *fmt, ...) * Configure debugging output. */ static int -__debug_config(WT_SESSION_IMPL *session, WT_DBG *ds, const char *ofile) +__debug_config(WT_SESSION_IMPL *session, WT_DBG *ds, const char *ofile, uint32_t flags) { WT_BTREE *btree; WT_CONNECTION_IMPL *conn; @@ -294,6 +306,7 @@ __debug_config(WT_SESSION_IMPL *session, WT_DBG *ds, const char *ofile) btree = S2BT(session); ds->key_format = btree->key_format; ds->value_format = btree->value_format; + ds->flags = flags; return (0); err: @@ -370,7 +383,7 @@ __wt_debug_addr(WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size, WT_RET(__wt_scr_alloc(session, 1024, &buf)); WT_ERR(__wt_blkcache_read(session, buf, addr, addr_size)); - ret = __wt_debug_disk(session, buf->mem, ofile); + ret = __wt_debug_disk(session, buf->mem, ofile, false); err: __wt_scr_free(session, &buf); @@ -429,7 +442,7 @@ __wt_debug_offset( */ WT_RET(__wt_scr_alloc(session, 0, &buf)); WT_ERR(__wt_blkcache_read(session, buf, addr, WT_PTRDIFF(endp, addr))); - ret = __wt_debug_disk(session, buf->mem, ofile); + ret = __wt_debug_disk(session, buf->mem, ofile, false); err: __wt_scr_free(session, &buf); @@ -465,9 +478,12 @@ __debug_hs_cursor(WT_DBG *ds, WT_CURSOR *hs_cursor) "\t" "hs-modify: %s\n", __wt_time_window_to_string(&cbt->upd_value->tw, time_string))); - WT_RET(ds->f(ds, "\tV ")); - WT_RET(__debug_modify(ds, ds->hs_value->data)); - WT_RET(ds->f(ds, "\n")); + if (F_ISSET(ds, WT_DEBUG_UNREDACT)) { + WT_RET(ds->f(ds, "\tV ")); + WT_RET(__debug_modify(ds, ds->hs_value->data)); + WT_RET(ds->f(ds, "\n")); + } else + WT_RET(ds->f(ds, "\tV {REDACTED}\n")); break; case WT_UPDATE_STANDARD: WT_RET(ds->f(ds, @@ -626,7 +642,10 @@ __debug_cell_kv( if (unpack->cell == NULL) return (__debug_item(ds, tag, "zero-length", strlen("zero-length"))); - WT_RET(ds->f(ds, "\t%s: len %" PRIu32, __wt_cell_type_string(unpack->raw), unpack->size)); + if (F_ISSET(ds, WT_DEBUG_UNREDACT)) + WT_RET(ds->f(ds, "\t%s: len %" PRIu32, __wt_cell_type_string(unpack->raw), unpack->size)); + else + WT_RET(ds->f(ds, "\t%s: {REDACTED}", __wt_cell_type_string(unpack->raw))); /* Dump per-disk page type information. */ switch (page_type) { @@ -677,6 +696,10 @@ __debug_cell_kv( WT_RET(page == NULL ? __wt_dsk_cell_data_ref_kv(session, page_type, unpack, ds->t1) : __wt_page_cell_data_ref_kv(session, page, unpack, ds->t1)); + /* If redacting user data, we're done after dumping the header. */ + if (!F_ISSET(ds, WT_DEBUG_UNREDACT)) + return (0); + /* Standard key/value cells. */ switch (unpack->raw) { case WT_CELL_KEY: @@ -765,13 +788,16 @@ __debug_dsk_col_fix(WT_DBG *ds, const WT_PAGE_HEADER *dsk) * Dump a disk page in debugging mode. */ int -__wt_debug_disk(WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, const char *ofile) +__wt_debug_disk( + WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, const char *ofile, bool dump_app_data) { WT_DBG *ds, _ds; WT_DECL_RET; + uint32_t flags; ds = &_ds; - WT_RET(__debug_config(session, ds, ofile)); + flags = dump_app_data ? WT_DEBUG_UNREDACT : 0; + WT_RET(__debug_config(session, ds, ofile, flags)); WT_ERR(ds->f(ds, "%s page", __wt_page_type_string(dsk->type))); switch (dsk->type) { @@ -906,7 +932,7 @@ __wt_debug_tree_shape(WT_SESSION_IMPL *session, WT_REF *ref, const char *ofile) WT_ASSERT(session, S2BT_SAFE(session) != NULL); ds = &_ds; - WT_RET(__debug_config(session, ds, ofile)); + WT_RET(__debug_config(session, ds, ofile, 0)); /* A NULL WT_REF starts at the top of the tree -- it's a convenience. */ if (ref == NULL) @@ -918,11 +944,6 @@ __wt_debug_tree_shape(WT_SESSION_IMPL *session, WT_REF *ref, const char *ofile) return (ret); } -/* AUTOMATIC FLAG VALUE GENERATION START 0 */ -#define WT_DEBUG_TREE_LEAF 0x1u /* Debug leaf pages */ -#define WT_DEBUG_TREE_WALK 0x2u /* Descend the tree */ -/* AUTOMATIC FLAG VALUE GENERATION STOP 32 */ - /* * __wt_debug_tree_all -- * Dump the in-memory information for a tree, including leaf pages. @@ -941,7 +962,8 @@ __wt_debug_tree_all(void *session_arg, WT_BTREE *btree, WT_REF *ref, const char btree = S2BT(session); WT_WITH_BTREE(session, btree, - ret = __debug_tree(session, ref, ofile, WT_DEBUG_TREE_LEAF | WT_DEBUG_TREE_WALK)); + ret = __debug_tree( + session, ref, ofile, WT_DEBUG_TREE_LEAF | WT_DEBUG_TREE_WALK | WT_DEBUG_UNREDACT)); return (ret); } @@ -962,7 +984,8 @@ __wt_debug_tree(void *session_arg, WT_BTREE *btree, WT_REF *ref, const char *ofi if (btree == NULL) btree = S2BT(session); - WT_WITH_BTREE(session, btree, ret = __debug_tree(session, ref, ofile, WT_DEBUG_TREE_WALK)); + WT_WITH_BTREE(session, btree, + ret = __debug_tree(session, ref, ofile, WT_DEBUG_TREE_WALK | WT_DEBUG_UNREDACT)); return (ret); } @@ -971,11 +994,17 @@ __wt_debug_tree(void *session_arg, WT_BTREE *btree, WT_REF *ref, const char *ofi * Dump the in-memory information for a page. */ int -__wt_debug_page(void *session_arg, WT_BTREE *btree, WT_REF *ref, const char *ofile) +__wt_debug_page( + void *session_arg, WT_BTREE *btree, WT_REF *ref, const char *ofile, bool dump_app_data) { WT_DBG *ds, _ds; WT_DECL_RET; WT_SESSION_IMPL *session; + uint32_t flags; + + flags = WT_DEBUG_TREE_LEAF; + if (dump_app_data) + LF_SET(WT_DEBUG_UNREDACT); /* * Allow an explicit btree as an argument, as one may not yet be set on the session. @@ -985,10 +1014,10 @@ __wt_debug_page(void *session_arg, WT_BTREE *btree, WT_REF *ref, const char *ofi btree = S2BT(session); ds = &_ds; - WT_WITH_BTREE(session, btree, ret = __debug_config(session, ds, ofile)); + WT_WITH_BTREE(session, btree, ret = __debug_config(session, ds, ofile, flags)); WT_ERR(ret); - WT_WITH_BTREE(session, btree, ret = __debug_page(ds, ref, WT_DEBUG_TREE_LEAF)); + WT_WITH_BTREE(session, btree, ret = __debug_page(ds, ref)); err: WT_TRET(__debug_wrapup(ds)); @@ -1022,7 +1051,8 @@ __wt_debug_cursor_page(void *cursor_arg, const char *ofile) did_hs_checkpoint = true; } - WT_WITH_BTREE(session, CUR2BT(cbt), ret = __wt_debug_page(session, NULL, cbt->ref, ofile)); + WT_WITH_BTREE( + session, CUR2BT(cbt), ret = __wt_debug_page(session, NULL, cbt->ref, ofile, false)); if (did_hs_checkpoint) session->hs_checkpoint = NULL; @@ -1063,13 +1093,13 @@ __debug_tree(WT_SESSION_IMPL *session, WT_REF *ref, const char *ofile, uint32_t WT_DECL_RET; ds = &_ds; - WT_ERR(__debug_config(session, ds, ofile)); + WT_ERR(__debug_config(session, ds, ofile, flags)); /* A NULL page starts at the top of the tree -- it's a convenience. */ if (ref == NULL) ref = &S2BT(session)->root; - ret = __debug_page(ds, ref, flags); + ret = __debug_page(ds, ref); err: WT_TRET(__debug_wrapup(ds)); @@ -1081,7 +1111,7 @@ err: * Dump the in-memory information for an in-memory page. */ static int -__debug_page(WT_DBG *ds, WT_REF *ref, uint32_t flags) +__debug_page(WT_DBG *ds, WT_REF *ref) { WT_DECL_RET; WT_SESSION_IMPL *session; @@ -1096,23 +1126,23 @@ __debug_page(WT_DBG *ds, WT_REF *ref, uint32_t flags) /* Dump the page. */ switch (ref->page->type) { case WT_PAGE_COL_FIX: - if (LF_ISSET(WT_DEBUG_TREE_LEAF)) + if (F_ISSET(ds, WT_DEBUG_TREE_LEAF)) WT_ERR(__debug_page_col_fix(ds, ref)); break; case WT_PAGE_COL_INT: - WT_WITH_PAGE_INDEX(session, ret = __debug_page_col_int(ds, ref->page, flags)); + WT_WITH_PAGE_INDEX(session, ret = __debug_page_col_int(ds, ref->page)); WT_ERR(ret); break; case WT_PAGE_COL_VAR: - if (LF_ISSET(WT_DEBUG_TREE_LEAF)) + if (F_ISSET(ds, WT_DEBUG_TREE_LEAF)) WT_ERR(__debug_page_col_var(ds, ref)); break; case WT_PAGE_ROW_INT: - WT_WITH_PAGE_INDEX(session, ret = __debug_page_row_int(ds, ref->page, flags)); + WT_WITH_PAGE_INDEX(session, ret = __debug_page_row_int(ds, ref->page)); WT_ERR(ret); break; case WT_PAGE_ROW_LEAF: - if (LF_ISSET(WT_DEBUG_TREE_LEAF)) + if (F_ISSET(ds, WT_DEBUG_TREE_LEAF)) WT_ERR(__debug_page_row_leaf(ds, ref->page)); break; default: @@ -1256,9 +1286,12 @@ __debug_page_col_fix(WT_DBG *ds, WT_REF *ref) numtws = WT_COL_FIX_TWS_SET(page) ? page->pg_fix_numtws : 0; WT_COL_FIX_FOREACH_BITS (btree, dsk, v, i) { - WT_RET(ds->f(ds, "\t%" PRIu64 "\t{", recno)); - WT_RET(__debug_hex_byte(ds, v)); - WT_RET(ds->f(ds, "}")); + if (F_ISSET(ds, WT_DEBUG_UNREDACT)) { + WT_RET(ds->f(ds, "\t%" PRIu64 "\t{", recno)); + WT_RET(__debug_hex_byte(ds, v)); + WT_RET(ds->f(ds, "}")); + } else + WT_RET(ds->f(ds, "\t%" PRIu64 "\t{REDACTED}", recno)); if (curtw < numtws && recno - ref->ref_recno == page->pg_fix_tws[curtw].recno_offset) { cell = WT_COL_FIX_TW_CELL(page, &page->pg_fix_tws[curtw]); __wt_cell_unpack_kv(ds->session, page->dsk, cell, &unpack); @@ -1270,7 +1303,10 @@ __debug_page_col_fix(WT_DBG *ds, WT_REF *ref) /* Check for a match on the update list. */ if (ins != NULL && WT_INSERT_RECNO(ins) == recno) { - WT_RET(ds->f(ds, "\tupdate %" PRIu64 "\n", WT_INSERT_RECNO(ins))); + if (F_ISSET(ds, WT_DEBUG_UNREDACT)) + WT_RET(ds->f(ds, "\tupdate %" PRIu64 "\n", WT_INSERT_RECNO(ins))); + else + WT_RET(ds->f(ds, "\tupdate {REDACTED}\n")); WT_RET(__debug_update(ds, ins->upd, true)); ins = WT_SKIP_NEXT(ins); } @@ -1294,7 +1330,7 @@ __debug_page_col_fix(WT_DBG *ds, WT_REF *ref) * Dump an in-memory WT_PAGE_COL_INT page. */ static int -__debug_page_col_int(WT_DBG *ds, WT_PAGE *page, uint32_t flags) +__debug_page_col_int(WT_DBG *ds, WT_PAGE *page) { WT_REF *ref; WT_SESSION_IMPL *session; @@ -1307,11 +1343,11 @@ __debug_page_col_int(WT_DBG *ds, WT_PAGE *page, uint32_t flags) } WT_INTL_FOREACH_END; - if (LF_ISSET(WT_DEBUG_TREE_WALK)) { + if (F_ISSET(ds, WT_DEBUG_TREE_WALK)) { WT_INTL_FOREACH_BEGIN (session, page, ref) { if (ref->state == WT_REF_MEM) { WT_RET(ds->f(ds, "\n")); - WT_RET(__debug_page(ds, ref, flags)); + WT_RET(__debug_page(ds, ref)); } } WT_INTL_FOREACH_END; @@ -1374,7 +1410,7 @@ __debug_page_col_var(WT_DBG *ds, WT_REF *ref) * Dump an in-memory WT_PAGE_ROW_INT page. */ static int -__debug_page_row_int(WT_DBG *ds, WT_PAGE *page, uint32_t flags) +__debug_page_row_int(WT_DBG *ds, WT_PAGE *page) { WT_REF *ref; WT_SESSION_IMPL *session; @@ -1390,11 +1426,11 @@ __debug_page_row_int(WT_DBG *ds, WT_PAGE *page, uint32_t flags) } WT_INTL_FOREACH_END; - if (LF_ISSET(WT_DEBUG_TREE_WALK)) { + if (F_ISSET(ds, WT_DEBUG_TREE_WALK)) { WT_INTL_FOREACH_BEGIN (session, page, ref) { if (ref->state == WT_REF_MEM) { WT_RET(ds->f(ds, "\n")); - WT_RET(__debug_page(ds, ref, flags)); + WT_RET(__debug_page(ds, ref)); } } WT_INTL_FOREACH_END; @@ -1460,7 +1496,10 @@ __debug_col_skip( session = ds->session; WT_SKIP_FOREACH (ins, head) { - WT_RET(ds->f(ds, "\t%s %" PRIu64 "\n", tag, WT_INSERT_RECNO(ins))); + if (F_ISSET(ds, WT_DEBUG_UNREDACT)) + WT_RET(ds->f(ds, "\t%s %" PRIu64 "\n", tag, WT_INSERT_RECNO(ins))); + else + WT_RET(ds->f(ds, "\t%s {REDACTED}\n", tag)); WT_RET(__debug_update(ds, ins->upd, hexbyte)); if (!WT_IS_HS(session->dhandle) && hs_cursor != NULL) { @@ -1541,20 +1580,23 @@ __debug_update(WT_DBG *ds, WT_UPDATE *upd, bool hexbyte) WT_RET(ds->f(ds, "\tvalue {invalid}\n")); break; case WT_UPDATE_MODIFY: - WT_RET(ds->f(ds, "\tvalue {modify: ")); - WT_RET(__debug_modify(ds, upd->data)); - WT_RET(ds->f(ds, "}\n")); + if (F_ISSET(ds, WT_DEBUG_UNREDACT)) { + WT_RET(ds->f(ds, "\tvalue {modify: ")); + WT_RET(__debug_modify(ds, upd->data)); + WT_RET(ds->f(ds, "}\n")); + } else + WT_RET(ds->f(ds, "\tvalue {modify REDACTED}\n")); break; case WT_UPDATE_RESERVE: WT_RET(ds->f(ds, "\tvalue {reserve}\n")); break; case WT_UPDATE_STANDARD: - if (hexbyte) { + if (hexbyte && F_ISSET(ds, WT_DEBUG_UNREDACT)) { WT_RET(ds->f(ds, "\t{")); WT_RET(__debug_hex_byte(ds, *upd->data)); WT_RET(ds->f(ds, "}\n")); } else - WT_RET(__debug_item_value(ds, "value", upd->data, upd->size)); + WT_RET(__debug_item_value(ds, "\tvalue", upd->data, upd->size)); break; case WT_UPDATE_TOMBSTONE: WT_RET(ds->f(ds, "\tvalue {tombstone}\n")); diff --git a/src/third_party/wiredtiger/src/btree/bt_vrfy.c b/src/third_party/wiredtiger/src/btree/bt_vrfy.c index d5e3438e413..dae4af3e1f5 100644 --- a/src/third_party/wiredtiger/src/btree/bt_vrfy.c +++ b/src/third_party/wiredtiger/src/btree/bt_vrfy.c @@ -26,6 +26,7 @@ typedef struct { #define WT_VRFY_DUMP(vs) \ ((vs)->dump_address || (vs)->dump_blocks || (vs)->dump_layout || (vs)->dump_pages) bool dump_address; /* Configure: dump special */ + bool dump_app_data; bool dump_blocks; bool dump_layout; bool dump_pages; @@ -72,6 +73,9 @@ __verify_config(WT_SESSION_IMPL *session, const char *cfg[], WT_VSTUFF *vs) WT_RET(__wt_config_gets(session, cfg, "dump_address", &cval)); vs->dump_address = cval.val != 0; + WT_RET(__wt_config_gets(session, cfg, "dump_app_data", &cval)); + vs->dump_app_data = cval.val != 0; + WT_RET(__wt_config_gets(session, cfg, "dump_blocks", &cval)); vs->dump_blocks = cval.val != 0; @@ -445,9 +449,9 @@ __verify_tree( #ifdef HAVE_DIAGNOSTIC /* Optionally dump the blocks or page in debugging mode. */ if (vs->dump_blocks) - WT_RET(__wt_debug_disk(session, page->dsk, NULL)); + WT_RET(__wt_debug_disk(session, page->dsk, NULL, vs->dump_app_data)); if (vs->dump_pages) - WT_RET(__wt_debug_page(session, NULL, ref, NULL)); + WT_RET(__wt_debug_page(session, NULL, ref, NULL, vs->dump_app_data)); #endif /* Make sure the page we got belongs in this kind of tree. */ diff --git a/src/third_party/wiredtiger/src/config/config_def.c b/src/third_party/wiredtiger/src/config/config_def.c index 85cbe50436c..342b5d17482 100644 --- a/src/third_party/wiredtiger/src/config/config_def.c +++ b/src/third_party/wiredtiger/src/config/config_def.c @@ -447,9 +447,11 @@ static const WT_CONFIG_CHECK confchk_WT_SESSION_timestamp_transaction[] = { static const WT_CONFIG_CHECK confchk_WT_SESSION_verify[] = { {"do_not_clear_txn_id", "boolean", NULL, NULL, NULL, 0}, - {"dump_address", "boolean", NULL, NULL, NULL, 0}, {"dump_blocks", "boolean", NULL, NULL, NULL, 0}, - {"dump_layout", "boolean", NULL, NULL, NULL, 0}, {"dump_offsets", "list", NULL, NULL, NULL, 0}, - {"dump_pages", "boolean", NULL, NULL, NULL, 0}, {"read_corrupt", "boolean", NULL, NULL, NULL, 0}, + {"dump_address", "boolean", NULL, NULL, NULL, 0}, + {"dump_app_data", "boolean", NULL, NULL, NULL, 0}, + {"dump_blocks", "boolean", NULL, NULL, NULL, 0}, {"dump_layout", "boolean", NULL, NULL, NULL, 0}, + {"dump_offsets", "list", NULL, NULL, NULL, 0}, {"dump_pages", "boolean", NULL, NULL, NULL, 0}, + {"read_corrupt", "boolean", NULL, NULL, NULL, 0}, {"stable_timestamp", "boolean", NULL, NULL, NULL, 0}, {"strict", "boolean", NULL, NULL, NULL, 0}, {NULL, NULL, NULL, NULL, NULL, 0}}; @@ -1332,10 +1334,11 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator", {"WT_SESSION.timestamp_transaction_uint", "", NULL, 0}, {"WT_SESSION.truncate", "", NULL, 0}, {"WT_SESSION.upgrade", "", NULL, 0}, {"WT_SESSION.verify", - "do_not_clear_txn_id=false,dump_address=false,dump_blocks=false," - "dump_layout=false,dump_offsets=,dump_pages=false," - "read_corrupt=false,stable_timestamp=false,strict=false", - confchk_WT_SESSION_verify, 9}, + "do_not_clear_txn_id=false,dump_address=false,dump_app_data=false" + ",dump_blocks=false,dump_layout=false,dump_offsets=," + "dump_pages=false,read_corrupt=false,stable_timestamp=false," + "strict=false", + confchk_WT_SESSION_verify, 10}, {"colgroup.meta", "app_metadata=,assert=(commit_timestamp=none," "durable_timestamp=none,read_timestamp=none,write_timestamp=off)," diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index 6d466ba2ca3..f1a56163345 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -646,16 +646,16 @@ extern int __wt_debug_cursor_page(void *cursor_arg, const char *ofile) WT_GCC_FU extern int __wt_debug_cursor_tree_hs(void *cursor_arg, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("default"))) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_debug_disk(WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, const char *ofile) - WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_debug_disk(WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, const char *ofile, + bool dump_app_data) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_mode_config(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_offset(WT_SESSION_IMPL *session, wt_off_t offset, uint32_t size, uint32_t checksum, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_offset_blind(WT_SESSION_IMPL *session, wt_off_t offset, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_debug_page(void *session_arg, WT_BTREE *btree, WT_REF *ref, const char *ofile) - WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_debug_page(void *session_arg, WT_BTREE *btree, WT_REF *ref, const char *ofile, + bool dump_app_data) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_set_verbose(WT_SESSION_IMPL *session, const char *v) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_debug_tree(void *session_arg, WT_BTREE *btree, WT_REF *ref, const char *ofile) diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in index f555db61287..7c78ac392c4 100644 --- a/src/third_party/wiredtiger/src/include/wiredtiger.in +++ b/src/third_party/wiredtiger/src/include/wiredtiger.in @@ -1675,6 +1675,9 @@ struct __wt_session { * @config{dump_address, Display page addresses\, time windows\, and page types as pages are * verified\, using the application's message handler\, intended for debugging., a boolean * flag; default \c false.} + * @config{dump_app_data, Display application data as pages or blocks are verified\, using + * the application's message handler\, intended for debugging. Disabling this does not + * guarantee that no user data will be output., a boolean flag; default \c false.} * @config{dump_blocks, Display the contents of on-disk blocks as they are verified\, using * the application's message handler\, intended for debugging., a boolean flag; default \c * false.} diff --git a/src/third_party/wiredtiger/src/utilities/util_verify.c b/src/third_party/wiredtiger/src/utilities/util_verify.c index 1f619e4f94f..aa2176f1f6e 100644 --- a/src/third_party/wiredtiger/src/utilities/util_verify.c +++ b/src/third_party/wiredtiger/src/utilities/util_verify.c @@ -19,12 +19,13 @@ usage(void) "display underlying information during verification", "-c", "continue to the next page after encountering error during verification", "-s", "verify against the specified timestamp", "-t", "do not clear txn ids during verification", + "-u", + "display the application data when dumping with configuration dump_blocks or dump_pages", NULL, NULL}; util_usage( - "verify [-s] [-t] [-c] [-d dump_address | dump_blocks | dump_layout | dump_offsets=#,# | " - "dump_pages] " - "[uri]", + "verify [-s] [-t] [-c] [-u] [-d dump_address | dump_blocks | dump_layout | dump_offsets=#,# " + "| dump_pages] [uri]", "options:", options); return (1); @@ -41,13 +42,13 @@ util_verify(WT_SESSION *session, int argc, char *argv[]) size_t size; int ch; char *config, *dump_offsets, *uri; - bool do_not_clear_txn_id, dump_address, dump_blocks, dump_layout, dump_pages, read_corrupt, - stable_timestamp; + bool do_not_clear_txn_id, dump_address, dump_app_data, dump_blocks, dump_layout, dump_pages, + read_corrupt, stable_timestamp; - do_not_clear_txn_id = dump_address = dump_blocks = dump_layout = dump_pages = read_corrupt = - stable_timestamp = false; + do_not_clear_txn_id = dump_address = dump_app_data = dump_blocks = dump_layout = dump_pages = + read_corrupt = stable_timestamp = false; config = dump_offsets = uri = NULL; - while ((ch = __wt_getopt(progname, argc, argv, "cd:st")) != EOF) + while ((ch = __wt_getopt(progname, argc, argv, "cd:stu")) != EOF) switch (ch) { case 'c': read_corrupt = true; @@ -74,6 +75,9 @@ util_verify(WT_SESSION *session, int argc, char *argv[]) case 's': stable_timestamp = true; break; + case 'u': + dump_app_data = true; + break; case 't': do_not_clear_txn_id = true; break; @@ -93,24 +97,25 @@ util_verify(WT_SESSION *session, int argc, char *argv[]) if ((uri = util_uri(session, *argv, "table")) == NULL) return (1); - if (do_not_clear_txn_id || read_corrupt || dump_address || dump_blocks || dump_layout || - dump_offsets != NULL || dump_pages || stable_timestamp) { - size = strlen("do_not_clear_txn_id,") + strlen("read_corrupt,") + strlen("dump_address,") + - strlen("dump_blocks,") + strlen("dump_layout,") + strlen("dump_pages,") + - strlen("dump_offsets[],") + (dump_offsets == NULL ? 0 : strlen(dump_offsets)) + - strlen("history_store") + strlen("stable_timestamp,") + 20; + if (do_not_clear_txn_id || dump_address || dump_app_data || dump_blocks || dump_layout || + dump_offsets != NULL || dump_pages || read_corrupt || stable_timestamp) { + size = strlen("do_not_clear_txn_id,") + strlen("dump_address,") + + +strlen("dump_app_data,") + strlen("dump_blocks,") + strlen("dump_layout,") + + strlen("dump_pages,") + strlen("dump_offsets[],") + + (dump_offsets == NULL ? 0 : strlen(dump_offsets)) + strlen("history_store") + + +strlen("read_corrupt,") + strlen("stable_timestamp,") + 20; if ((config = malloc(size)) == NULL) { ret = util_err(session, errno, NULL); goto err; } - if ((ret = __wt_snprintf(config, size, "%s%s%s%s%s%s%s%s%s%s", + if ((ret = __wt_snprintf(config, size, "%s%s%s%s%s%s%s%s%s%s%s", do_not_clear_txn_id ? "do_not_clear_txn_id," : "", - read_corrupt ? "read_corrupt," : "", dump_address ? "dump_address," : "", + dump_address ? "dump_address," : "", dump_app_data ? "dump_app_data," : "", dump_blocks ? "dump_blocks," : "", dump_layout ? "dump_layout," : "", dump_offsets != NULL ? "dump_offsets=[" : "", dump_offsets != NULL ? dump_offsets : "", dump_offsets != NULL ? "]," : "", - dump_pages ? "dump_pages," : "", stable_timestamp ? "stable_timestamp," : "")) != - 0) { + dump_pages ? "dump_pages," : "", read_corrupt ? "read_corrupt," : "", + stable_timestamp ? "stable_timestamp," : "")) != 0) { (void)util_err(session, ret, NULL); goto err; } |