From 5776e3cbf9e7afe86e6b29e22520ffb6766e95d4 Mon Sep 17 00:00:00 2001 From: Luke Chen Date: Thu, 8 Aug 2019 22:20:23 +1000 Subject: Import wiredtiger: 48bf8dae7cd96286d176f14feebb7250dcfe1430 from branch mongodb-4.0 ref: b61a3e2a88..48bf8dae7c for: 4.0.12 Revert "WT-4869 When eviction isn't keeping up, stop adding pages to cache. (#4699)" Revert "WT-4881 Soften the restrictions on reentering reconciliation. (#4724)" Revert "WT-4893 Fix a race between internal page child-page eviction checks and cursors in the tree(#4749)" --- src/third_party/wiredtiger/dist/s_define.list | 1 - src/third_party/wiredtiger/import.data | 2 +- src/third_party/wiredtiger/src/btree/bt_discard.c | 2 +- src/third_party/wiredtiger/src/btree/bt_read.c | 3 +- src/third_party/wiredtiger/src/evict/evict_lru.c | 52 ++++------- src/third_party/wiredtiger/src/evict/evict_page.c | 44 +-------- src/third_party/wiredtiger/src/include/btmem.h | 42 +++------ src/third_party/wiredtiger/src/include/cache.h | 17 ++-- src/third_party/wiredtiger/src/include/txn.i | 6 +- .../wiredtiger/src/reconcile/rec_write.c | 104 +++++---------------- src/third_party/wiredtiger/src/support/hazard.c | 4 - 11 files changed, 75 insertions(+), 202 deletions(-) diff --git a/src/third_party/wiredtiger/dist/s_define.list b/src/third_party/wiredtiger/dist/s_define.list index 89a44ecf70b..4ed32778cbb 100644 --- a/src/third_party/wiredtiger/dist/s_define.list +++ b/src/third_party/wiredtiger/dist/s_define.list @@ -46,7 +46,6 @@ WT_PACKED_STRUCT_END WT_PADDING_CHECK WT_PREPARE_INIT WT_READ_BARRIER -WT_REF_SAVE_STATE_MAX WT_REF_SIZE WT_SESSION_LOCKED_CHECKPOINT WT_SESSION_LOCKED_TABLE_READ diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index d7f8111c161..b47ef9367b2 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -1,5 +1,5 @@ { - "commit": "b61a3e2a88220f2c84073ff1cbc4d6883aa26c5b", + "commit": "48bf8dae7cd96286d176f14feebb7250dcfe1430", "github": "wiredtiger/wiredtiger.git", "vendor": "wiredtiger", "branch": "mongodb-4.0" diff --git a/src/third_party/wiredtiger/src/btree/bt_discard.c b/src/third_party/wiredtiger/src/btree/bt_discard.c index 4f584b087ff..e7ad4b9143a 100644 --- a/src/third_party/wiredtiger/src/btree/bt_discard.c +++ b/src/third_party/wiredtiger/src/btree/bt_discard.c @@ -289,7 +289,7 @@ __wt_free_ref( __wt_free(session, ref->page_del); } - __wt_overwrite_and_free_len(session, ref, WT_REF_CLEAR_SIZE); + __wt_overwrite_and_free(session, ref); } /* diff --git a/src/third_party/wiredtiger/src/btree/bt_read.c b/src/third_party/wiredtiger/src/btree/bt_read.c index 9a23a26ea56..87f47f20aeb 100644 --- a/src/third_party/wiredtiger/src/btree/bt_read.c +++ b/src/third_party/wiredtiger/src/btree/bt_read.c @@ -689,8 +689,7 @@ read: /* * we "acquire" it. */ wont_need = LF_ISSET(WT_READ_WONT_NEED) || - F_ISSET(session, WT_SESSION_READ_WONT_NEED) || - F_ISSET(S2C(session)->cache, WT_CACHE_EVICT_NOKEEP); + F_ISSET(session, WT_SESSION_READ_WONT_NEED); continue; case WT_REF_READING: if (LF_ISSET(WT_READ_CACHE)) diff --git a/src/third_party/wiredtiger/src/evict/evict_lru.c b/src/third_party/wiredtiger/src/evict/evict_lru.c index 8930ae19944..a7ba654c27e 100644 --- a/src/third_party/wiredtiger/src/evict/evict_lru.c +++ b/src/third_party/wiredtiger/src/evict/evict_lru.c @@ -578,7 +578,6 @@ __evict_update_work(WT_SESSION_IMPL *session) WT_CONNECTION_IMPL *conn; double dirty_target, dirty_trigger, target, trigger; uint64_t bytes_inuse, bytes_max, dirty_inuse; - uint32_t flags; conn = S2C(session); cache = conn->cache; @@ -588,16 +587,14 @@ __evict_update_work(WT_SESSION_IMPL *session) target = cache->eviction_target; trigger = cache->eviction_trigger; - /* Build up the new state. */ - flags = 0; + /* Clear previous state. */ + cache->flags = 0; - if (!F_ISSET(conn, WT_CONN_EVICTION_RUN)) { - cache->flags = 0; + if (!F_ISSET(conn, WT_CONN_EVICTION_RUN)) return (false); - } if (!__evict_queue_empty(cache->evict_urgent_queue, false)) - LF_SET(WT_CACHE_EVICT_URGENT); + F_SET(cache, WT_CACHE_EVICT_URGENT); if (F_ISSET(conn, WT_CONN_LOOKASIDE_OPEN)) { WT_ASSERT(session, @@ -616,38 +613,32 @@ __evict_update_work(WT_SESSION_IMPL *session) bytes_max = conn->cache_size + 1; bytes_inuse = __wt_cache_bytes_inuse(cache); if (__wt_eviction_clean_needed(session, NULL)) - LF_SET(WT_CACHE_EVICT_CLEAN | WT_CACHE_EVICT_CLEAN_HARD); + F_SET(cache, WT_CACHE_EVICT_CLEAN | WT_CACHE_EVICT_CLEAN_HARD); else if (bytes_inuse > (target * bytes_max) / 100) - LF_SET(WT_CACHE_EVICT_CLEAN); + F_SET(cache, WT_CACHE_EVICT_CLEAN); dirty_inuse = __wt_cache_dirty_leaf_inuse(cache); if (__wt_eviction_dirty_needed(session, NULL)) - LF_SET(WT_CACHE_EVICT_DIRTY | WT_CACHE_EVICT_DIRTY_HARD); + F_SET(cache, WT_CACHE_EVICT_DIRTY | WT_CACHE_EVICT_DIRTY_HARD); else if (dirty_inuse > (uint64_t)(dirty_target * bytes_max) / 100) - LF_SET(WT_CACHE_EVICT_DIRTY); + F_SET(cache, WT_CACHE_EVICT_DIRTY); /* * If application threads are blocked by the total volume of data in * cache, try dirty pages as well. */ if (__wt_cache_aggressive(session) && - LF_ISSET(WT_CACHE_EVICT_CLEAN_HARD)) - LF_SET(WT_CACHE_EVICT_DIRTY); - - /* When we stop looking for dirty pages, reduce the lookaside score. */ - if (!LF_ISSET(WT_CACHE_EVICT_DIRTY)) - __wt_cache_update_lookaside_score(session, 1, 0); + F_ISSET(cache, WT_CACHE_EVICT_CLEAN_HARD)) + F_SET(cache, WT_CACHE_EVICT_DIRTY); /* * Scrub dirty pages and keep them in cache if we are less than half * way to the clean or dirty trigger. */ - if (bytes_inuse < (uint64_t)((target + trigger) * bytes_max) / 200) { - if (dirty_inuse < (uint64_t) - ((dirty_target + dirty_trigger) * bytes_max) / 200) - LF_SET(WT_CACHE_EVICT_SCRUB); - } else - LF_SET(WT_CACHE_EVICT_NOKEEP); + if (bytes_inuse < (uint64_t)((target + trigger) * bytes_max) / 200 && + dirty_inuse < + (uint64_t)((dirty_target + dirty_trigger) * bytes_max) / 200) + F_SET(cache, WT_CACHE_EVICT_SCRUB); /* * Try lookaside evict when: @@ -660,23 +651,20 @@ __evict_update_work(WT_SESSION_IMPL *session) (__wt_cache_lookaside_score(cache) > 80 && dirty_inuse > (uint64_t)((dirty_target + dirty_trigger) * bytes_max) / 200)) - LF_SET(WT_CACHE_EVICT_LOOKASIDE); + F_SET(cache, WT_CACHE_EVICT_LOOKASIDE); /* * With an in-memory cache, we only do dirty eviction in order to scrub * pages. */ if (F_ISSET(conn, WT_CONN_IN_MEMORY)) { - if (LF_ISSET(WT_CACHE_EVICT_CLEAN)) - LF_SET(WT_CACHE_EVICT_DIRTY); - if (LF_ISSET(WT_CACHE_EVICT_CLEAN_HARD)) - LF_SET(WT_CACHE_EVICT_DIRTY_HARD); - LF_CLR(WT_CACHE_EVICT_CLEAN | WT_CACHE_EVICT_CLEAN_HARD); + if (F_ISSET(cache, WT_CACHE_EVICT_CLEAN)) + F_SET(cache, WT_CACHE_EVICT_DIRTY); + if (F_ISSET(cache, WT_CACHE_EVICT_CLEAN_HARD)) + F_SET(cache, WT_CACHE_EVICT_DIRTY_HARD); + F_CLR(cache, WT_CACHE_EVICT_CLEAN | WT_CACHE_EVICT_CLEAN_HARD); } - /* Update the global eviction state. */ - cache->flags = flags; - return (F_ISSET(cache, WT_CACHE_EVICT_ALL | WT_CACHE_EVICT_URGENT)); } diff --git a/src/third_party/wiredtiger/src/evict/evict_page.c b/src/third_party/wiredtiger/src/evict/evict_page.c index b8c0a88a966..2510815401f 100644 --- a/src/third_party/wiredtiger/src/evict/evict_page.c +++ b/src/third_party/wiredtiger/src/evict/evict_page.c @@ -470,46 +470,11 @@ __evict_child_check(WT_SESSION_IMPL *session, WT_REF *parent) WT_REF *child; bool active; - /* - * There may be cursors in the tree walking the list of child pages. - * The parent is locked, so all we care about is cursors already in the - * child pages, no thread can enter them. Any cursor moving through the - * child pages must be hazard pointer coupling between pages, where the - * page on which it currently has a hazard pointer must be in a state - * other than on-disk. Walk the child list forward, then backward, to - * ensure we don't race with a cursor walking in the opposite direction - * from our check. - */ - WT_INTL_FOREACH_BEGIN(session, parent->page, child) { - switch (child->state) { - case WT_REF_DISK: /* On-disk */ - case WT_REF_DELETED: /* On-disk, deleted */ - case WT_REF_LOOKASIDE: /* On-disk, lookaside */ - break; - default: - return (__wt_set_return(session, EBUSY)); - } - } WT_INTL_FOREACH_END; - WT_INTL_FOREACH_REVERSE_BEGIN(session, parent->page, child) { - switch (child->state) { - case WT_REF_DISK: /* On-disk */ - case WT_REF_DELETED: /* On-disk, deleted */ - case WT_REF_LOOKASIDE: /* On-disk, lookaside */ - break; - default: - return (__wt_set_return(session, EBUSY)); - } - } WT_INTL_FOREACH_END; - - /* - * The fast check is done and there are no cursors in the child pages. - * Make sure the child WT_REF structures pages can be discarded. - */ WT_INTL_FOREACH_BEGIN(session, parent->page, child) { switch (child->state) { case WT_REF_DISK: /* On-disk */ break; - case WT_REF_DELETED: /* On-disk, deleted */ + case WT_REF_DELETED: /* Deleted */ /* * If the child page was part of a truncate, * transaction rollback might switch this page into its @@ -533,7 +498,7 @@ __evict_child_check(WT_SESSION_IMPL *session, WT_REF *parent) if (active) return (__wt_set_return(session, EBUSY)); break; - case WT_REF_LOOKASIDE: /* On-disk, lookaside */ + case WT_REF_LOOKASIDE: /* * If the lookaside history is obsolete, the reference * can be ignored. @@ -555,8 +520,9 @@ __evict_child_check(WT_SESSION_IMPL *session, WT_REF *parent) * for conditions that would block its eviction. */ static int -__evict_review(WT_SESSION_IMPL *session, - WT_REF *ref, uint32_t evict_flags, bool *inmem_splitp) +__evict_review( + WT_SESSION_IMPL *session, WT_REF *ref, uint32_t evict_flags, + bool *inmem_splitp) { WT_CACHE *cache; WT_CONNECTION_IMPL *conn; diff --git a/src/third_party/wiredtiger/src/include/btmem.h b/src/third_party/wiredtiger/src/include/btmem.h index 994633e0879..9859b3b607a 100644 --- a/src/third_party/wiredtiger/src/include/btmem.h +++ b/src/third_party/wiredtiger/src/include/btmem.h @@ -578,14 +578,6 @@ struct __wt_page { for (__refp = __pindex->index, \ __entries = __pindex->entries; __entries > 0; --__entries) {\ (ref) = *__refp++; -#define WT_INTL_FOREACH_REVERSE_BEGIN(session, page, ref) do { \ - WT_PAGE_INDEX *__pindex; \ - WT_REF **__refp; \ - uint32_t __entries; \ - WT_INTL_INDEX_GET(session, page, __pindex); \ - for (__refp = __pindex->index + __pindex->entries, \ - __entries = __pindex->entries; __entries > 0; --__entries) {\ - (ref) = *--__refp; #define WT_INTL_FOREACH_END \ } \ } while (0) @@ -888,51 +880,43 @@ struct __wt_ref { WT_PAGE_DELETED *page_del; /* Deleted page information */ WT_PAGE_LOOKASIDE *page_las; /* Lookaside information */ - /* - * In DIAGNOSTIC mode we overwrite the WT_REF on free to force failures. - * Don't clear the history in that case. - */ -#define WT_REF_CLEAR_SIZE (offsetof(WT_REF, hist)) - -#define WT_REF_SAVE_STATE_MAX 3 +/* A macro wrapper allowing us to remember the callers code location */ +#define WT_REF_CAS_STATE(session, ref, old_state, new_state) \ + __wt_ref_cas_state_int((session), (ref), (old_state), (new_state),\ + __FILE__, __LINE__) #ifdef HAVE_DIAGNOSTIC /* Capture history of ref state changes. */ struct __wt_ref_hist { WT_SESSION_IMPL *session; const char *name; - const char *func; - uint16_t line; - uint16_t state; - } hist[WT_REF_SAVE_STATE_MAX]; + const char *file; + int line; + uint32_t state; + } hist[3]; uint64_t histoff; #define WT_REF_SAVE_STATE(ref, s, f, l) do { \ (ref)->hist[(ref)->histoff].session = session; \ (ref)->hist[(ref)->histoff].name = session->name; \ - (ref)->hist[(ref)->histoff].func = (f); \ - (ref)->hist[(ref)->histoff].line = (uint16_t)(l); \ - (ref)->hist[(ref)->histoff].state = (uint16_t)(s); \ + (ref)->hist[(ref)->histoff].file = (f); \ + (ref)->hist[(ref)->histoff].line = (l); \ + (ref)->hist[(ref)->histoff].state = s; \ (ref)->histoff = \ ((ref)->histoff + 1) % WT_ELEMENTS((ref)->hist); \ } while (0) #define WT_REF_SET_STATE(ref, s) do { \ - WT_REF_SAVE_STATE(ref, s, __func__, __LINE__); \ + WT_REF_SAVE_STATE(ref, s, __FILE__, __LINE__); \ WT_PUBLISH((ref)->state, s); \ } while (0) #else #define WT_REF_SET_STATE(ref, s) WT_PUBLISH((ref)->state, s) #endif - -/* A macro wrapper allowing us to remember the callers code location */ -#define WT_REF_CAS_STATE(session, ref, old_state, new_state) \ - __wt_ref_cas_state_int( \ - session, ref, old_state, new_state, __func__, __LINE__) }; /* * WT_REF_SIZE is the expected structure size -- we verify the build to ensure * the compiler hasn't inserted padding which would break the world. */ #ifdef HAVE_DIAGNOSTIC -#define WT_REF_SIZE (56 + WT_REF_SAVE_STATE_MAX * sizeof(WT_REF_HIST) + 8) +#define WT_REF_SIZE (56 + 3 * sizeof(WT_REF_HIST) + 8) #else #define WT_REF_SIZE 56 #endif diff --git a/src/third_party/wiredtiger/src/include/cache.h b/src/third_party/wiredtiger/src/include/cache.h index a093022efa6..c4c0ee5d5d4 100644 --- a/src/third_party/wiredtiger/src/include/cache.h +++ b/src/third_party/wiredtiger/src/include/cache.h @@ -250,15 +250,14 @@ struct __wt_cache { uint32_t pool_flags; /* Cache pool flags */ /* AUTOMATIC FLAG VALUE GENERATION START */ -#define WT_CACHE_EVICT_CLEAN 0x001u /* Evict clean pages */ -#define WT_CACHE_EVICT_CLEAN_HARD 0x002u /* Clean % blocking app threads */ -#define WT_CACHE_EVICT_DEBUG_MODE 0x004u /* Aggressive debugging mode */ -#define WT_CACHE_EVICT_DIRTY 0x008u /* Evict dirty pages */ -#define WT_CACHE_EVICT_DIRTY_HARD 0x010u /* Dirty % blocking app threads */ -#define WT_CACHE_EVICT_LOOKASIDE 0x020u /* Try lookaside eviction */ -#define WT_CACHE_EVICT_NOKEEP 0x040u /* Don't add read pages to cache */ -#define WT_CACHE_EVICT_SCRUB 0x080u /* Scrub dirty pages */ -#define WT_CACHE_EVICT_URGENT 0x100u /* Pages are in the urgent queue */ +#define WT_CACHE_EVICT_CLEAN 0x01u /* Evict clean pages */ +#define WT_CACHE_EVICT_CLEAN_HARD 0x02u /* Clean % blocking app threads */ +#define WT_CACHE_EVICT_DEBUG_MODE 0x04u /* Aggressive debugging mode */ +#define WT_CACHE_EVICT_DIRTY 0x08u /* Evict dirty pages */ +#define WT_CACHE_EVICT_DIRTY_HARD 0x10u /* Dirty % blocking app threads */ +#define WT_CACHE_EVICT_LOOKASIDE 0x20u /* Try lookaside eviction */ +#define WT_CACHE_EVICT_SCRUB 0x40u /* Scrub dirty pages */ +#define WT_CACHE_EVICT_URGENT 0x80u /* Pages are in the urgent queue */ /* AUTOMATIC FLAG VALUE GENERATION STOP */ #define WT_CACHE_EVICT_ALL (WT_CACHE_EVICT_CLEAN | WT_CACHE_EVICT_DIRTY) uint32_t flags; diff --git a/src/third_party/wiredtiger/src/include/txn.i b/src/third_party/wiredtiger/src/include/txn.i index 3fd7b6cfc59..de10e8c44b9 100644 --- a/src/third_party/wiredtiger/src/include/txn.i +++ b/src/third_party/wiredtiger/src/include/txn.i @@ -21,13 +21,13 @@ typedef enum { */ static inline bool __wt_ref_cas_state_int(WT_SESSION_IMPL *session, WT_REF *ref, - uint32_t old_state, uint32_t new_state, const char *func, int line) + uint32_t old_state, uint32_t new_state, const char *file, int line) { bool cas_result; /* Parameters that are used in a macro for diagnostic builds */ WT_UNUSED(session); - WT_UNUSED(func); + WT_UNUSED(file); WT_UNUSED(line); cas_result = __wt_atomic_casv32(&ref->state, old_state, new_state); @@ -39,7 +39,7 @@ __wt_ref_cas_state_int(WT_SESSION_IMPL *session, WT_REF *ref, * updated. */ if (cas_result) - WT_REF_SAVE_STATE(ref, new_state, func, line); + WT_REF_SAVE_STATE(ref, new_state, file, line); #endif return (cas_result); } diff --git a/src/third_party/wiredtiger/src/reconcile/rec_write.c b/src/third_party/wiredtiger/src/reconcile/rec_write.c index f0692f5de50..1c873fc3d8a 100644 --- a/src/third_party/wiredtiger/src/reconcile/rec_write.c +++ b/src/third_party/wiredtiger/src/reconcile/rec_write.c @@ -26,8 +26,6 @@ static void __rec_write_page_status(WT_SESSION_IMPL *, WT_RECONCILE *); static int __rec_write_wrapup(WT_SESSION_IMPL *, WT_RECONCILE *, WT_PAGE *); static int __rec_write_wrapup_err( WT_SESSION_IMPL *, WT_RECONCILE *, WT_PAGE *); -static int __reconcile(WT_SESSION_IMPL *, - WT_REF *, WT_SALVAGE_COOKIE *, uint32_t, bool *, bool *); /* * __wt_reconcile -- @@ -37,15 +35,19 @@ int __wt_reconcile(WT_SESSION_IMPL *session, WT_REF *ref, WT_SALVAGE_COOKIE *salvage, uint32_t flags, bool *lookaside_retryp) { + WT_BTREE *btree; WT_DECL_RET; WT_PAGE *page; - bool no_reconcile_set, page_locked; + WT_PAGE_MODIFY *mod; + WT_RECONCILE *r; + uint64_t oldest_id; + btree = S2BT(session); + page = ref->page; + mod = page->modify; if (lookaside_retryp != NULL) *lookaside_retryp = false; - page = ref->page; - __wt_verbose(session, WT_VERB_RECONCILE, "%p reconcile %s (%s%s%s)", (void *)ref, __wt_page_type_string(page->type), @@ -74,18 +76,9 @@ __wt_reconcile(WT_SESSION_IMPL *session, WT_REF *ref, LF_ISSET(WT_REC_VISIBLE_ALL) || F_ISSET(&session->txn, WT_TXN_HAS_SNAPSHOT)); - /* It's an error to be called with a clean page. */ + /* We shouldn't get called with a clean page, that's an error. */ WT_ASSERT(session, __wt_page_is_modified(page)); - /* - * Reconciliation acquires and releases pages, and in rare cases that - * page release triggers eviction. If the page is dirty, eviction can - * trigger reconciliation, and we re-enter this code. Reconciliation - * isn't re-entrant, so we need to ensure that doesn't happen. - */ - no_reconcile_set = F_ISSET(session, WT_SESSION_NO_RECONCILE); - F_SET(session, WT_SESSION_NO_RECONCILE); - /* * Reconciliation locks the page for three reasons: * Reconciliation reads the lists of page updates, obsolete updates @@ -96,7 +89,6 @@ __wt_reconcile(WT_SESSION_IMPL *session, WT_REF *ref, * a child page splitting during the reconciliation. */ WT_PAGE_LOCK(session, page); - page_locked = true; /* * Now that the page is locked, if attempting to evict it, check again @@ -104,37 +96,20 @@ __wt_reconcile(WT_SESSION_IMPL *session, WT_REF *ref, * while we were waiting to acquire the lock (e.g., the page could have * split). */ - if (LF_ISSET(WT_REC_EVICT) && !__wt_page_can_evict(session, ref, NULL)) - WT_ERR(__wt_set_return(session, EBUSY)); - - /* - * Reconcile the page. The reconciliation code unlocks the page as soon - * as possible, and returns that information. - */ - ret = __reconcile(session, ref, - salvage, flags, lookaside_retryp, &page_locked); - -err: - if (page_locked) + if (LF_ISSET(WT_REC_EVICT) && + !__wt_page_can_evict(session, ref, NULL)) { WT_PAGE_UNLOCK(session, page); - if (!no_reconcile_set) - F_CLR(session, WT_SESSION_NO_RECONCILE); - return (ret); -} + return (__wt_set_return(session, EBUSY)); + } -/* - * __reconcile_save_evict_state -- - * Save the transaction state that causes history to be pinned, whether - * reconciliation succeeds or fails. - */ -static void -__reconcile_save_evict_state( - WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags) -{ - WT_PAGE_MODIFY *mod; - uint64_t oldest_id; + /* Initialize the reconciliation structure for each new run. */ + if ((ret = __rec_init( + session, ref, flags, salvage, &session->reconcile)) != 0) { + WT_PAGE_UNLOCK(session, page); + return (ret); + } + r = session->reconcile; - mod = ref->page->modify; oldest_id = __wt_txn_oldest_id(session); /* @@ -160,32 +135,6 @@ __reconcile_save_evict_state( WT_ASSERT(session, WT_TXNID_LE(mod->last_oldest_id, oldest_id)); mod->last_oldest_id = oldest_id; #endif -} - -/* - * __reconcile -- - * Reconcile an in-memory page into its on-disk format, and write it. - */ -static int -__reconcile(WT_SESSION_IMPL *session, WT_REF *ref, WT_SALVAGE_COOKIE *salvage, - uint32_t flags, bool *lookaside_retryp, bool *page_lockedp) -{ - WT_BTREE *btree; - WT_DECL_RET; - WT_PAGE *page; - WT_PAGE_MODIFY *mod; - WT_RECONCILE *r; - - btree = S2BT(session); - page = ref->page; - mod = page->modify; - - /* Save the eviction state. */ - __reconcile_save_evict_state(session, ref, flags); - - /* Initialize the reconciliation structure for each new run. */ - WT_RET(__rec_init(session, ref, flags, salvage, &session->reconcile)); - r = session->reconcile; /* Reconcile the page. */ switch (page->type) { @@ -240,7 +189,6 @@ __reconcile(WT_SESSION_IMPL *session, WT_REF *ref, WT_SALVAGE_COOKIE *salvage, S2C(session)->txn_global.stable_timestamp; /* Release the reconciliation lock. */ - *page_lockedp = false; WT_PAGE_UNLOCK(session, page); /* Update statistics. */ @@ -572,16 +520,7 @@ __rec_init(WT_SESSION_IMPL *session, btree = S2BT(session); page = ref->page; - /* - * Reconciliation is not re-entrant, make sure that doesn't happen. Our - * caller sets WT_SESSION_IMPL.WT_SESSION_NO_RECONCILE to prevent it, - * but it's been a problem in the past, check to be sure. - */ - r = *(WT_RECONCILE **)reconcilep; - if (r != NULL && r->ref != NULL) - WT_RET_MSG(session, WT_ERROR, "reconciliation re-entered"); - - if (r == NULL) { + if ((r = *(WT_RECONCILE **)reconcilep) == NULL) { WT_RET(__wt_calloc_one(session, &r)); *(WT_RECONCILE **)reconcilep = r; @@ -596,6 +535,9 @@ __rec_init(WT_SESSION_IMPL *session, F_SET(&r->chunkB.image, WT_ITEM_ALIGNED); } + /* Reconciliation is not re-entrant, make sure that doesn't happen. */ + WT_ASSERT(session, r->ref == NULL); + /* Remember the configuration. */ r->ref = ref; r->page = page; diff --git a/src/third_party/wiredtiger/src/support/hazard.c b/src/third_party/wiredtiger/src/support/hazard.c index bf77fc7c42e..52f77b5b232 100644 --- a/src/third_party/wiredtiger/src/support/hazard.c +++ b/src/third_party/wiredtiger/src/support/hazard.c @@ -330,10 +330,6 @@ __wt_hazard_check(WT_SESSION_IMPL *session, WT_SESSION_IMPL *s; uint32_t i, j, hazard_inuse, max, session_cnt, walk_cnt; - /* If a file can never be evicted, hazard pointers aren't required. */ - if (F_ISSET(S2BT(session), WT_BTREE_IN_MEMORY)) - return (NULL); - conn = S2C(session); WT_STAT_CONN_INCR(session, cache_hazard_checks); -- cgit v1.2.1