diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2016-11-16 16:49:09 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-16 16:49:09 +1100 |
commit | 9be507a869760c6adff119e6ea3be9e0e67135dd (patch) | |
tree | 8aa8a2ccdac099e2625fbe8095866e18ba4c11ce | |
parent | 56f14ea2ea83b871ebaabdd0c0ff14b1dba21644 (diff) | |
download | mongo-9be507a869760c6adff119e6ea3be9e0e67135dd.tar.gz |
WT-3023 Don't treat splits as eviction making progress. (#3151)
* We still want to get aggressive and/or "stuck" if all we do is rewrite pages over and over.
* Reset the eviction skip count in tiny trees: we may never have enough pages to hit the target.
-rw-r--r-- | dist/flags.py | 1 | ||||
-rw-r--r-- | src/evict/evict_lru.c | 4 | ||||
-rw-r--r-- | src/evict/evict_page.c | 15 | ||||
-rw-r--r-- | src/include/btree.i | 6 | ||||
-rw-r--r-- | src/include/flags.h | 37 |
5 files changed, 41 insertions, 22 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 |