summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/evict/evict_page.c
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2018-08-07 13:55:40 +1000
committerLuke Chen <luke.chen@mongodb.com>2018-08-07 13:55:40 +1000
commit96747600635ffe73bf1443857a76a9ccdc90c45c (patch)
tree4cb1eb058bdea550caca6fe5526a03693cfb07c2 /src/third_party/wiredtiger/src/evict/evict_page.c
parenta37441baa3d5d3dc6f70c7b0d7825f9dbbc90b3f (diff)
downloadmongo-96747600635ffe73bf1443857a76a9ccdc90c45c.tar.gz
Import wiredtiger: 2bb717625d1e81e6a0abfb910ead00afdde7fe2a from branch mongodb-4.0
ref: e6c7496532..2bb717625d for: 4.0.2 WT-3276 Add recover=salvage to recover from a corrupted log file WT-3943 Include full error message when a python test asserts WT-3955 Add verbose option to log more messages on error returns WT-3963 Add a schema intensive abort testing WT-3968 Use compression ratio to tune page sizes WT-4010 Simplify test/format timestamp handling. WT-4134 Rework assertion that we don't discard required history WT-4147 Log recovery should not ignore corruption outside of log records in a log file WT-4160 Restore performance when timestamps are not in use WT-4168 Update upgrading documentation for 3.1.0 release WT-4169 Fix wt verify dump-pages failure WT-4171 Enabling tree walk timing stress causes excessive slowdown WT-4172 Add diagnostic hazard pointer checks in more places before freeing refs WT-4174 Do not access the lookaside file in rollback_to_stable when running with in_memory=true WT-4178 Fixes for wt_btree_immediately_durable needed for in-memory WT-4179 Expose WiredTiger crc32c functions WT-4182 Use conservative approach for log checksum errors WT-4183 Extend verbose option to log more messages on error returns WT-4186 Log recovery should detect and report corruption within log records WT-4187 Coverity: unused value complaints WT-4188 Coverity: unchecked return value complaints WT-4189 Potential infinite loop in __async_flush_wait(). WT-4191 Fix Coverity static analysis errors WT-4195 When encountering an illegal value, log the value that failed WT-4196 Make log corruption checking work regardless of the machine byte order WT-4198 Some supported MongoDB architectures don't support crc32 hardware WT-4199 Fix an incorrect report of log corruption WT-4201 Fix Coverity static analysis issues WT-4206 Fix error handling in cursor close routines WT-4208 tree walks can be interrupted by locked internal pages WT-4213 Rename lock statistics that have redundant or misleading text WT-4226 test/format LSM configurations can misconfigure prepare and timestamps
Diffstat (limited to 'src/third_party/wiredtiger/src/evict/evict_page.c')
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_page.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/third_party/wiredtiger/src/evict/evict_page.c b/src/third_party/wiredtiger/src/evict/evict_page.c
index 0daccdf5b1c..8379c27617f 100644
--- a/src/third_party/wiredtiger/src/evict/evict_page.c
+++ b/src/third_party/wiredtiger/src/evict/evict_page.c
@@ -42,7 +42,7 @@ __evict_exclusive(WT_SESSION_IMPL *session, WT_REF *ref)
WT_STAT_DATA_INCR(session, cache_eviction_hazard);
WT_STAT_CONN_INCR(session, cache_eviction_hazard);
- return (EBUSY);
+ return (__wt_set_return(session, EBUSY));
}
/*
@@ -299,6 +299,18 @@ __evict_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
WT_DECL_RET;
/*
+ * Before discarding a page, assert that all updates are globally
+ * visible unless the tree is closing, dead, or we're evicting with
+ * history in lookaside.
+ */
+ WT_ASSERT(session,
+ closing || ref->page->modify == NULL ||
+ F_ISSET(session->dhandle, WT_DHANDLE_DEAD) ||
+ (ref->page_las != NULL && ref->page_las->eviction_to_lookaside) ||
+ __wt_txn_visible_all(session, ref->page->modify->rec_max_txn,
+ WT_TIMESTAMP_NULL(&ref->page->modify->rec_max_timestamp)));
+
+ /*
* Discard the page and update the reference structure. If evicting a
* WT_REF_LIMBO page with active history, transition back to
* WT_REF_LOOKASIDE. Otherwise, a page with a disk address is an
@@ -424,7 +436,7 @@ __evict_page_dirty_update(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
}
break;
- WT_ILLEGAL_VALUE(session);
+ WT_ILLEGAL_VALUE(session, mod->rec_result);
}
return (0);
@@ -453,7 +465,7 @@ __evict_child_check(WT_SESSION_IMPL *session, WT_REF *parent)
* page.
*/
if (__wt_page_del_active(session, child, true))
- return (EBUSY);
+ return (__wt_set_return(session, EBUSY));
break;
case WT_REF_LOOKASIDE:
/*
@@ -461,10 +473,10 @@ __evict_child_check(WT_SESSION_IMPL *session, WT_REF *parent)
* can be ignored.
*/
if (__wt_page_las_active(session, child))
- return (EBUSY);
+ return (__wt_set_return(session, EBUSY));
break;
default:
- return (EBUSY);
+ return (__wt_set_return(session, EBUSY));
}
} WT_INTL_FOREACH_END;
@@ -528,7 +540,7 @@ __evict_review(
* should be uncommon - we don't add clean pages to the queue.
*/
if (F_ISSET(conn, WT_CONN_IN_MEMORY) && !modified && !closing)
- return (EBUSY);
+ return (__wt_set_return(session, EBUSY));
/* Check if the page can be evicted. */
if (!closing) {
@@ -541,7 +553,7 @@ __evict_review(
session, WT_TXN_OLDEST_STRICT));
if (!__wt_page_can_evict(session, ref, inmem_splitp))
- return (EBUSY);
+ return (__wt_set_return(session, EBUSY));
/*
* Check for an append-only workload needing an in-memory
@@ -563,7 +575,7 @@ __evict_review(
* eviction that writes to lookaside), give up.
*/
if (F_ISSET(session, WT_SESSION_NO_RECONCILE))
- return (EBUSY);
+ return (__wt_set_return(session, EBUSY));
/*
* If the page is dirty, reconcile it to decide if we can evict it.
@@ -636,7 +648,7 @@ __evict_review(
if (WT_SESSION_IS_CHECKPOINT(session) && !__wt_page_is_modified(page) &&
!__wt_txn_visible_all(session, page->modify->rec_max_txn,
WT_TIMESTAMP_NULL(&page->modify->rec_max_timestamp)))
- return (EBUSY);
+ return (__wt_set_return(session, EBUSY));
/*
* If reconciliation fails but reports it might succeed if we use the
@@ -663,21 +675,14 @@ __evict_review(
*/
if (WT_SESSION_IS_CHECKPOINT(session) &&
page->modify->rec_result == WT_PM_REC_MULTIBLOCK)
- return (EBUSY);
+ return (__wt_set_return(session, EBUSY));
/*
- * Success: assert the page is clean or reconciliation was configured
- * for update/restore. If the page is clean, assert that reconciliation
- * was configured for a lookaside table, or it's not a durable object
- * (currently the lookaside table), or all page updates were globally
- * visible.
+ * Success: assert that the page is clean or reconciliation was
+ * configured to save updates.
*/
WT_ASSERT(session, !__wt_page_is_modified(page) ||
LF_ISSET(WT_REC_LOOKASIDE | WT_REC_UPDATE_RESTORE));
- WT_ASSERT(session,
- __wt_page_is_modified(page) ||
- __wt_txn_visible_all(session, page->modify->rec_max_txn,
- WT_TIMESTAMP_NULL(&page->modify->rec_max_timestamp)));
return (0);
}