diff options
author | Alison Felizzi <alison.felizzi@mongodb.com> | 2021-12-16 04:45:56 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-12-16 05:10:26 +0000 |
commit | c3a0c1fd88a26d52b17b8895a90fade3a2bc2174 (patch) | |
tree | f343c1456a2a88ae762c8a61bf9ce66b9efff1b2 /src/third_party/wiredtiger/src | |
parent | 393c6215bc514df03f8e8c4dbb97d4f98e50b9dc (diff) | |
download | mongo-c3a0c1fd88a26d52b17b8895a90fade3a2bc2174.tar.gz |
Import wiredtiger: 7d2c1389a470ccc0db0f61a703191a6f7fab3f97 from branch mongodb-master
ref: fd75a4e752..7d2c1389a4
for: 5.3.0
WT-8572 Remove unused history store verification code
Diffstat (limited to 'src/third_party/wiredtiger/src')
-rw-r--r-- | src/third_party/wiredtiger/src/btree/bt_vrfy.c | 36 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/conn/conn_api.c | 20 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/history/hs_verify.c | 200 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/btree.h | 5 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/extern.h | 6 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/meta/meta_table.c | 33 |
6 files changed, 0 insertions, 300 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_vrfy.c b/src/third_party/wiredtiger/src/btree/bt_vrfy.c index a64239a1d2b..20ac38c41f8 100644 --- a/src/third_party/wiredtiger/src/btree/bt_vrfy.c +++ b/src/third_party/wiredtiger/src/btree/bt_vrfy.c @@ -172,28 +172,12 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]) const char *name; bool bm_start, quit; -#if 0 - /* FIXME-WT-6682: temporarily disable history store verification. */ - bool skip_hs; -#endif - btree = S2BT(session); bm = btree->bm; ckptbase = NULL; name = session->dhandle->name; bm_start = false; -#if 0 - /* - * FIXME-WT-6682: temporarily disable history store verification. - * - * Skip the history store explicit call if we're performing a metadata verification. The - * metadata file is verified before we verify the history store, and it makes no sense to verify - * the history store against itself. - */ - skip_hs = strcmp(name, WT_METAFILE_URI) == 0 || strcmp(name, WT_HS_URI) == 0; -#endif - WT_CLEAR(_vstuff); vs = &_vstuff; WT_ERR(__wt_scr_alloc(session, 0, &vs->max_key)); @@ -269,26 +253,6 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]) WT_WITH_PAGE_INDEX( session, ret = __verify_tree(session, &btree->root, &addr_unpack, vs)); -#if 0 - /* - * FIXME-WT-6682: temporarily disable history store verification. - * - * The checkpoints are in time-order, so the last one in the list is the most recent. If - * this is the most recent checkpoint, verify the history store against it. - * - * FIXME-WT-6263: Temporarily disable history store verification. - */ - if (ret == 0 && (ckpt + 1)->name == NULL && !skip_hs) { - /* Open a history store cursor. */ - WT_TRET(__wt_hs_verify_one(session)); - /* - * We cannot error out here. If we got an error verifying the history store, we need - * to follow through with reacquiring the exclusive call below. We'll error out - * after that and unloading this checkpoint. - */ - } -#endif - /* * 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 diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c index 62359ba4b13..514da3229f6 100644 --- a/src/third_party/wiredtiger/src/conn/conn_api.c +++ b/src/third_party/wiredtiger/src/conn/conn_api.c @@ -2564,11 +2564,6 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, const char *c const char *enc_cfg[] = {NULL, NULL}, *merge_cfg; char version[64]; -#if 0 - /* FIXME-WT-6263: Temporarily disable history store verification. */ - WT_SESSION_IMPL *verify_session; -#endif - /* Leave lots of space for optional additional configuration. */ const char *cfg[] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; @@ -2988,21 +2983,6 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, const char *c /* Start the worker threads and run recovery. */ WT_ERR(__wt_connection_workers(session, cfg)); -#if 0 - /* - * If the user wants to verify WiredTiger metadata, verify the history store now that the - * metadata table may have been salvaged and eviction has been started and recovery run. - * - * FIXME-WT-6682: temporarily disable history store verification. - */ - if (verify_meta) { - WT_ERR(__wt_open_internal_session(conn, "verify hs", false, 0, 0, &verify_session)); - ret = __wt_hs_verify(verify_session); - WT_TRET(__wt_session_close_internal(verify_session)); - WT_ERR(ret); - } -#endif - /* * The hash array sizes needed to be set up very early. Set them in the statistics here. Setting * them in the early configuration function makes them get zeroed out. diff --git a/src/third_party/wiredtiger/src/history/hs_verify.c b/src/third_party/wiredtiger/src/history/hs_verify.c deleted file mode 100644 index 1d9c78800a8..00000000000 --- a/src/third_party/wiredtiger/src/history/hs_verify.c +++ /dev/null @@ -1,200 +0,0 @@ -/*- - * Copyright (c) 2014-present MongoDB, Inc. - * Copyright (c) 2008-2014 WiredTiger, Inc. - * All rights reserved. - * - * See the file LICENSE for redistribution information. - */ - -#include "wt_internal.h" - -/* - * __hs_verify_id -- - * Verify the history store for a single btree. Given a cursor to the tree, walk all history - * store keys. This function assumes any caller has already opened a cursor to the history - * store. - */ -static int -__hs_verify_id( - WT_SESSION_IMPL *session, WT_CURSOR *hs_cursor, WT_CURSOR_BTREE *ds_cbt, uint32_t this_btree_id) -{ - WT_DECL_ITEM(prev_key); - WT_DECL_RET; - WT_ITEM key; - wt_timestamp_t hs_start_ts; - uint64_t hs_counter; - uint32_t btree_id; - int cmp; - - WT_CLEAR(key); - - WT_ERR(__wt_scr_alloc(session, 0, &prev_key)); - -#ifndef HAVE_DIAGNOSTIC - WT_UNUSED(this_btree_id); -#endif - - /* - * If using standard cursors, we need to skip the non-globally visible tombstones in the data - * table to verify the corresponding entries in the history store are too present in the data - * store. Though this is not required currently as we are directly searching btree cursors, - * leave it here in case we switch to standard cursors. - */ - F_SET(&ds_cbt->iface, WT_CURSTD_IGNORE_TOMBSTONE); - - /* - * The caller is responsible for positioning the history store cursor at the first record to - * verify. When we return after moving to a new key the caller is responsible for keeping the - * cursor there or deciding they're done. - */ - for (; ret == 0; ret = hs_cursor->next(hs_cursor)) { - /* - * If the btree id does not match the preview one, we're done. It is up to the caller to set - * up for the next tree and call us, if they choose. For a full history store walk, the - * caller sends in WT_BTREE_ID_INVALID and this function will set and use the first btree id - * it finds and will return once it walks off that tree, leaving the cursor set to the first - * key of that new tree. - * - * We should never cross the btree id, assert if we do so. - */ - WT_ERR(hs_cursor->get_key(hs_cursor, &btree_id, &key, &hs_start_ts, &hs_counter)); - WT_ASSERT(session, btree_id == this_btree_id); - - /* - * If we have already checked against this key, keep going to the next key. We only need to - * check the key once. - */ - WT_ERR(__wt_compare(session, NULL, &key, prev_key, &cmp)); - if (cmp == 0) - continue; - - WT_WITH_PAGE_INDEX(session, ret = __wt_row_search(ds_cbt, &key, false, NULL, false, NULL)); - WT_ERR(ret); - - if (ds_cbt->compare != 0) { - F_SET(S2C(session), WT_CONN_DATA_CORRUPTION); - WT_ERR_PANIC(session, WT_PANIC, - "the associated history store key %s was not found in the data store %s", - __wt_buf_set_printable(session, key.data, key.size, false, prev_key), - session->dhandle->name); - } - - WT_ERR(__cursor_reset(ds_cbt)); - - /* - * Copy the key memory into our scratch buffer. The key will get invalidated on our next - * cursor iteration. - */ - WT_ERR(__wt_buf_set(session, prev_key, key.data, key.size)); - } - WT_ERR_NOTFOUND_OK(ret, true); -err: - F_CLR(&ds_cbt->iface, WT_CURSTD_IGNORE_TOMBSTONE); - WT_ASSERT(session, key.mem == NULL && key.memsize == 0); - __wt_scr_free(session, &prev_key); - return (ret); -} - -/* - * __wt_hs_verify_one -- - * Verify the history store for the btree that is set up in this session. This must be called - * when we are known to have exclusive access to the btree. - */ -int -__wt_hs_verify_one(WT_SESSION_IMPL *session) -{ - WT_CURSOR *hs_cursor; - WT_CURSOR_BTREE ds_cbt; - WT_DECL_RET; - uint32_t btree_id; - - WT_RET(__wt_curhs_open(session, NULL, &hs_cursor)); - F_SET(hs_cursor, WT_CURSTD_HS_READ_COMMITTED); - btree_id = S2BT(session)->id; - - hs_cursor->set_key(hs_cursor, 1, btree_id); - WT_ERR(__wt_curhs_search_near_after(session, hs_cursor)); - - /* - * If we positioned the cursor there is something to verify. - * - * We are in verify and we are not able to open a standard cursor because the btree is flagged - * as WT_BTREE_VERIFY. However, we have exclusive access to the btree so we can directly open - * the btree cursor to work around it. - */ - if (ret == 0) { - __wt_btcur_init(session, &ds_cbt); - __wt_btcur_open(&ds_cbt); - ret = __hs_verify_id(session, hs_cursor, &ds_cbt, btree_id); - WT_TRET(__wt_btcur_close(&ds_cbt, false)); - } - -err: - WT_TRET(hs_cursor->close(hs_cursor)); - return (ret == WT_NOTFOUND ? 0 : ret); -} - -/* - * __wt_hs_verify -- - * Verify the history store. There can't be an entry in the history store without having the - * latest value for the respective key in the data store. - */ -int -__wt_hs_verify(WT_SESSION_IMPL *session) -{ - WT_CURSOR *ds_cursor, *hs_cursor; - WT_DECL_ITEM(buf); - WT_DECL_RET; - WT_ITEM key; - wt_timestamp_t hs_start_ts; - uint64_t hs_counter; - uint32_t btree_id; - char *uri_data; - bool stop; - - /* We should never reach here if working in context of the default session. */ - WT_ASSERT(session, S2C(session)->default_session != session); - - ds_cursor = hs_cursor = NULL; - WT_CLEAR(key); - btree_id = WT_BTREE_ID_INVALID; - uri_data = NULL; - - WT_RET(__wt_curhs_open(session, NULL, &hs_cursor)); - F_SET(hs_cursor, WT_CURSTD_HS_READ_COMMITTED); - WT_ERR(__wt_scr_alloc(session, 0, &buf)); - WT_ERR_NOTFOUND_OK(hs_cursor->next(hs_cursor), true); - stop = ret == WT_NOTFOUND ? true : false; - ret = 0; - - /* - * We have the history store cursor positioned at the first record that we want to verify. The - * internal function is expecting a btree cursor, so open and initialize that. - */ - while (!stop) { - /* - * The cursor is positioned either from above or left over from the internal call on the - * first key of a new btree id. - */ - WT_ERR(hs_cursor->get_key(hs_cursor, &btree_id, &key, &hs_start_ts, &hs_counter)); - if ((ret = __wt_metadata_btree_id_to_uri(session, btree_id, &uri_data)) != 0) { - F_SET(S2C(session), WT_CONN_DATA_CORRUPTION); - WT_ERR_PANIC(session, ret, - "Unable to find btree id %" PRIu32 " in the metadata file for the associated key %s", - btree_id, __wt_buf_set_printable(session, key.data, key.size, false, buf)); - } - WT_ERR(__wt_open_cursor(session, uri_data, NULL, NULL, &ds_cursor)); - F_SET(ds_cursor, WT_CURSOR_RAW_OK); - ret = __hs_verify_id(session, hs_cursor, (WT_CURSOR_BTREE *)ds_cursor, btree_id); - if (ret == WT_NOTFOUND) - stop = true; - WT_TRET(ds_cursor->close(ds_cursor)); - WT_ERR_NOTFOUND_OK(ret, false); - } -err: - __wt_scr_free(session, &buf); - WT_ASSERT(session, key.mem == NULL && key.memsize == 0); - __wt_free(session, uri_data); - WT_TRET(hs_cursor->close(hs_cursor)); - return (ret); -} diff --git a/src/third_party/wiredtiger/src/include/btree.h b/src/third_party/wiredtiger/src/include/btree.h index a20cbfc9046..139692be793 100644 --- a/src/third_party/wiredtiger/src/include/btree.h +++ b/src/third_party/wiredtiger/src/include/btree.h @@ -92,11 +92,6 @@ typedef enum { /* Start position for eviction walk */ } WT_EVICT_WALK_TYPE; /* - * An invalid btree file ID value. ID 0 is reserved for the metadata file. - */ -#define WT_BTREE_ID_INVALID UINT32_MAX - -/* * WT_BTREE -- * A btree handle. */ diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index e2d55072e25..341ad47c941 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -803,10 +803,6 @@ extern int __wt_hs_modify(WT_CURSOR_BTREE *hs_cbt, WT_UPDATE *hs_upd) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_hs_open(WT_SESSION_IMPL *session, const char **cfg) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_hs_verify(WT_SESSION_IMPL *session) - WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_hs_verify_one(WT_SESSION_IMPL *session) - WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_huffman_decode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, size_t from_len, WT_ITEM *to_buf) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_huffman_encode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, @@ -1108,8 +1104,6 @@ extern int __wt_meta_track_sub_off(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_track_update(WT_SESSION_IMPL *session, const char *key) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_metadata_btree_id_to_uri(WT_SESSION_IMPL *session, uint32_t btree_id, char **uri) - WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_metadata_correct_base_write_gen(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_metadata_cursor(WT_SESSION_IMPL *session, WT_CURSOR **cursorp) diff --git a/src/third_party/wiredtiger/src/meta/meta_table.c b/src/third_party/wiredtiger/src/meta/meta_table.c index b6367d29a68..9b437125c7f 100644 --- a/src/third_party/wiredtiger/src/meta/meta_table.c +++ b/src/third_party/wiredtiger/src/meta/meta_table.c @@ -335,36 +335,3 @@ err: __wt_free(session, *valuep); return (ret); } - -/* - * __wt_metadata_btree_id_to_uri -- - * Given a btree id, find the matching entry in the metadata and return a copy of the uri. The - * caller has to free the returned uri. - */ -int -__wt_metadata_btree_id_to_uri(WT_SESSION_IMPL *session, uint32_t btree_id, char **uri) -{ - WT_CONFIG_ITEM id; - WT_CURSOR *cursor; - WT_DECL_RET; - char *key, *value; - - *uri = NULL; - key = NULL; - - WT_RET(__wt_metadata_cursor(session, &cursor)); - while ((ret = cursor->next(cursor)) == 0) { - WT_ERR(cursor->get_value(cursor, &value)); - if ((ret = __wt_config_getones(session, value, "id", &id)) == 0 && btree_id == id.val) { - WT_ERR(cursor->get_key(cursor, &key)); - /* Return a copy as the uri. */ - WT_ERR(__wt_strdup(session, key, uri)); - break; - } - WT_ERR_NOTFOUND_OK(ret, false); - } - -err: - WT_TRET(__wt_metadata_cursor_release(session, &cursor)); - return (ret); -} |