summaryrefslogtreecommitdiff
path: root/src/conn/conn_cache_pool.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conn/conn_cache_pool.c')
-rw-r--r--src/conn/conn_cache_pool.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/conn/conn_cache_pool.c b/src/conn/conn_cache_pool.c
index 6294e3b01a7..aa14e9aadde 100644
--- a/src/conn/conn_cache_pool.c
+++ b/src/conn/conn_cache_pool.c
@@ -243,6 +243,7 @@ __wt_conn_cache_pool_open(WT_SESSION_IMPL *session)
WT_CACHE_POOL *cp;
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
+ uint32_t session_flags;
conn = S2C(session);
cache = conn->cache;
@@ -252,8 +253,9 @@ __wt_conn_cache_pool_open(WT_SESSION_IMPL *session)
* Create a session that can be used by the cache pool thread, do
* it in the main thread to avoid shutdown races
*/
+ session_flags = WT_SESSION_NO_DATA_HANDLES;
if ((ret = __wt_open_internal_session(
- conn, "cache-pool", false, false, &cache->cp_session)) != 0)
+ conn, "cache-pool", false, session_flags, &cache->cp_session)) != 0)
WT_RET_MSG(NULL, ret,
"Failed to create session for cache pool");
@@ -275,7 +277,7 @@ __wt_conn_cache_pool_open(WT_SESSION_IMPL *session)
* in each connection saves having a complex election process when
* the active connection shuts down.
*/
- F_SET_ATOMIC(cp, WT_CACHE_POOL_ACTIVE);
+ F_SET(cp, WT_CACHE_POOL_ACTIVE);
F_SET(cache, WT_CACHE_POOL_RUN);
WT_RET(__wt_thread_create(session, &cache->cp_tid,
__wt_cache_pool_server, cache->cp_session));
@@ -366,10 +368,10 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session)
if (--cp->refs == 0) {
WT_ASSERT(session, TAILQ_EMPTY(&cp->cache_pool_qh));
- F_CLR_ATOMIC(cp, WT_CACHE_POOL_ACTIVE);
+ F_CLR(cp, WT_CACHE_POOL_ACTIVE);
}
- if (!F_ISSET_ATOMIC(cp, WT_CACHE_POOL_ACTIVE)) {
+ if (!F_ISSET(cp, WT_CACHE_POOL_ACTIVE)) {
WT_TRET(__wt_verbose(
session, WT_VERB_SHARED_CACHE, "Destroying cache pool"));
__wt_spin_lock(session, &__wt_process.spinlock);
@@ -398,7 +400,7 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session)
/* Notify other participants if we were managing */
if (F_ISSET(cache, WT_CACHE_POOL_MANAGER)) {
- F_CLR_ATOMIC(cp, WT_CACHE_POOL_MANAGED);
+ cp->pool_managed = 0;
WT_TRET(__wt_verbose(session, WT_VERB_SHARED_CACHE,
"Shutting down shared cache manager connection"));
}
@@ -438,7 +440,7 @@ __cache_pool_balance(WT_SESSION_IMPL *session, bool forward)
* - Reduce the amount allocated, if we are over the budget
* - Increase the amount used if there is capacity and any pressure.
*/
- while (F_ISSET_ATOMIC(cp, WT_CACHE_POOL_ACTIVE) &&
+ while (F_ISSET(cp, WT_CACHE_POOL_ACTIVE) &&
F_ISSET(S2C(session)->cache, WT_CACHE_POOL_RUN)) {
WT_ERR(__cache_pool_adjust(
session, highest, bump_threshold, forward, &adjusted));
@@ -728,7 +730,7 @@ __wt_cache_pool_server(void *arg)
cache = S2C(session)->cache;
forward = true;
- while (F_ISSET_ATOMIC(cp, WT_CACHE_POOL_ACTIVE) &&
+ while (F_ISSET(cp, WT_CACHE_POOL_ACTIVE) &&
F_ISSET(cache, WT_CACHE_POOL_RUN)) {
if (cp->currently_used <= cp->size)
WT_ERR(__wt_cond_wait(session,
@@ -738,13 +740,12 @@ __wt_cache_pool_server(void *arg)
* Re-check pool run flag - since we want to avoid getting the
* lock on shutdown.
*/
- if (!F_ISSET_ATOMIC(cp, WT_CACHE_POOL_ACTIVE) &&
+ if (!F_ISSET(cp, WT_CACHE_POOL_ACTIVE) &&
F_ISSET(cache, WT_CACHE_POOL_RUN))
break;
/* Try to become the managing thread */
- F_CAS_ATOMIC(cp, WT_CACHE_POOL_MANAGED, ret);
- if (ret == 0) {
+ if (__wt_atomic_cas8(&cp->pool_managed, 0, 1)) {
F_SET(cache, WT_CACHE_POOL_MANAGER);
WT_ERR(__wt_verbose(session, WT_VERB_SHARED_CACHE,
"Cache pool switched manager thread"));