diff options
Diffstat (limited to 'src/conn')
-rw-r--r-- | src/conn/conn_api.c | 31 | ||||
-rw-r--r-- | src/conn/conn_cache.c | 6 | ||||
-rw-r--r-- | src/conn/conn_cache_pool.c | 52 | ||||
-rw-r--r-- | src/conn/conn_ckpt.c | 8 | ||||
-rw-r--r-- | src/conn/conn_dhandle.c | 31 | ||||
-rw-r--r-- | src/conn/conn_log.c | 25 | ||||
-rw-r--r-- | src/conn/conn_open.c | 2 | ||||
-rw-r--r-- | src/conn/conn_stat.c | 31 | ||||
-rw-r--r-- | src/conn/conn_sweep.c | 6 |
9 files changed, 99 insertions, 93 deletions
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index b1155d06826..4d93604d886 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -818,12 +818,12 @@ __conn_load_extension( WT_DLH *dlh; WT_SESSION_IMPL *session; int (*load)(WT_CONNECTION *, WT_CONFIG_ARG *); - int is_local; + bool is_local; const char *init_name, *terminate_name; dlh = NULL; init_name = terminate_name = NULL; - is_local = (strcmp(path, "local") == 0); + is_local = strcmp(path, "local") == 0; conn = (WT_CONNECTION_IMPL *)wt_conn; CONNECTION_API_CALL(conn, session, load_extension, config, cfg); @@ -1048,7 +1048,7 @@ __conn_reconfigure(WT_CONNECTION *wt_conn, const char *config) /* Second, reconfigure the system. */ WT_ERR(__conn_statistics_config(session, cfg)); WT_ERR(__wt_async_reconfig(session, cfg)); - WT_ERR(__wt_cache_config(session, 1, cfg)); + WT_ERR(__wt_cache_config(session, true, cfg)); WT_ERR(__wt_checkpoint_server_create(session, cfg)); WT_ERR(__wt_lsm_manager_reconfig(session, cfg)); WT_ERR(__wt_statlog_create(session, cfg)); @@ -1139,13 +1139,13 @@ __conn_config_check_version(WT_SESSION_IMPL *session, const char *config) */ static int __conn_config_file(WT_SESSION_IMPL *session, - const char *filename, int is_user, const char **cfg, WT_ITEM *cbuf) + const char *filename, bool is_user, const char **cfg, WT_ITEM *cbuf) { WT_DECL_RET; WT_FH *fh; size_t len; wt_off_t size; - int exist, quoted; + bool exist, quoted; char *p, *t; fh = NULL; @@ -1156,7 +1156,7 @@ __conn_config_file(WT_SESSION_IMPL *session, return (0); /* Open the configuration file. */ - WT_RET(__wt_open(session, filename, 0, 0, 0, &fh)); + WT_RET(__wt_open(session, filename, false, false, 0, &fh)); WT_ERR(__wt_filesize(session, fh, &size)); if (size == 0) goto err; @@ -1193,7 +1193,7 @@ __conn_config_file(WT_SESSION_IMPL *session, * escaped. Comment lines (an unescaped newline where the next non- * white-space character is a hash), are discarded. */ - for (quoted = 0, p = t = cbuf->mem; len > 0;) { + for (quoted = false, p = t = cbuf->mem; len > 0;) { /* * Backslash pairs pass through untouched, unless immediately * preceding a newline, in which case both the backslash and @@ -1372,14 +1372,14 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[]) WT_FH *fh; size_t len; wt_off_t size; - int exist, is_create; + bool exist, is_create; char buf[256]; conn = S2C(session); fh = NULL; WT_RET(__wt_config_gets(session, cfg, "create", &cval)); - is_create = cval.val == 0 ? 0 : 1; + is_create = cval.val != 0; __wt_spin_lock(session, &__wt_process.spinlock); @@ -1435,11 +1435,11 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[]) * file exists in the directory, create the lock file, covering the case * of a hot backup. */ - exist = 0; + exist = false; if (!is_create) WT_ERR(__wt_exist(session, WT_WIREDTIGER, &exist)); WT_ERR(__wt_open(session, - WT_SINGLETHREAD, is_create || exist, 0, 0, &conn->lock_fh)); + WT_SINGLETHREAD, is_create || exist, false, 0, &conn->lock_fh)); /* * Lock a byte of the file: if we don't get the lock, some other process @@ -1467,7 +1467,7 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[]) strlen(WT_SINGLETHREAD_STRING), WT_SINGLETHREAD_STRING)); /* We own the lock file, optionally create the WiredTiger file. */ - WT_ERR(__wt_open(session, WT_WIREDTIGER, is_create, 0, 0, &fh)); + WT_ERR(__wt_open(session, WT_WIREDTIGER, is_create, false, 0, &fh)); /* * Lock the WiredTiger file (for backward compatibility reasons as @@ -1650,7 +1650,7 @@ __conn_write_base_config(WT_SESSION_IMPL *session, const char *cfg[]) WT_CONFIG parser; WT_CONFIG_ITEM cval, k, v; WT_DECL_RET; - int exist; + bool exist; const char *base_config; fp = NULL; @@ -1881,9 +1881,10 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, /* Ignore the base_config file if we config_base set to false. */ if (config_base_set != 0) - WT_ERR(__conn_config_file(session, WT_BASECONFIG, 0, cfg, i1)); + WT_ERR( + __conn_config_file(session, WT_BASECONFIG, false, cfg, i1)); __conn_config_append(cfg, config); - WT_ERR(__conn_config_file(session, WT_USERCONFIG, 1, cfg, i2)); + WT_ERR(__conn_config_file(session, WT_USERCONFIG, true, cfg, i2)); WT_ERR(__conn_config_env(session, cfg, i3)); /* diff --git a/src/conn/conn_cache.c b/src/conn/conn_cache.c index a00b4f35562..0c1cfa60b25 100644 --- a/src/conn/conn_cache.c +++ b/src/conn/conn_cache.c @@ -13,7 +13,7 @@ * Configure the underlying cache. */ static int -__cache_config_local(WT_SESSION_IMPL *session, int shared, const char *cfg[]) +__cache_config_local(WT_SESSION_IMPL *session, bool shared, const char *cfg[]) { WT_CACHE *cache; WT_CONFIG_ITEM cval; @@ -76,7 +76,7 @@ __cache_config_local(WT_SESSION_IMPL *session, int shared, const char *cfg[]) * Configure or reconfigure the current cache and shared cache. */ int -__wt_cache_config(WT_SESSION_IMPL *session, int reconfigure, const char *cfg[]) +__wt_cache_config(WT_SESSION_IMPL *session, bool reconfigure, const char *cfg[]) { WT_CONFIG_ITEM cval; WT_CONNECTION_IMPL *conn; @@ -137,7 +137,7 @@ __wt_cache_create(WT_SESSION_IMPL *session, const char *cfg[]) cache = conn->cache; /* Use a common routine for run-time configuration options. */ - WT_RET(__wt_cache_config(session, 0, cfg)); + WT_RET(__wt_cache_config(session, false, cfg)); /* * The target size must be lower than the trigger size or we will never diff --git a/src/conn/conn_cache_pool.c b/src/conn/conn_cache_pool.c index aaae58ef168..e27d4f983aa 100644 --- a/src/conn/conn_cache_pool.c +++ b/src/conn/conn_cache_pool.c @@ -35,9 +35,9 @@ #define WT_CACHE_POOL_READ_MULTIPLIER 1 static int __cache_pool_adjust( - WT_SESSION_IMPL *, uint64_t, uint64_t, int, int *); + WT_SESSION_IMPL *, uint64_t, uint64_t, bool, bool *); static int __cache_pool_assess(WT_SESSION_IMPL *, uint64_t *); -static int __cache_pool_balance(WT_SESSION_IMPL *, int); +static int __cache_pool_balance(WT_SESSION_IMPL *, bool); /* * __wt_cache_pool_config -- @@ -51,17 +51,17 @@ __wt_cache_pool_config(WT_SESSION_IMPL *session, const char **cfg) WT_CONNECTION_IMPL *conn, *entry; WT_DECL_RET; char *pool_name; - int created, updating; + bool created, updating; uint64_t chunk, quota, reserve, size, used_cache; conn = S2C(session); - created = updating = 0; + created = updating = false; pool_name = NULL; cp = NULL; size = 0; if (F_ISSET(conn, WT_CONN_CACHE_POOL)) - updating = 1; + updating = true; else { WT_RET(__wt_config_gets_none( session, cfg, "shared_cache.name", &cval)); @@ -99,7 +99,7 @@ __wt_cache_pool_config(WT_SESSION_IMPL *session, const char **cfg) WT_ASSERT(session, !updating); /* Create a cache pool. */ WT_ERR(__wt_calloc_one(session, &cp)); - created = 1; + created = true; cp->name = pool_name; pool_name = NULL; /* Belongs to the cache pool now. */ TAILQ_INIT(&cp->cache_pool_qh); @@ -299,21 +299,21 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session) WT_CONNECTION_IMPL *conn, *entry; WT_DECL_RET; WT_SESSION *wt_session; - int cp_locked, found; + bool cp_locked, found; conn = S2C(session); cache = conn->cache; - cp_locked = found = 0; + cp_locked = found = false; cp = __wt_process.cache_pool; if (!F_ISSET(conn, WT_CONN_CACHE_POOL)) return (0); __wt_spin_lock(session, &cp->cache_pool_lock); - cp_locked = 1; + cp_locked = true; TAILQ_FOREACH(entry, &cp->cache_pool_qh, cpq) if (entry == conn) { - found = 1; + found = true; break; } @@ -336,7 +336,7 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session) * operation. */ __wt_spin_unlock(session, &cp->cache_pool_lock); - cp_locked = 0; + cp_locked = false; F_CLR(cache, WT_CACHE_POOL_RUN); WT_TRET(__wt_cond_signal(session, cp->cache_pool_cond)); @@ -351,7 +351,7 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session) * participant. */ __wt_spin_lock(session, &cp->cache_pool_lock); - cp_locked = 1; + cp_locked = true; } /* @@ -383,7 +383,7 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session) __wt_process.cache_pool = NULL; __wt_spin_unlock(session, &__wt_process.spinlock); __wt_spin_unlock(session, &cp->cache_pool_lock); - cp_locked = 0; + cp_locked = false; /* Now free the pool. */ __wt_free(session, cp->name); @@ -413,11 +413,11 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session) * effectively used. */ static int -__cache_pool_balance(WT_SESSION_IMPL *session, int forward) +__cache_pool_balance(WT_SESSION_IMPL *session, bool forward) { WT_CACHE_POOL *cp; WT_DECL_RET; - int adjusted; + bool adjusted; uint64_t bump_threshold, highest; cp = __wt_process.cache_pool; @@ -557,19 +557,19 @@ __cache_pool_assess(WT_SESSION_IMPL *session, uint64_t *phighest) */ static int __cache_pool_adjust(WT_SESSION_IMPL *session, - uint64_t highest, uint64_t bump_threshold, int forward, int *adjustedp) + uint64_t highest, uint64_t bump_threshold, bool forward, bool *adjustedp) { WT_CACHE_POOL *cp; WT_CACHE *cache; WT_CONNECTION_IMPL *entry; uint64_t adjustment, highest_percentile, pressure, reserved, smallest; - int busy, pool_full, grow; u_int pct_full; + bool busy, pool_full, grow; - *adjustedp = 0; + *adjustedp = false; cp = __wt_process.cache_pool; - grow = 0; - pool_full = (cp->currently_used >= cp->size); + grow = false; + pool_full = cp->currently_used >= cp->size; /* Highest as a percentage, avoid 0 */ highest_percentile = (highest / 100) + 1; @@ -615,7 +615,7 @@ __cache_pool_adjust(WT_SESSION_IMPL *session, * - the reserved size has been adjusted */ if (entry->cache_size < reserved) { - grow = 1; + grow = true; adjustment = reserved - entry->cache_size; /* * Conditions for reducing the amount of resources for an @@ -632,7 +632,7 @@ __cache_pool_adjust(WT_SESSION_IMPL *session, } else if (pool_full && !busy && entry->cache_size > reserved && pressure < WT_CACHE_POOL_REDUCE_THRESHOLD && highest > 1) { - grow = 0; + grow = false; /* * Don't drop the size down too much - or it can * trigger aggressive eviction in the connection, @@ -665,7 +665,7 @@ __cache_pool_adjust(WT_SESSION_IMPL *session, (entry->cache_size * cache->eviction_target) / 100 && (pressure > bump_threshold || cp->currently_used < cp->size * 0.5)) { - grow = 1; + grow = true; adjustment = WT_MIN(WT_MIN(cp->chunk, cp->size - cp->currently_used), cache->cp_quota - entry->cache_size); @@ -682,7 +682,7 @@ __cache_pool_adjust(WT_SESSION_IMPL *session, * gradually without stalling application threads. */ if (adjustment > 0) { - *adjustedp = 1; + *adjustedp = true; if (grow) { cache->cp_skip_count = WT_CACHE_POOL_BUMP_SKIPS; entry->cache_size += adjustment; @@ -720,13 +720,13 @@ __wt_cache_pool_server(void *arg) WT_CACHE_POOL *cp; WT_DECL_RET; WT_SESSION_IMPL *session; - int forward; + bool forward; session = (WT_SESSION_IMPL *)arg; cp = __wt_process.cache_pool; cache = S2C(session)->cache; - forward = 1; + forward = true; while (F_ISSET_ATOMIC(cp, WT_CACHE_POOL_ACTIVE) && F_ISSET(cache, WT_CACHE_POOL_RUN)) { diff --git a/src/conn/conn_ckpt.c b/src/conn/conn_ckpt.c index 74f27d8bd18..a2e985ee1ea 100644 --- a/src/conn/conn_ckpt.c +++ b/src/conn/conn_ckpt.c @@ -15,7 +15,7 @@ static int __ckpt_server_start(WT_CONNECTION_IMPL *); * Parse and setup the checkpoint server options. */ static int -__ckpt_server_config(WT_SESSION_IMPL *session, const char **cfg, int *startp) +__ckpt_server_config(WT_SESSION_IMPL *session, const char **cfg, bool *startp) { WT_CONFIG_ITEM cval; WT_CONNECTION_IMPL *conn; @@ -38,10 +38,10 @@ __ckpt_server_config(WT_SESSION_IMPL *session, const char **cfg, int *startp) if ((conn->ckpt_usecs == 0 && conn->ckpt_logsize == 0) || (conn->ckpt_logsize && conn->ckpt_usecs == 0 && !FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED))) { - *startp = 0; + *startp = false; return (0); } - *startp = 1; + *startp = true; /* * The application can specify a checkpoint name, which we ignore if @@ -161,7 +161,7 @@ int __wt_checkpoint_server_create(WT_SESSION_IMPL *session, const char *cfg[]) { WT_CONNECTION_IMPL *conn; - int start; + bool start; conn = S2C(session); start = 0; diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c index 58211eb33c5..794fbe23c90 100644 --- a/src/conn/conn_dhandle.c +++ b/src/conn/conn_dhandle.c @@ -145,16 +145,16 @@ __conn_dhandle_mark_dead(WT_SESSION_IMPL *session) * Sync and close the underlying btree handle. */ int -__wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, int final, int force) +__wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, bool final, bool force) { WT_BTREE *btree; WT_DATA_HANDLE *dhandle; WT_DECL_RET; - int marked_dead, no_schema_lock; + bool marked_dead, no_schema_lock; btree = S2BT(session); dhandle = session->dhandle; - marked_dead = 0; + marked_dead = false; if (!F_ISSET(dhandle, WT_DHANDLE_OPEN)) return (0); @@ -166,9 +166,9 @@ __wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, int final, int force) * we might deadlock with a thread that has the schema lock and wants * a handle lock (specifically, checkpoint). */ - no_schema_lock = 0; + no_schema_lock = false; if (!F_ISSET(session, WT_SESSION_LOCKED_SCHEMA)) { - no_schema_lock = 1; + no_schema_lock = true; F_SET(session, WT_SESSION_NO_SCHEMA_LOCK); } @@ -193,7 +193,7 @@ __wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, int final, int force) WT_BTREE_SALVAGE | WT_BTREE_UPGRADE | WT_BTREE_VERIFY)) { if (force && (btree->bm == NULL || btree->bm->map == NULL)) { WT_ERR(__conn_dhandle_mark_dead(session)); - marked_dead = 1; + marked_dead = true; } else WT_ERR(__wt_checkpoint_close(session, final)); } @@ -321,7 +321,7 @@ __wt_conn_btree_open( * in the tree that can block the close. */ if (F_ISSET(dhandle, WT_DHANDLE_OPEN)) - WT_RET(__wt_conn_btree_sync_and_close(session, 0, 0)); + WT_RET(__wt_conn_btree_sync_and_close(session, false, false)); /* Discard any previous configuration, set up the new configuration. */ __conn_btree_config_clear(session); @@ -383,7 +383,7 @@ __conn_btree_apply_internal(WT_SESSION_IMPL *session, WT_DATA_HANDLE *dhandle, */ int __wt_conn_btree_apply(WT_SESSION_IMPL *session, - int apply_checkpoints, const char *uri, + bool apply_checkpoints, const char *uri, int (*func)(WT_SESSION_IMPL *, const char *[]), const char *cfg[]) { WT_CONNECTION_IMPL *conn; @@ -522,7 +522,7 @@ __wt_conn_btree_apply_single(WT_SESSION_IMPL *session, */ int __wt_conn_dhandle_close_all( - WT_SESSION_IMPL *session, const char *uri, int force) + WT_SESSION_IMPL *session, const char *uri, bool force) { WT_CONNECTION_IMPL *conn; WT_DATA_HANDLE *dhandle; @@ -556,7 +556,7 @@ __wt_conn_dhandle_close_all( if (F_ISSET(dhandle, WT_DHANDLE_OPEN)) { if ((ret = __wt_meta_track_sub_on(session)) == 0) ret = __wt_conn_btree_sync_and_close( - session, 0, force); + session, false, force); /* * If the close succeeded, drop any locks it acquired. @@ -582,7 +582,7 @@ err: session->dhandle = NULL; * Remove a handle from the shared list. */ static int -__conn_dhandle_remove(WT_SESSION_IMPL *session, int final) +__conn_dhandle_remove(WT_SESSION_IMPL *session, bool final) { WT_CONNECTION_IMPL *conn; WT_DATA_HANDLE *dhandle; @@ -610,7 +610,8 @@ __conn_dhandle_remove(WT_SESSION_IMPL *session, int final) * Close/discard a single data handle. */ int -__wt_conn_dhandle_discard_single(WT_SESSION_IMPL *session, int final, int force) +__wt_conn_dhandle_discard_single( + WT_SESSION_IMPL *session, bool final, bool force) { WT_DATA_HANDLE *dhandle; WT_DECL_RET; @@ -678,7 +679,8 @@ restart: continue; WT_WITH_DHANDLE(session, dhandle, - WT_TRET(__wt_conn_dhandle_discard_single(session, 1, 0))); + WT_TRET(__wt_conn_dhandle_discard_single( + session, true, false))); goto restart; } @@ -694,7 +696,8 @@ restart: /* Close the metadata file handle. */ while ((dhandle = TAILQ_FIRST(&conn->dhqh)) != NULL) WT_WITH_DHANDLE(session, dhandle, - WT_TRET(__wt_conn_dhandle_discard_single(session, 1, 0))); + WT_TRET(__wt_conn_dhandle_discard_single( + session, true, false))); return (ret); } diff --git a/src/conn/conn_log.c b/src/conn/conn_log.c index f4baf6962ef..86b0edca13a 100644 --- a/src/conn/conn_log.c +++ b/src/conn/conn_log.c @@ -42,7 +42,7 @@ __logmgr_sync_cfg(WT_SESSION_IMPL *session, const char **cfg) * Parse and setup the logging server options. */ static int -__logmgr_config(WT_SESSION_IMPL *session, const char **cfg, int *runp) +__logmgr_config(WT_SESSION_IMPL *session, const char **cfg, bool *runp) { WT_CONFIG_ITEM cval; WT_CONNECTION_IMPL *conn; @@ -67,7 +67,7 @@ __logmgr_config(WT_SESSION_IMPL *session, const char **cfg, int *runp) WT_RET(__wt_strndup(session, cval.str, cval.len, &conn->log_path)); /* We are done if logging isn't enabled. */ - if (*runp == 0) + if (!*runp) return (0); WT_RET(__wt_config_gets(session, cfg, "log.archive", &cval)); @@ -289,12 +289,12 @@ __log_file_server(void *arg) WT_LSN close_end_lsn, min_lsn; WT_SESSION_IMPL *session; uint32_t filenum; - int locked; + bool locked; session = arg; conn = S2C(session); log = conn->log; - locked = 0; + locked = false; while (F_ISSET(conn, WT_CONN_LOG_SERVER_RUN)) { /* * If there is a log file to close, make sure any outstanding @@ -338,14 +338,14 @@ __log_file_server(void *arg) close_end_lsn.offset = 0; WT_ERR(__wt_fsync(session, close_fh)); __wt_spin_lock(session, &log->log_sync_lock); - locked = 1; + locked = true; WT_ERR(__wt_close(session, &close_fh)); WT_ASSERT(session, __wt_log_cmp( &close_end_lsn, &log->sync_lsn) >= 0); log->sync_lsn = close_end_lsn; WT_ERR(__wt_cond_signal( session, log->log_sync_cond)); - locked = 0; + locked = false; __wt_spin_unlock(session, &log->log_sync_lock); } } @@ -366,7 +366,7 @@ __log_file_server(void *arg) if (__wt_log_cmp(&log->bg_sync_lsn, &min_lsn) <= 0) { WT_ERR(__wt_fsync(session, log->log_fh)); __wt_spin_lock(session, &log->log_sync_lock); - locked = 1; + locked = true; /* * The sync LSN could have advanced while we * were writing to disk. @@ -377,7 +377,7 @@ __log_file_server(void *arg) WT_ERR(__wt_cond_signal( session, log->log_sync_cond)); } - locked = 0; + locked = false; __wt_spin_unlock(session, &log->log_sync_lock); } else { WT_ERR(__wt_cond_signal( @@ -609,12 +609,13 @@ __log_server(void *arg) WT_DECL_RET; WT_LOG *log; WT_SESSION_IMPL *session; - int freq_per_sec, signalled; + int freq_per_sec; + bool signalled; session = arg; conn = S2C(session); log = conn->log; - signalled = 0; + signalled = false; /* * Set this to the number of times per second we want to force out the @@ -649,7 +650,7 @@ __log_server(void *arg) * we want to force out log buffers. Only do it once per second * or if the condition was signalled. */ - if (--freq_per_sec <= 0 || signalled != 0) { + if (--freq_per_sec <= 0 || signalled) { freq_per_sec = WT_FORCE_PER_SECOND; /* @@ -696,7 +697,7 @@ __wt_logmgr_create(WT_SESSION_IMPL *session, const char *cfg[]) { WT_CONNECTION_IMPL *conn; WT_LOG *log; - int run; + bool run; conn = S2C(session); diff --git a/src/conn/conn_open.c b/src/conn/conn_open.c index 8bc69bb3e80..879ca08beb8 100644 --- a/src/conn/conn_open.c +++ b/src/conn/conn_open.c @@ -116,7 +116,7 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn) F_SET(conn, WT_CONN_CLOSING); WT_TRET(__wt_checkpoint_server_destroy(session)); - WT_TRET(__wt_statlog_destroy(session, 1)); + WT_TRET(__wt_statlog_destroy(session, true)); WT_TRET(__wt_evict_destroy(session)); /* Shut down the lookaside table, after all eviction is complete. */ diff --git a/src/conn/conn_stat.c b/src/conn/conn_stat.c index 3b188bfd22a..e5599ce0fce 100644 --- a/src/conn/conn_stat.c +++ b/src/conn/conn_stat.c @@ -68,7 +68,7 @@ __wt_conn_stat_init(WT_SESSION_IMPL *session) * Parse and setup the statistics server options. */ static int -__statlog_config(WT_SESSION_IMPL *session, const char **cfg, int *runp) +__statlog_config(WT_SESSION_IMPL *session, const char **cfg, bool *runp) { WT_CONFIG objectconf; WT_CONFIG_ITEM cval, k, v; @@ -82,7 +82,7 @@ __statlog_config(WT_SESSION_IMPL *session, const char **cfg, int *runp) WT_RET(__wt_config_gets(session, cfg, "statistics_log.wait", &cval)); /* Only start the server if wait time is non-zero */ - *runp = (cval.val == 0) ? 0 : 1; + *runp = cval.val != 0; conn->stat_usecs = (uint64_t)cval.val * 1000000; WT_RET(__wt_config_gets( @@ -94,7 +94,7 @@ __statlog_config(WT_SESSION_IMPL *session, const char **cfg, int *runp) * Statistics logging configuration requires either a wait time or an * on-close setting. */ - if (*runp == 0 && !FLD_ISSET(conn->stat_flags, WT_CONN_STAT_ON_CLOSE)) + if (!*runp && !FLD_ISSET(conn->stat_flags, WT_CONN_STAT_ON_CLOSE)) return (0); WT_RET(__wt_config_gets(session, cfg, "statistics_log.sources", &cval)); @@ -145,7 +145,7 @@ err: __stat_sources_free(session, &sources); * Dump out handle/connection statistics. */ static int -__statlog_dump(WT_SESSION_IMPL *session, const char *name, int conn_stats) +__statlog_dump(WT_SESSION_IMPL *session, const char *name, bool conn_stats) { WT_CONNECTION_IMPL *conn; WT_CURSOR *cursor; @@ -218,8 +218,8 @@ __statlog_apply(WT_SESSION_IMPL *session, const char *cfg[]) /* Check for a match on the set of sources. */ for (p = S2C(session)->stat_sources; *p != NULL; ++p) if (WT_PREFIX_MATCH(dhandle->name, *p)) { - WT_WITHOUT_DHANDLE(session, - ret = __statlog_dump(session, dhandle->name, 0)); + WT_WITHOUT_DHANDLE(session, ret = + __statlog_dump(session, dhandle->name, false)); return (ret); } return (0); @@ -238,7 +238,8 @@ __statlog_lsm_apply(WT_SESSION_IMPL *session) #define WT_LSM_TREE_LIST_SLOTS 100 WT_LSM_TREE *lsm_tree, *list[WT_LSM_TREE_LIST_SLOTS]; WT_DECL_RET; - int cnt, locked; + int cnt; + bool locked; char **p; cnt = locked = 0; @@ -258,7 +259,7 @@ __statlog_lsm_apply(WT_SESSION_IMPL *session) * will bump a reference count, so the tree won't go away. */ __wt_spin_lock(session, &S2C(session)->schema_lock); - locked = 1; + locked = true; TAILQ_FOREACH(lsm_tree, &S2C(session)->lsmqh, q) { if (cnt == WT_LSM_TREE_LIST_SLOTS) break; @@ -270,11 +271,11 @@ __statlog_lsm_apply(WT_SESSION_IMPL *session) } } __wt_spin_unlock(session, &S2C(session)->schema_lock); - locked = 0; + locked = false; while (cnt > 0) { --cnt; - WT_TRET(__statlog_dump(session, list[cnt]->name, 0)); + WT_TRET(__statlog_dump(session, list[cnt]->name, false)); __wt_lsm_tree_release(session, list[cnt]); } @@ -329,7 +330,7 @@ __statlog_log_one(WT_SESSION_IMPL *session, WT_ITEM *path, WT_ITEM *tmp) conn->stat_stamp = tmp->mem; /* Dump the connection statistics. */ - WT_RET(__statlog_dump(session, conn->home, 1)); + WT_RET(__statlog_dump(session, conn->home, true)); /* * Lock the schema and walk the list of open handles, dumping @@ -338,7 +339,7 @@ __statlog_log_one(WT_SESSION_IMPL *session, WT_ITEM *path, WT_ITEM *tmp) if (conn->stat_sources != NULL) { WT_WITH_HANDLE_LIST_LOCK(session, ret = __wt_conn_btree_apply( - session, 0, NULL, __statlog_apply, NULL)); + session, false, NULL, __statlog_apply, NULL)); WT_RET(ret); } @@ -479,7 +480,7 @@ int __wt_statlog_create(WT_SESSION_IMPL *session, const char *cfg[]) { WT_CONNECTION_IMPL *conn; - int start; + bool start; conn = S2C(session); start = 0; @@ -490,7 +491,7 @@ __wt_statlog_create(WT_SESSION_IMPL *session, const char *cfg[]) * configuration changes - but that makes our lives easier. */ if (conn->stat_session != NULL) - WT_RET(__wt_statlog_destroy(session, 0)); + WT_RET(__wt_statlog_destroy(session, false)); WT_RET(__statlog_config(session, cfg, &start)); if (start) @@ -504,7 +505,7 @@ __wt_statlog_create(WT_SESSION_IMPL *session, const char *cfg[]) * Destroy the statistics server thread. */ int -__wt_statlog_destroy(WT_SESSION_IMPL *session, int is_close) +__wt_statlog_destroy(WT_SESSION_IMPL *session, bool is_close) { WT_CONNECTION_IMPL *conn; WT_DECL_RET; diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c index 925e1c68815..73680e0b70b 100644 --- a/src/conn/conn_sweep.c +++ b/src/conn/conn_sweep.c @@ -100,7 +100,7 @@ __sweep_expire_one(WT_SESSION_IMPL *session) * handle. Closing the handle decrements the open file count, * meaning the close loop won't overrun the configured minimum. */ - ret = __wt_conn_btree_sync_and_close(session, 0, 1); + ret = __wt_conn_btree_sync_and_close(session, false, true); if (evict_reset) __wt_evict_file_exclusive_off(session); @@ -172,7 +172,7 @@ __sweep_discard_trees(WT_SESSION_IMPL *session, u_int *dead_handlesp) /* If the handle is marked "dead", flush it from cache. */ WT_WITH_DHANDLE(session, dhandle, ret = - __wt_conn_btree_sync_and_close(session, 0, 0)); + __wt_conn_btree_sync_and_close(session, false, false)); /* We closed the btree handle. */ if (ret == 0) { @@ -207,7 +207,7 @@ __sweep_remove_one(WT_SESSION_IMPL *session, WT_DATA_HANDLE *dhandle) WT_ERR(EBUSY); WT_WITH_DHANDLE(session, dhandle, - ret = __wt_conn_dhandle_discard_single(session, 0, 1)); + ret = __wt_conn_dhandle_discard_single(session, false, true)); /* * If the handle was not successfully discarded, unlock it and |