summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2015-01-29 20:57:07 -0500
committerKeith Bostic <keith@wiredtiger.com>2015-01-29 20:57:07 -0500
commit035f7ada611dfd384da074ad53d61adc394f5dd6 (patch)
treeea2781e6d567f3125ba767a602b60e15766cfe67
parent8089f0a7931a2f3926dd3ce9a9bc5f73b9733966 (diff)
downloadmongo-035f7ada611dfd384da074ad53d61adc394f5dd6.tar.gz
Don't call __wt_cache_page_inmem_decr in the eviction path -- the page is
known to be clean in the current system, but I can imagine error paths where it wouldn't be, it seems cleaner to do it in __wt_cache_page_evict. Do the cache update in
-rw-r--r--src/btree/bt_discard.c2
-rw-r--r--src/include/btree.i7
2 files changed, 6 insertions, 3 deletions
diff --git a/src/btree/bt_discard.c b/src/btree/bt_discard.c
index ff5e313b135..05a54ad643e 100644
--- a/src/btree/bt_discard.c
+++ b/src/btree/bt_discard.c
@@ -96,8 +96,6 @@ __wt_page_out(WT_SESSION_IMPL *session, WT_PAGE **pagep)
}
/* Update the cache's information. */
- __wt_cache_page_inmem_decr(
- session, page, (size_t)page->memory_footprint);
__wt_cache_page_evict(session, page);
/*
diff --git a/src/include/btree.i b/src/include/btree.i
index 14bc021ab16..a02c263d86b 100644
--- a/src/include/btree.i
+++ b/src/include/btree.i
@@ -172,8 +172,12 @@ __wt_cache_page_evict(WT_SESSION_IMPL *session, WT_PAGE *page)
cache = S2C(session)->cache;
+ /* Update the bytes in-memory to reflect the eviction. */
+ WT_CACHE_DECR(session, cache->bytes_inmem, page->memory_footprint);
+
/*
- * We can get here with a non-zero count of dirty bytes in the page:
+ * We can get here with a non-zero count of page dirty bytes in error
+ * paths, as well as the following race:
* T1 test if page is dirty, returns true
* T2 reconciles and marks page clean
* T1 increments page's dirty-byte count
@@ -184,6 +188,7 @@ __wt_cache_page_evict(WT_SESSION_IMPL *session, WT_PAGE *page)
(void)WT_ATOMIC_SUB8(
cache->bytes_dirty, page->modify->bytes_dirty);
+ /* Update pages and bytes evicted. */
(void)WT_ATOMIC_ADD8(cache->bytes_evict, page->memory_footprint);
(void)WT_ATOMIC_ADD8(cache->pages_evict, 1);
}