summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/evict/evict_file.c
diff options
context:
space:
mode:
authorDan Pasette <dan@10gen.com>2015-02-04 06:48:51 -0500
committerDan Pasette <dan@mongodb.com>2015-02-04 06:55:52 -0500
commit7d9ec251cf0e70bc0f9bb246aacfb6e62226ad37 (patch)
tree5b436359112bc5610dcf9fd1e1f7331854b388d6 /src/third_party/wiredtiger/src/evict/evict_file.c
parentfc14926f9c8256edce8bbd15d439ca34667c6ebb (diff)
downloadmongo-7d9ec251cf0e70bc0f9bb246aacfb6e62226ad37.tar.gz
Import wiredtiger-wiredtiger-mongodb-2.8-rc7-105-g92325a3.tar.gz from wiredtiger branch mongodb-2.8
Diffstat (limited to 'src/third_party/wiredtiger/src/evict/evict_file.c')
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_file.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/third_party/wiredtiger/src/evict/evict_file.c b/src/third_party/wiredtiger/src/evict/evict_file.c
index 553acc988f0..5aa85872a3b 100644
--- a/src/third_party/wiredtiger/src/evict/evict_file.c
+++ b/src/third_party/wiredtiger/src/evict/evict_file.c
@@ -90,33 +90,43 @@ __wt_evict_file(WT_SESSION_IMPL *session, int syncop)
WT_ERR(__wt_evict(session, ref, 1));
break;
case WT_SYNC_DISCARD:
- case WT_SYNC_DISCARD_FORCE:
/*
- * Discard the page, whether clean or dirty.
- *
- * Clean the page, both to keep statistics correct, and
- * to let the page-discard function assert no dirty page
- * is ever discarded.
+ * Ordinary discard of the page, whether clean or dirty.
+ * If we see a dirty page in an ordinary discard (e.g.,
+ * from sweep), give up: an update must have happened
+ * since the file was selected for sweeping.
*/
- if (__wt_page_is_modified(page)) {
- page->modify->write_gen = 0;
- __wt_cache_dirty_decr(session, page);
- }
+ if (__wt_page_is_modified(page))
+ WT_ERR(EBUSY);
+
/*
* If the page contains an update that is too recent to
* evict, stop. This should never happen during
- * connection close, and in other paths our caller
+ * connection close, but in other paths our caller
* should be prepared to deal with this case.
*/
- if (syncop == WT_SYNC_DISCARD &&
- page->modify != NULL &&
+ if (page->modify != NULL &&
!__wt_txn_visible_all(session,
page->modify->rec_max_txn))
WT_ERR(EBUSY);
- if (syncop == WT_SYNC_DISCARD_FORCE)
- F_SET(session, WT_SESSION_DISCARD_FORCE);
- __wt_rec_page_clean_update(session, ref);
+ __wt_evict_page_clean_update(session, ref);
+ break;
+ case WT_SYNC_DISCARD_FORCE:
+ /*
+ * Forced discard of the page, whether clean or dirty.
+ * If we see a dirty page in a forced discard, clean
+ * the page, both to keep statistics correct, and to
+ * let the page-discard function assert no dirty page
+ * is ever discarded.
+ */
+ if (__wt_page_is_modified(page)) {
+ page->modify->write_gen = 0;
+ __wt_cache_dirty_decr(session, page);
+ }
+
+ F_SET(session, WT_SESSION_DISCARD_FORCE);
+ __wt_evict_page_clean_update(session, ref);
F_CLR(session, WT_SESSION_DISCARD_FORCE);
break;
WT_ILLEGAL_VALUE_ERR(session);