summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/evict/evict_page.c
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2019-05-07 16:35:05 +1000
committerLuke Chen <luke.chen@mongodb.com>2019-05-07 16:35:05 +1000
commit400e0500147836ba11ab611bdac2675d65cb7b48 (patch)
treeb87b043ef767d5ca50d43ec6a7ad09f6f4d27073 /src/third_party/wiredtiger/src/evict/evict_page.c
parent8ad1effc48ac5193c5f57630d1fbce8bda0cfdaf (diff)
downloadmongo-400e0500147836ba11ab611bdac2675d65cb7b48.tar.gz
Import wiredtiger: d9ec69f9111b036ee0b19b47368e15bff8d4818d from branch mongodb-4.2
ref: 617a81369c..d9ec69f911 for: 4.1.11 WT-4278 Clarify in docs that schema operations are not transactional WT-4309 Increase the maximum expected LAS test reads WT-4352 Resolve birthmarks during eviction in more cases WT-4582 Respect prepared updates in lookaside WT-4642 Store transaction IDs durably WT-4670 Remove support for WiredTiger LevelDB APIs WT-4688 Fix test and docs for correct log cursor usage WT-4690 Make sure eviction does not split during checkpoints WT-4697 Python3: change workgen to work with Python3 WT-4706 Add a statistic to track the lookaside table size WT-4723 Restructure the reconciliation code WT-4725 Python3: change miscellaneous scripts to run under Python3 WT-4726 Python3: set up pull request tester to run with Python3 WT-4728 Remove the stop timestamp from the WT_UPDATE structure WT-4738 Tighten rules around use of timestamps WT-4745 Update upgrading documentation before 3.2.0 WiredTiger release WT-4746 Document that transactions without timestamps clear history WT-4749 Fix error message formatting (possible SEGV) for prepare_transaction WT-4751 Change __wt_timestamp_to_string() to return a pointer to simplify verbose WT-4752 WiredTiger autoconfig check for the compiler incorrectly quoted WT-4753 Strip the timing_stress configuration options from the base configuration WT-4754 Change the checkpoint code to not require a list order WT-4755 Switch to a better timestamp and transaction ID ordering convention WT-4756 Fix comment in python integer encoder WT-4759 Save a copy when an old overflow value is discarded WT-4764 Avoid choosing a transaction frequency of 0 in test/format
Diffstat (limited to 'src/third_party/wiredtiger/src/evict/evict_page.c')
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_page.c54
1 files changed, 33 insertions, 21 deletions
diff --git a/src/third_party/wiredtiger/src/evict/evict_page.c b/src/third_party/wiredtiger/src/evict/evict_page.c
index 34e138a7a48..4f472b9c9c6 100644
--- a/src/third_party/wiredtiger/src/evict/evict_page.c
+++ b/src/third_party/wiredtiger/src/evict/evict_page.c
@@ -8,9 +8,9 @@
#include "wt_internal.h"
-static int __evict_page_clean_update(WT_SESSION_IMPL *, WT_REF *, bool);
-static int __evict_page_dirty_update(WT_SESSION_IMPL *, WT_REF *, bool);
-static int __evict_review(WT_SESSION_IMPL *, WT_REF *, bool, bool *);
+static int __evict_page_clean_update(WT_SESSION_IMPL *, WT_REF *, uint32_t);
+static int __evict_page_dirty_update(WT_SESSION_IMPL *, WT_REF *, uint32_t);
+static int __evict_review(WT_SESSION_IMPL *, WT_REF *, uint32_t, bool *);
/*
* __evict_exclusive_clear --
@@ -51,19 +51,20 @@ __evict_exclusive(WT_SESSION_IMPL *session, WT_REF *ref)
* Release a reference to a page, and attempt to immediately evict it.
*/
int
-__wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref)
+__wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags)
{
WT_BTREE *btree;
WT_DECL_RET;
WT_PAGE *page;
uint64_t time_start, time_stop;
- uint32_t previous_state;
+ uint32_t evict_flags, previous_state;
bool locked, too_big;
btree = S2BT(session);
locked = false;
page = ref->page;
time_start = __wt_clock(session);
+ evict_flags = LF_ISSET(WT_READ_NO_SPLIT) ? WT_EVICT_CALL_NO_SPLIT : 0;
/*
* This function always releases the hazard pointer - ensure that's
@@ -89,7 +90,7 @@ __wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref)
* Track how long the call to evict took. If eviction is successful then
* we have one of two pairs of stats to increment.
*/
- ret = __wt_evict(session, ref, false, previous_state);
+ ret = __wt_evict(session, ref, previous_state, evict_flags);
time_stop = __wt_clock(session);
if (ret == 0) {
if (too_big) {
@@ -124,20 +125,25 @@ __wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref)
*/
int
__wt_evict(WT_SESSION_IMPL *session,
- WT_REF *ref, bool closing, uint32_t previous_state)
+ WT_REF *ref, uint32_t previous_state, uint32_t flags)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
WT_PAGE *page;
- bool clean_page, inmem_split, local_gen, tree_dead;
+ bool clean_page, closing, inmem_split, local_gen, tree_dead;
conn = S2C(session);
page = ref->page;
+ closing = LF_ISSET(WT_EVICT_CALL_CLOSING);
local_gen = false;
__wt_verbose(session, WT_VERB_EVICT,
"page %p (%s)", (void *)page, __wt_page_type_string(page->type));
+ tree_dead = F_ISSET(session->dhandle, WT_DHANDLE_DEAD);
+ if (tree_dead)
+ LF_SET(WT_EVICT_CALL_NO_SPLIT);
+
/*
* Enter the eviction generation. If we re-enter eviction, leave the
* previous eviction generation (which must be as low as the current
@@ -171,7 +177,7 @@ __wt_evict(WT_SESSION_IMPL *session,
* Make this check for clean pages, too: while unlikely eviction would
* choose an internal page with children, it's not disallowed.
*/
- WT_ERR(__evict_review(session, ref, closing, &inmem_split));
+ WT_ERR(__evict_review(session, ref, flags, &inmem_split));
/*
* If there was an in-memory split, the tree has been left in the state
@@ -208,7 +214,6 @@ __wt_evict(WT_SESSION_IMPL *session,
}
/* Update the reference and discard the page. */
- tree_dead = F_ISSET(session->dhandle, WT_DHANDLE_DEAD);
if (__wt_ref_is_root(ref))
__wt_ref_out(session, ref);
else if ((clean_page && !F_ISSET(conn, WT_CONN_IN_MEMORY)) || tree_dead)
@@ -216,10 +221,9 @@ __wt_evict(WT_SESSION_IMPL *session,
* Pages that belong to dead trees never write back to disk
* and can't support page splits.
*/
- WT_ERR(__evict_page_clean_update(
- session, ref, tree_dead || closing));
+ WT_ERR(__evict_page_clean_update(session, ref, flags));
else
- WT_ERR(__evict_page_dirty_update(session, ref, closing));
+ WT_ERR(__evict_page_dirty_update(session, ref, flags));
if (clean_page) {
WT_STAT_CONN_INCR(session, cache_eviction_clean);
@@ -250,7 +254,7 @@ done: /* Leave any local eviction generation. */
* split.
*/
static int
-__evict_delete_ref(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
+__evict_delete_ref(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags)
{
WT_DECL_RET;
WT_PAGE *parent;
@@ -264,7 +268,7 @@ __evict_delete_ref(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
* Avoid doing reverse splits when closing the file, it is wasted work
* and some structures may have already been freed.
*/
- if (!closing) {
+ if (!LF_ISSET(WT_EVICT_CALL_NO_SPLIT | WT_EVICT_CALL_CLOSING)) {
parent = ref->home;
WT_INTL_INDEX_GET(session, parent, pindex);
ndeleted = __wt_atomic_addv32(&pindex->deleted_entries, 1);
@@ -302,9 +306,12 @@ __evict_delete_ref(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
* Update a clean page's reference on eviction.
*/
static int
-__evict_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
+__evict_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags)
{
WT_DECL_RET;
+ bool closing;
+
+ closing = LF_ISSET(WT_EVICT_CALL_CLOSING);
/*
* Before discarding a page, assert that all updates are globally
@@ -334,7 +341,7 @@ __evict_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
WT_REF_SET_STATE(ref, WT_REF_LOOKASIDE);
} else if (ref->addr == NULL) {
WT_WITH_PAGE_INDEX(session,
- ret = __evict_delete_ref(session, ref, closing));
+ ret = __evict_delete_ref(session, ref, flags));
WT_RET_BUSY_OK(ret);
} else
WT_REF_SET_STATE(ref, WT_REF_DISK);
@@ -347,14 +354,17 @@ __evict_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
* Update a dirty page's reference on eviction.
*/
static int
-__evict_page_dirty_update(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
+__evict_page_dirty_update(WT_SESSION_IMPL *session, WT_REF *ref,
+ uint32_t evict_flags)
{
WT_ADDR *addr;
WT_DECL_RET;
WT_MULTI multi;
WT_PAGE_MODIFY *mod;
+ bool closing;
mod = ref->page->modify;
+ closing = FLD_ISSET(evict_flags, WT_EVICT_CALL_CLOSING);
WT_ASSERT(session, ref->addr == NULL);
@@ -370,7 +380,7 @@ __evict_page_dirty_update(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
*/
__wt_ref_out(session, ref);
WT_WITH_PAGE_INDEX(session,
- ret = __evict_delete_ref(session, ref, closing));
+ ret = __evict_delete_ref(session, ref, evict_flags));
WT_RET_BUSY_OK(ret);
break;
case WT_PM_REC_MULTIBLOCK: /* Multiple blocks */
@@ -511,20 +521,22 @@ __evict_child_check(WT_SESSION_IMPL *session, WT_REF *parent)
*/
static int
__evict_review(
- WT_SESSION_IMPL *session, WT_REF *ref, bool closing, bool *inmem_splitp)
+ WT_SESSION_IMPL *session, WT_REF *ref, uint32_t evict_flags,
+ bool *inmem_splitp)
{
WT_CACHE *cache;
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
WT_PAGE *page;
uint32_t flags;
- bool lookaside_retry, *lookaside_retryp, modified;
+ bool closing, lookaside_retry, *lookaside_retryp, modified;
*inmem_splitp = false;
conn = S2C(session);
page = ref->page;
flags = WT_REC_EVICT;
+ closing = FLD_ISSET(evict_flags, WT_EVICT_CALL_CLOSING);
if (!WT_SESSION_BTREE_SYNC(session))
LF_SET(WT_REC_VISIBLE_ALL);