diff options
Diffstat (limited to 'src/third_party/wiredtiger/src/conn/conn_cache.c')
-rw-r--r-- | src/third_party/wiredtiger/src/conn/conn_cache.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/third_party/wiredtiger/src/conn/conn_cache.c b/src/third_party/wiredtiger/src/conn/conn_cache.c index e8bb7187418..ba1e0210334 100644 --- a/src/third_party/wiredtiger/src/conn/conn_cache.c +++ b/src/third_party/wiredtiger/src/conn/conn_cache.c @@ -18,7 +18,7 @@ __cache_config_local(WT_SESSION_IMPL *session, bool shared, const char *cfg[]) WT_CACHE *cache; WT_CONFIG_ITEM cval; WT_CONNECTION_IMPL *conn; - uint32_t evict_workers_max, evict_workers_min; + uint32_t evict_threads_max, evict_threads_min; conn = S2C(session); cache = conn->cache; @@ -48,25 +48,20 @@ __cache_config_local(WT_SESSION_IMPL *session, bool shared, const char *cfg[]) WT_RET(__wt_config_gets(session, cfg, "eviction_dirty_trigger", &cval)); cache->eviction_dirty_trigger = (u_int)cval.val; - /* - * The eviction thread configuration options include the main eviction - * thread and workers. Our implementation splits them out. Adjust for - * the difference when parsing the configuration. - */ WT_RET(__wt_config_gets(session, cfg, "eviction.threads_max", &cval)); WT_ASSERT(session, cval.val > 0); - evict_workers_max = (uint32_t)cval.val - 1; + evict_threads_max = (uint32_t)cval.val; WT_RET(__wt_config_gets(session, cfg, "eviction.threads_min", &cval)); WT_ASSERT(session, cval.val > 0); - evict_workers_min = (uint32_t)cval.val - 1; + evict_threads_min = (uint32_t)cval.val; - if (evict_workers_min > evict_workers_max) + if (evict_threads_min > evict_threads_max) WT_RET_MSG(session, EINVAL, "eviction=(threads_min) cannot be greater than " "eviction=(threads_max)"); - conn->evict_workers_max = evict_workers_max; - conn->evict_workers_min = evict_workers_min; + conn->evict_threads_max = evict_threads_max; + conn->evict_threads_min = evict_threads_min; return (0); } @@ -114,6 +109,16 @@ __wt_cache_config(WT_SESSION_IMPL *session, bool reconfigure, const char *cfg[]) WT_RET(__wt_conn_cache_pool_open(session)); } + /* + * Resize the thread group if reconfiguring, otherwise the thread group + * will be initialized as part of creating the cache. + */ + if (reconfigure) + WT_RET(__wt_thread_group_resize( + session, &conn->evict_threads, + conn->evict_threads_min, conn->evict_threads_max, + WT_THREAD_CAN_WAIT | WT_THREAD_PANIC_FAIL)); + return (0); } @@ -156,8 +161,6 @@ __wt_cache_create(WT_SESSION_IMPL *session, const char *cfg[]) WT_ERR(__wt_cond_auto_alloc(session, "cache eviction server", false, 10000, WT_MILLION, &cache->evict_cond)); - WT_ERR(__wt_cond_alloc(session, - "eviction waiters", false, &cache->evict_waiter_cond)); WT_ERR(__wt_spin_init(session, &cache->evict_pass_lock, "evict pass")); WT_ERR(__wt_spin_init(session, &cache->evict_queue_lock, "cache eviction queue")); @@ -176,9 +179,11 @@ __wt_cache_create(WT_SESSION_IMPL *session, const char *cfg[]) &cache->evict_queues[i].evict_lock, "cache eviction")); } - /* Ensure there is always a non-NULL current queue. */ - cache->evict_current_queue = - &cache->evict_queues[WT_EVICT_URGENT_QUEUE + 1]; + /* Ensure there are always non-NULL queues. */ + cache->evict_current_queue = cache->evict_fill_queue = + &cache->evict_queues[0]; + cache->evict_other_queue = &cache->evict_queues[1]; + cache->evict_urgent_queue = &cache->evict_queues[WT_EVICT_URGENT_QUEUE]; /* * We get/set some values in the cache statistics (rather than have @@ -240,7 +245,7 @@ __wt_cache_stats_update(WT_SESSION_IMPL *session) * The number of files with active walks ~= number of hazard pointers * in the walk session. Note: reading without locking. */ - if (conn->evict_session != NULL) + if (conn->evict_server_running) WT_STAT_SET(session, stats, cache_eviction_walks_active, cache->walk_session->nhazard); } @@ -283,7 +288,6 @@ __wt_cache_destroy(WT_SESSION_IMPL *session) cache->pages_dirty_intl + cache->pages_dirty_leaf); WT_TRET(__wt_cond_auto_destroy(session, &cache->evict_cond)); - WT_TRET(__wt_cond_destroy(session, &cache->evict_waiter_cond)); __wt_spin_destroy(session, &cache->evict_pass_lock); __wt_spin_destroy(session, &cache->evict_queue_lock); __wt_spin_destroy(session, &cache->evict_walk_lock); |