summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-11-16 21:09:45 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2016-11-16 21:09:45 +1100
commitca6eee06ffdacc8e191987e64b3791740dad21e1 (patch)
tree2ded23c60276ab8daec2a56c11bf20fd64ad9236
parent85121cf51f39f6959e02d5364bc51d51e48fe15b (diff)
parent1ce36af292fd0317021091a0523376b0533ac3bf (diff)
downloadmongo-ca6eee06ffdacc8e191987e64b3791740dad21e1.tar.gz
Merge branch 'develop' into mongodb-3.4mongodb-3.5.0mongodb-3.4.1mongodb-3.4.0
-rw-r--r--dist/flags.py1
-rw-r--r--src/evict/evict_lru.c4
-rw-r--r--src/evict/evict_page.c15
-rw-r--r--src/include/btree.i6
-rw-r--r--src/include/flags.h37
-rw-r--r--src/include/txn.h3
-rw-r--r--src/txn/txn_ckpt.c3
7 files changed, 46 insertions, 23 deletions
diff --git a/dist/flags.py b/dist/flags.py
index e200f95fba6..676f224cbb6 100644
--- a/dist/flags.py
+++ b/dist/flags.py
@@ -114,6 +114,7 @@ flags = {
'session' : [
'SESSION_CAN_WAIT',
'SESSION_INTERNAL',
+ 'SESSION_IN_SPLIT',
'SESSION_LOCK_NO_WAIT',
'SESSION_LOCKED_CHECKPOINT',
'SESSION_LOCKED_HANDLE_LIST',
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c
index dfa3fae48d9..ee30bd4b5b3 100644
--- a/src/evict/evict_lru.c
+++ b/src/evict/evict_lru.c
@@ -1498,11 +1498,13 @@ fast: /* If the page can't be evicted, give up. */
*/
if (give_up)
btree->evict_walk_reverse = !btree->evict_walk_reverse;
- if (give_up && !urgent_queued)
+ if (pages_queued == 0 && !urgent_queued)
btree->evict_walk_period = WT_MIN(
WT_MAX(1, 2 * btree->evict_walk_period), 100);
else if (pages_queued == target_pages)
btree->evict_walk_period = 0;
+ else if (btree->evict_walk_period > 0)
+ btree->evict_walk_period /= 2;
/*
* If we happen to end up on the root page or a page requiring urgent
diff --git a/src/evict/evict_page.c b/src/evict/evict_page.c
index 3d1557e027e..b15e1c1f26c 100644
--- a/src/evict/evict_page.c
+++ b/src/evict/evict_page.c
@@ -163,8 +163,19 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
*/
WT_ERR(__evict_page_clean_update(
session, ref, tree_dead || closing));
- else
- WT_ERR(__evict_page_dirty_update(session, ref, closing));
+ else {
+ /*
+ * The page is not being completely evicted: instead it is
+ * being split or replaced. In that case, don't increment the
+ * count of pages evicted, which we use to decide whether
+ * eviction is making progress. Repeatedly rewriting the same
+ * page isn't progress.
+ */
+ F_SET(session, WT_SESSION_IN_SPLIT);
+ ret = __evict_page_dirty_update(session, ref, closing);
+ F_CLR(session, WT_SESSION_IN_SPLIT);
+ WT_ERR(ret);
+ }
if (clean_page) {
WT_STAT_CONN_INCR(session, cache_eviction_clean);
diff --git a/src/include/btree.i b/src/include/btree.i
index 8f44bc4eddd..ad603f3ea53 100644
--- a/src/include/btree.i
+++ b/src/include/btree.i
@@ -408,7 +408,11 @@ __wt_cache_page_evict(WT_SESSION_IMPL *session, WT_PAGE *page)
/* Update pages and bytes evicted. */
(void)__wt_atomic_add64(&cache->bytes_evict, page->memory_footprint);
- (void)__wt_atomic_addv64(&cache->pages_evict, 1);
+
+ if (F_ISSET(session, WT_SESSION_IN_SPLIT))
+ (void)__wt_atomic_subv64(&cache->pages_inmem, 1);
+ else
+ (void)__wt_atomic_addv64(&cache->pages_evict, 1);
}
/*
diff --git a/src/include/flags.h b/src/include/flags.h
index b0d167525b2..d4c0b519cb1 100644
--- a/src/include/flags.h
+++ b/src/include/flags.h
@@ -52,24 +52,25 @@
#define WT_READ_WONT_NEED 0x00001000
#define WT_SESSION_CAN_WAIT 0x00000001
#define WT_SESSION_INTERNAL 0x00000002
-#define WT_SESSION_LOCKED_CHECKPOINT 0x00000004
-#define WT_SESSION_LOCKED_HANDLE_LIST 0x00000008
-#define WT_SESSION_LOCKED_METADATA 0x00000010
-#define WT_SESSION_LOCKED_PASS 0x00000020
-#define WT_SESSION_LOCKED_SCHEMA 0x00000040
-#define WT_SESSION_LOCKED_SLOT 0x00000080
-#define WT_SESSION_LOCKED_TABLE 0x00000100
-#define WT_SESSION_LOCKED_TURTLE 0x00000200
-#define WT_SESSION_LOCK_NO_WAIT 0x00000400
-#define WT_SESSION_LOGGING_INMEM 0x00000800
-#define WT_SESSION_LOOKASIDE_CURSOR 0x00001000
-#define WT_SESSION_NO_CACHE 0x00002000
-#define WT_SESSION_NO_DATA_HANDLES 0x00004000
-#define WT_SESSION_NO_EVICTION 0x00008000
-#define WT_SESSION_NO_LOGGING 0x00010000
-#define WT_SESSION_NO_SCHEMA_LOCK 0x00020000
-#define WT_SESSION_QUIET_CORRUPT_FILE 0x00040000
-#define WT_SESSION_SERVER_ASYNC 0x00080000
+#define WT_SESSION_IN_SPLIT 0x00000004
+#define WT_SESSION_LOCKED_CHECKPOINT 0x00000008
+#define WT_SESSION_LOCKED_HANDLE_LIST 0x00000010
+#define WT_SESSION_LOCKED_METADATA 0x00000020
+#define WT_SESSION_LOCKED_PASS 0x00000040
+#define WT_SESSION_LOCKED_SCHEMA 0x00000080
+#define WT_SESSION_LOCKED_SLOT 0x00000100
+#define WT_SESSION_LOCKED_TABLE 0x00000200
+#define WT_SESSION_LOCKED_TURTLE 0x00000400
+#define WT_SESSION_LOCK_NO_WAIT 0x00000800
+#define WT_SESSION_LOGGING_INMEM 0x00001000
+#define WT_SESSION_LOOKASIDE_CURSOR 0x00002000
+#define WT_SESSION_NO_CACHE 0x00004000
+#define WT_SESSION_NO_DATA_HANDLES 0x00008000
+#define WT_SESSION_NO_EVICTION 0x00010000
+#define WT_SESSION_NO_LOGGING 0x00020000
+#define WT_SESSION_NO_SCHEMA_LOCK 0x00040000
+#define WT_SESSION_QUIET_CORRUPT_FILE 0x00080000
+#define WT_SESSION_SERVER_ASYNC 0x00100000
#define WT_STAT_CLEAR 0x00000001
#define WT_STAT_JSON 0x00000002
#define WT_STAT_ON_CLOSE 0x00000004
diff --git a/src/include/txn.h b/src/include/txn.h
index 774f635d7ba..344275e23d0 100644
--- a/src/include/txn.h
+++ b/src/include/txn.h
@@ -49,8 +49,11 @@
WT_ASSERT((s), (s)->txn.forced_iso > 0); \
(s)->txn.forced_iso--; \
WT_ASSERT((s), txn_state->id == saved_state.id && \
+ (txn_state->metadata_pinned == saved_state.metadata_pinned ||\
+ saved_state.metadata_pinned == WT_TXN_NONE) && \
(txn_state->pinned_id == saved_state.pinned_id || \
saved_state.pinned_id == WT_TXN_NONE)); \
+ txn_state->metadata_pinned = saved_state.metadata_pinned; \
txn_state->pinned_id = saved_state.pinned_id; \
} while (0)
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c
index 698cae23562..802ccd84915 100644
--- a/src/txn/txn_ckpt.c
+++ b/src/txn/txn_ckpt.c
@@ -701,7 +701,8 @@ __txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
* can safely ignore the checkpoint ID (see the visible all check for
* details).
*/
- txn_state->id = txn_state->pinned_id = WT_TXN_NONE;
+ txn_state->id = txn_state->pinned_id =
+ txn_state->metadata_pinned = WT_TXN_NONE;
__wt_writeunlock(session, txn_global->scan_rwlock);
/*