From 1e91ea65e3831eb1b9d6c92dadc076b2f0038c23 Mon Sep 17 00:00:00 2001 From: Alison Felizzi Date: Thu, 23 Dec 2021 04:36:17 +0000 Subject: Import wiredtiger: c5db3e1d6752826db91c41026bd4eed3c04e32a0 from branch mongodb-master ref: 22d1d1ebe7..c5db3e1d67 for: 5.3.0 WT-8591 WT_READ_DELETED_SKIP and WT_READ_DELETED_CHECK cleanup --- src/third_party/wiredtiger/import.data | 2 +- src/third_party/wiredtiger/src/btree/bt_read.c | 9 ++------ src/third_party/wiredtiger/src/btree/bt_sync.c | 9 -------- src/third_party/wiredtiger/src/btree/bt_walk.c | 29 ++++++++------------------ src/third_party/wiredtiger/src/include/btmem.h | 25 +++++++++++----------- 5 files changed, 24 insertions(+), 50 deletions(-) diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 2b0ed9ddf38..f5d46ea36c5 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": "22d1d1ebe7f449d8971874968c5384d35683f9fd" + "commit": "c5db3e1d6752826db91c41026bd4eed3c04e32a0" } diff --git a/src/third_party/wiredtiger/src/btree/bt_read.c b/src/third_party/wiredtiger/src/btree/bt_read.c index 56a5ece6946..b7126eaf218 100644 --- a/src/third_party/wiredtiger/src/btree/bt_read.c +++ b/src/third_party/wiredtiger/src/btree/bt_read.c @@ -207,11 +207,6 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags if (F_ISSET(session, WT_SESSION_IGNORE_CACHE_SIZE)) LF_SET(WT_READ_IGNORE_CACHE_SIZE); - /* Sanity check flag combinations. */ - WT_ASSERT(session, - !LF_ISSET(WT_READ_DELETED_SKIP) || !LF_ISSET(WT_READ_NO_WAIT) || LF_ISSET(WT_READ_CACHE)); - WT_ASSERT(session, !LF_ISSET(WT_READ_DELETED_CHECK) || !LF_ISSET(WT_READ_DELETED_SKIP)); - /* * Ignore reads of pages already known to be in cache, otherwise the eviction server can * dominate these statistics. @@ -223,9 +218,9 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags ;) { switch (current_state = ref->state) { case WT_REF_DELETED: - if (LF_ISSET(WT_READ_DELETED_SKIP | WT_READ_NO_WAIT)) + if (LF_ISSET(WT_READ_NO_WAIT)) return (WT_NOTFOUND); - if (LF_ISSET(WT_READ_DELETED_CHECK) && + if (LF_ISSET(WT_READ_SKIP_DELETED) && __wt_delete_page_skip(session, ref, !F_ISSET(session->txn, WT_TXN_HAS_SNAPSHOT))) return (WT_NOTFOUND); goto read; diff --git a/src/third_party/wiredtiger/src/btree/bt_sync.c b/src/third_party/wiredtiger/src/btree/bt_sync.c index b1ba29793ea..df8dab28f4a 100644 --- a/src/third_party/wiredtiger/src/btree/bt_sync.c +++ b/src/third_party/wiredtiger/src/btree/bt_sync.c @@ -450,15 +450,6 @@ __wt_sync_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop) /* Don't bump page read generations. */ flags = WT_READ_NO_GEN; - /* - * Skip all deleted pages. For a page to be marked deleted, it must have been evicted from cache - * and marked clean. Checkpoint should never instantiate deleted pages: if a truncate is not - * visible to the checkpoint, the on-disk version is correct. If the truncate is visible to - * checkpoint, we write a proxy cell to its parent. We check whether a truncate is visible in - * the checkpoint as part of reconciling internal pages (specifically in __rec_child_deleted). - */ - LF_SET(WT_READ_DELETED_SKIP); - internal_bytes = leaf_bytes = 0; internal_pages = leaf_pages = 0; saved_pinned_id = WT_SESSION_TXN_SHARED(session)->pinned_id; diff --git a/src/third_party/wiredtiger/src/btree/bt_walk.c b/src/third_party/wiredtiger/src/btree/bt_walk.c index 233cc2a2514..5edecbb967e 100644 --- a/src/third_party/wiredtiger/src/btree/bt_walk.c +++ b/src/third_party/wiredtiger/src/btree/bt_walk.c @@ -254,15 +254,8 @@ __tree_walk_internal(WT_SESSION_IMPL *session, WT_REF **refp, uint64_t *walkcntp restart_sleep = restart_yield = 0; empty_internal = false; - /* - * We're not supposed to walk trees without root pages. As this has not always been the case, - * assert to debug that change. - */ - WT_ASSERT(session, btree->root.page != NULL); - - /* Check whether deleted pages can be skipped. */ - if (!LF_ISSET(WT_READ_DELETED_SKIP)) - LF_SET(WT_READ_DELETED_CHECK); + /* All current tree walks skip deleted pages. */ + LF_SET(WT_READ_SKIP_DELETED); /* * !!! @@ -426,18 +419,20 @@ descend: if (LF_ISSET(WT_READ_CACHE)) { /* - * Only look at unlocked pages in memory: fast-path some common cases. + * Only look at unlocked pages in memory. */ if (LF_ISSET(WT_READ_NO_WAIT) && current_state != WT_REF_MEM) break; - } else if (LF_ISSET(WT_READ_TRUNCATE)) { + } else if (current_state == WT_REF_DELETED) { /* - * Avoid pulling a deleted page back in to try to delete it again. + * Try to skip deleted pages visible to us. */ - if (current_state == WT_REF_DELETED && __wt_delete_page_skip(session, ref, false)) + if (__wt_delete_page_skip(session, ref, false)) break; + } else if (LF_ISSET(WT_READ_TRUNCATE)) { /* - * If deleting a range, try to delete the page without instantiating it. + * If deleting a range, try to delete the page without instantiating it. (Note this + * test follows the check to skip the page entirely if it's already deleted.) */ WT_ERR(__wt_delete_page(session, ref, &skip)); if (skip) @@ -447,12 +442,6 @@ descend: WT_ERR(skip_func(session, ref, func_cookie, &skip)); if (skip) break; - } else { - /* - * Try to skip deleted pages visible to us. - */ - if (current_state == WT_REF_DELETED && __wt_delete_page_skip(session, ref, false)) - break; } ret = __wt_page_swap( diff --git a/src/third_party/wiredtiger/src/include/btmem.h b/src/third_party/wiredtiger/src/include/btmem.h index 2bcdc46f2bb..6f389a3128b 100644 --- a/src/third_party/wiredtiger/src/include/btmem.h +++ b/src/third_party/wiredtiger/src/include/btmem.h @@ -9,19 +9,18 @@ #define WT_RECNO_OOB 0 /* Illegal record number */ /* AUTOMATIC FLAG VALUE GENERATION START 0 */ -#define WT_READ_CACHE 0x0001u -#define WT_READ_DELETED_CHECK 0x0002u -#define WT_READ_DELETED_SKIP 0x0004u -#define WT_READ_IGNORE_CACHE_SIZE 0x0008u -#define WT_READ_NOTFOUND_OK 0x0010u -#define WT_READ_NO_GEN 0x0020u -#define WT_READ_NO_SPLIT 0x0040u -#define WT_READ_NO_WAIT 0x0080u -#define WT_READ_PREV 0x0100u -#define WT_READ_RESTART_OK 0x0200u -#define WT_READ_SKIP_INTL 0x0400u -#define WT_READ_TRUNCATE 0x0800u -#define WT_READ_WONT_NEED 0x1000u +#define WT_READ_CACHE 0x001u +#define WT_READ_IGNORE_CACHE_SIZE 0x002u +#define WT_READ_NOTFOUND_OK 0x004u +#define WT_READ_NO_GEN 0x008u +#define WT_READ_NO_SPLIT 0x010u +#define WT_READ_NO_WAIT 0x020u +#define WT_READ_PREV 0x040u +#define WT_READ_RESTART_OK 0x080u +#define WT_READ_SKIP_DELETED 0x100u +#define WT_READ_SKIP_INTL 0x200u +#define WT_READ_TRUNCATE 0x400u +#define WT_READ_WONT_NEED 0x800u /* AUTOMATIC FLAG VALUE GENERATION STOP 32 */ /* AUTOMATIC FLAG VALUE GENERATION START 0 */ -- cgit v1.2.1