summaryrefslogtreecommitdiff
path: root/src/conn
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-09-24 14:29:56 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-09-29 14:05:30 +1000
commit6f6281c978507312def82af8fa6dd020b9fcb1a6 (patch)
tree6a37d903ea8dbb121bc04d28b2e69a6c02f5da17 /src/conn
parentcd8ae463f0830e56ec66de73de78ca81041615b2 (diff)
downloadmongo-6f6281c978507312def82af8fa6dd020b9fcb1a6.tar.gz
Merge pull request #2209 from wiredtiger/more-bool-keith
WT-2122 more boolean conversion (cherry picked from commit 91deacba5a77db31216fccfb6bffdbe81375f0b4)
Diffstat (limited to 'src/conn')
-rw-r--r--src/conn/conn_api.c367
-rw-r--r--src/conn/conn_cache.c6
-rw-r--r--src/conn/conn_cache_pool.c41
-rw-r--r--src/conn/conn_ckpt.c8
-rw-r--r--src/conn/conn_dhandle.c57
-rw-r--r--src/conn/conn_log.c22
-rw-r--r--src/conn/conn_open.c2
-rw-r--r--src/conn/conn_stat.c33
-rw-r--r--src/conn/conn_sweep.c12
9 files changed, 277 insertions, 271 deletions
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index 98ff56290be..7188ff8b0b4 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -133,179 +133,6 @@ __wt_collator_config(WT_SESSION_IMPL *session, const char *uri,
}
/*
- * __conn_get_extension_api --
- * WT_CONNECTION.get_extension_api method.
- */
-static WT_EXTENSION_API *
-__conn_get_extension_api(WT_CONNECTION *wt_conn)
-{
- WT_CONNECTION_IMPL *conn;
-
- conn = (WT_CONNECTION_IMPL *)wt_conn;
-
- conn->extension_api.conn = wt_conn;
- conn->extension_api.err_printf = __wt_ext_err_printf;
- conn->extension_api.msg_printf = __wt_ext_msg_printf;
- conn->extension_api.strerror = __wt_ext_strerror;
- conn->extension_api.scr_alloc = __wt_ext_scr_alloc;
- conn->extension_api.scr_free = __wt_ext_scr_free;
- conn->extension_api.collator_config = ext_collator_config;
- conn->extension_api.collate = ext_collate;
- conn->extension_api.config_parser_open = __wt_ext_config_parser_open;
- conn->extension_api.config_get = __wt_ext_config_get;
- conn->extension_api.metadata_insert = __wt_ext_metadata_insert;
- conn->extension_api.metadata_remove = __wt_ext_metadata_remove;
- conn->extension_api.metadata_search = __wt_ext_metadata_search;
- conn->extension_api.metadata_update = __wt_ext_metadata_update;
- conn->extension_api.struct_pack = __wt_ext_struct_pack;
- conn->extension_api.struct_size = __wt_ext_struct_size;
- conn->extension_api.struct_unpack = __wt_ext_struct_unpack;
- conn->extension_api.transaction_id = __wt_ext_transaction_id;
- conn->extension_api.transaction_isolation_level =
- __wt_ext_transaction_isolation_level;
- conn->extension_api.transaction_notify = __wt_ext_transaction_notify;
- conn->extension_api.transaction_oldest = __wt_ext_transaction_oldest;
- conn->extension_api.transaction_visible = __wt_ext_transaction_visible;
- conn->extension_api.version = wiredtiger_version;
-
- return (&conn->extension_api);
-}
-
-#ifdef HAVE_BUILTIN_EXTENSION_SNAPPY
- extern int snappy_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
-#endif
-#ifdef HAVE_BUILTIN_EXTENSION_ZLIB
- extern int zlib_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
-#endif
-#ifdef HAVE_BUILTIN_EXTENSION_LZ4
- extern int lz4_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
-#endif
-
-/*
- * __conn_load_default_extensions --
- * Load extensions that are enabled via --with-builtins
- */
-static int
-__conn_load_default_extensions(WT_CONNECTION_IMPL *conn)
-{
- WT_UNUSED(conn);
-#ifdef HAVE_BUILTIN_EXTENSION_SNAPPY
- WT_RET(snappy_extension_init(&conn->iface, NULL));
-#endif
-#ifdef HAVE_BUILTIN_EXTENSION_ZLIB
- WT_RET(zlib_extension_init(&conn->iface, NULL));
-#endif
-#ifdef HAVE_BUILTIN_EXTENSION_LZ4
- WT_RET(lz4_extension_init(&conn->iface, NULL));
-#endif
- return (0);
-}
-
-/*
- * __conn_load_extension --
- * WT_CONNECTION->load_extension method.
- */
-static int
-__conn_load_extension(
- WT_CONNECTION *wt_conn, const char *path, const char *config)
-{
- WT_CONFIG_ITEM cval;
- WT_CONNECTION_IMPL *conn;
- WT_DECL_RET;
- WT_DLH *dlh;
- WT_SESSION_IMPL *session;
- int (*load)(WT_CONNECTION *, WT_CONFIG_ARG *);
- int is_local;
- const char *init_name, *terminate_name;
-
- dlh = NULL;
- init_name = terminate_name = NULL;
- is_local = (strcmp(path, "local") == 0);
-
- conn = (WT_CONNECTION_IMPL *)wt_conn;
- CONNECTION_API_CALL(conn, session, load_extension, config, cfg);
-
- /*
- * This assumes the underlying shared libraries are reference counted,
- * that is, that re-opening a shared library simply increments a ref
- * count, and closing it simply decrements the ref count, and the last
- * close discards the reference entirely -- in other words, we do not
- * check to see if we've already opened this shared library.
- */
- WT_ERR(__wt_dlopen(session, is_local ? NULL : path, &dlh));
-
- /*
- * Find the load function, remember the unload function for when we
- * close.
- */
- WT_ERR(__wt_config_gets(session, cfg, "entry", &cval));
- WT_ERR(__wt_strndup(session, cval.str, cval.len, &init_name));
- WT_ERR(__wt_dlsym(session, dlh, init_name, 1, &load));
-
- WT_ERR(__wt_config_gets(session, cfg, "terminate", &cval));
- WT_ERR(__wt_strndup(session, cval.str, cval.len, &terminate_name));
- WT_ERR(__wt_dlsym(session, dlh, terminate_name, 0, &dlh->terminate));
-
- /* Call the load function last, it simplifies error handling. */
- WT_ERR(load(wt_conn, (WT_CONFIG_ARG *)cfg));
-
- /* Link onto the environment's list of open libraries. */
- __wt_spin_lock(session, &conn->api_lock);
- TAILQ_INSERT_TAIL(&conn->dlhqh, dlh, q);
- __wt_spin_unlock(session, &conn->api_lock);
- dlh = NULL;
-
-err: if (dlh != NULL)
- WT_TRET(__wt_dlclose(session, dlh));
- __wt_free(session, init_name);
- __wt_free(session, terminate_name);
-
- API_END_RET_NOTFOUND_MAP(session, ret);
-}
-
-/*
- * __conn_load_extensions --
- * Load the list of application-configured extensions.
- */
-static int
-__conn_load_extensions(WT_SESSION_IMPL *session, const char *cfg[])
-{
- WT_CONFIG subconfig;
- WT_CONFIG_ITEM cval, skey, sval;
- WT_CONNECTION_IMPL *conn;
- WT_DECL_ITEM(exconfig);
- WT_DECL_ITEM(expath);
- WT_DECL_RET;
-
- conn = S2C(session);
-
- WT_ERR(__conn_load_default_extensions(conn));
-
- WT_ERR(__wt_config_gets(session, cfg, "extensions", &cval));
- WT_ERR(__wt_config_subinit(session, &subconfig, &cval));
- while ((ret = __wt_config_next(&subconfig, &skey, &sval)) == 0) {
- if (expath == NULL)
- WT_ERR(__wt_scr_alloc(session, 0, &expath));
- WT_ERR(__wt_buf_fmt(
- session, expath, "%.*s", (int)skey.len, skey.str));
- if (sval.len > 0) {
- if (exconfig == NULL)
- WT_ERR(__wt_scr_alloc(session, 0, &exconfig));
- WT_ERR(__wt_buf_fmt(session,
- exconfig, "%.*s", (int)sval.len, sval.str));
- }
- WT_ERR(conn->iface.load_extension(&conn->iface,
- expath->data, (sval.len > 0) ? exconfig->data : NULL));
- }
- WT_ERR_NOTFOUND_OK(ret);
-
-err: __wt_scr_free(session, &expath);
- __wt_scr_free(session, &exconfig);
-
- return (ret);
-}
-
-/*
* __conn_add_collator --
* WT_CONNECTION->add_collator method.
*/
@@ -745,6 +572,179 @@ err: API_END_RET_NOTFOUND_MAP(session, ret);
}
/*
+ * __conn_get_extension_api --
+ * WT_CONNECTION.get_extension_api method.
+ */
+static WT_EXTENSION_API *
+__conn_get_extension_api(WT_CONNECTION *wt_conn)
+{
+ WT_CONNECTION_IMPL *conn;
+
+ conn = (WT_CONNECTION_IMPL *)wt_conn;
+
+ conn->extension_api.conn = wt_conn;
+ conn->extension_api.err_printf = __wt_ext_err_printf;
+ conn->extension_api.msg_printf = __wt_ext_msg_printf;
+ conn->extension_api.strerror = __wt_ext_strerror;
+ conn->extension_api.scr_alloc = __wt_ext_scr_alloc;
+ conn->extension_api.scr_free = __wt_ext_scr_free;
+ conn->extension_api.collator_config = ext_collator_config;
+ conn->extension_api.collate = ext_collate;
+ conn->extension_api.config_parser_open = __wt_ext_config_parser_open;
+ conn->extension_api.config_get = __wt_ext_config_get;
+ conn->extension_api.metadata_insert = __wt_ext_metadata_insert;
+ conn->extension_api.metadata_remove = __wt_ext_metadata_remove;
+ conn->extension_api.metadata_search = __wt_ext_metadata_search;
+ conn->extension_api.metadata_update = __wt_ext_metadata_update;
+ conn->extension_api.struct_pack = __wt_ext_struct_pack;
+ conn->extension_api.struct_size = __wt_ext_struct_size;
+ conn->extension_api.struct_unpack = __wt_ext_struct_unpack;
+ conn->extension_api.transaction_id = __wt_ext_transaction_id;
+ conn->extension_api.transaction_isolation_level =
+ __wt_ext_transaction_isolation_level;
+ conn->extension_api.transaction_notify = __wt_ext_transaction_notify;
+ conn->extension_api.transaction_oldest = __wt_ext_transaction_oldest;
+ conn->extension_api.transaction_visible = __wt_ext_transaction_visible;
+ conn->extension_api.version = wiredtiger_version;
+
+ return (&conn->extension_api);
+}
+
+#ifdef HAVE_BUILTIN_EXTENSION_SNAPPY
+ extern int snappy_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
+#endif
+#ifdef HAVE_BUILTIN_EXTENSION_ZLIB
+ extern int zlib_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
+#endif
+#ifdef HAVE_BUILTIN_EXTENSION_LZ4
+ extern int lz4_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
+#endif
+
+/*
+ * __conn_load_default_extensions --
+ * Load extensions that are enabled via --with-builtins
+ */
+static int
+__conn_load_default_extensions(WT_CONNECTION_IMPL *conn)
+{
+ WT_UNUSED(conn);
+#ifdef HAVE_BUILTIN_EXTENSION_SNAPPY
+ WT_RET(snappy_extension_init(&conn->iface, NULL));
+#endif
+#ifdef HAVE_BUILTIN_EXTENSION_ZLIB
+ WT_RET(zlib_extension_init(&conn->iface, NULL));
+#endif
+#ifdef HAVE_BUILTIN_EXTENSION_LZ4
+ WT_RET(lz4_extension_init(&conn->iface, NULL));
+#endif
+ return (0);
+}
+
+/*
+ * __conn_load_extension --
+ * WT_CONNECTION->load_extension method.
+ */
+static int
+__conn_load_extension(
+ WT_CONNECTION *wt_conn, const char *path, const char *config)
+{
+ WT_CONFIG_ITEM cval;
+ WT_CONNECTION_IMPL *conn;
+ WT_DECL_RET;
+ WT_DLH *dlh;
+ WT_SESSION_IMPL *session;
+ int (*load)(WT_CONNECTION *, WT_CONFIG_ARG *);
+ bool is_local;
+ const char *init_name, *terminate_name;
+
+ dlh = NULL;
+ init_name = terminate_name = NULL;
+ is_local = strcmp(path, "local") == 0;
+
+ conn = (WT_CONNECTION_IMPL *)wt_conn;
+ CONNECTION_API_CALL(conn, session, load_extension, config, cfg);
+
+ /*
+ * This assumes the underlying shared libraries are reference counted,
+ * that is, that re-opening a shared library simply increments a ref
+ * count, and closing it simply decrements the ref count, and the last
+ * close discards the reference entirely -- in other words, we do not
+ * check to see if we've already opened this shared library.
+ */
+ WT_ERR(__wt_dlopen(session, is_local ? NULL : path, &dlh));
+
+ /*
+ * Find the load function, remember the unload function for when we
+ * close.
+ */
+ WT_ERR(__wt_config_gets(session, cfg, "entry", &cval));
+ WT_ERR(__wt_strndup(session, cval.str, cval.len, &init_name));
+ WT_ERR(__wt_dlsym(session, dlh, init_name, 1, &load));
+
+ WT_ERR(__wt_config_gets(session, cfg, "terminate", &cval));
+ WT_ERR(__wt_strndup(session, cval.str, cval.len, &terminate_name));
+ WT_ERR(__wt_dlsym(session, dlh, terminate_name, 0, &dlh->terminate));
+
+ /* Call the load function last, it simplifies error handling. */
+ WT_ERR(load(wt_conn, (WT_CONFIG_ARG *)cfg));
+
+ /* Link onto the environment's list of open libraries. */
+ __wt_spin_lock(session, &conn->api_lock);
+ TAILQ_INSERT_TAIL(&conn->dlhqh, dlh, q);
+ __wt_spin_unlock(session, &conn->api_lock);
+ dlh = NULL;
+
+err: if (dlh != NULL)
+ WT_TRET(__wt_dlclose(session, dlh));
+ __wt_free(session, init_name);
+ __wt_free(session, terminate_name);
+
+ API_END_RET_NOTFOUND_MAP(session, ret);
+}
+
+/*
+ * __conn_load_extensions --
+ * Load the list of application-configured extensions.
+ */
+static int
+__conn_load_extensions(WT_SESSION_IMPL *session, const char *cfg[])
+{
+ WT_CONFIG subconfig;
+ WT_CONFIG_ITEM cval, skey, sval;
+ WT_CONNECTION_IMPL *conn;
+ WT_DECL_ITEM(exconfig);
+ WT_DECL_ITEM(expath);
+ WT_DECL_RET;
+
+ conn = S2C(session);
+
+ WT_ERR(__conn_load_default_extensions(conn));
+
+ WT_ERR(__wt_config_gets(session, cfg, "extensions", &cval));
+ WT_ERR(__wt_config_subinit(session, &subconfig, &cval));
+ while ((ret = __wt_config_next(&subconfig, &skey, &sval)) == 0) {
+ if (expath == NULL)
+ WT_ERR(__wt_scr_alloc(session, 0, &expath));
+ WT_ERR(__wt_buf_fmt(
+ session, expath, "%.*s", (int)skey.len, skey.str));
+ if (sval.len > 0) {
+ if (exconfig == NULL)
+ WT_ERR(__wt_scr_alloc(session, 0, &exconfig));
+ WT_ERR(__wt_buf_fmt(session,
+ exconfig, "%.*s", (int)sval.len, sval.str));
+ }
+ WT_ERR(conn->iface.load_extension(&conn->iface,
+ expath->data, (sval.len > 0) ? exconfig->data : NULL));
+ }
+ WT_ERR_NOTFOUND_OK(ret);
+
+err: __wt_scr_free(session, &expath);
+ __wt_scr_free(session, &exconfig);
+
+ return (ret);
+}
+
+/*
* __conn_get_home --
* WT_CONNECTION.get_home method.
*/
@@ -876,7 +876,7 @@ __conn_reconfigure(WT_CONNECTION *wt_conn, const char *config)
WT_ERR(__conn_statistics_config(session, config_cfg));
WT_ERR(__wt_async_reconfig(session, config_cfg));
- WT_ERR(__wt_cache_config(session, 1, config_cfg));
+ WT_ERR(__wt_cache_config(session, true, config_cfg));
WT_ERR(__wt_checkpoint_server_create(session, config_cfg));
WT_ERR(__wt_lsm_manager_reconfig(session, config_cfg));
WT_ERR(__wt_statlog_create(session, config_cfg));
@@ -967,13 +967,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;
@@ -984,7 +984,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;
@@ -1021,7 +1021,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
@@ -1257,7 +1257,8 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[])
* isn't simple to detect that case, and there's no risk other than a
* useless file being left in the directory.)
*/
- WT_ERR(__wt_open(session, WT_SINGLETHREAD, 1, 0, 0, &conn->lock_fh));
+ WT_ERR(__wt_open(
+ session, WT_SINGLETHREAD, true, false, 0, &conn->lock_fh));
/*
* Lock a byte of the file: if we don't get the lock, some other process
@@ -1285,7 +1286,7 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[])
/* We own the lock file, optionally create the WiredTiger file. */
WT_ERR(__wt_config_gets(session, cfg, "create", &cval));
WT_ERR(__wt_open(session,
- WT_WIREDTIGER, cval.val == 0 ? 0 : 1, 0, 0, &fh));
+ WT_WIREDTIGER, cval.val != 0, false, 0, &fh));
/*
* Lock the WiredTiger file (for backward compatibility reasons as
@@ -1466,7 +1467,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;
fp = NULL;
@@ -1669,9 +1670,9 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
*/
cfg[0] = WT_CONFIG_BASE(session, wiredtiger_open_all);
cfg[1] = NULL;
- 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 8de8cd3f8bc..e00466d6bc5 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;
@@ -73,7 +73,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;
@@ -134,7 +134,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 488864ce351..c0656004df2 100644
--- a/src/conn/conn_cache_pool.c
+++ b/src/conn/conn_cache_pool.c
@@ -20,7 +20,8 @@
/* Balancing passes after a reduction before a connection is a candidate. */
#define WT_CACHE_POOL_REDUCE_SKIPS 5
-static int __cache_pool_adjust(WT_SESSION_IMPL *, uint64_t, uint64_t, int *);
+static int __cache_pool_adjust(
+ WT_SESSION_IMPL *, uint64_t, uint64_t, bool *);
static int __cache_pool_assess(WT_SESSION_IMPL *, uint64_t *);
static int __cache_pool_balance(WT_SESSION_IMPL *);
@@ -36,17 +37,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, 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));
@@ -84,7 +85,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);
@@ -274,21 +275,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;
}
@@ -311,7 +312,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));
@@ -326,7 +327,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;
}
/*
@@ -358,7 +359,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);
@@ -392,8 +393,8 @@ __cache_pool_balance(WT_SESSION_IMPL *session)
{
WT_CACHE_POOL *cp;
WT_DECL_RET;
- int adjusted;
uint64_t bump_threshold, highest;
+ bool adjusted;
cp = __wt_process.cache_pool;
adjusted = 0;
@@ -482,18 +483,18 @@ __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 *adjustedp)
+ uint64_t highest, uint64_t bump_threshold, bool *adjustedp)
{
WT_CACHE_POOL *cp;
WT_CACHE *cache;
WT_CONNECTION_IMPL *entry;
uint64_t adjusted, reserved, read_pressure;
- int force, grew;
+ bool force, grew;
- *adjustedp = 0;
+ *adjustedp = false;
cp = __wt_process.cache_pool;
force = (cp->currently_used > cp->size);
- grew = 0;
+ grew = false;
if (WT_VERBOSE_ISSET(session, WT_VERB_SHARED_CACHE)) {
WT_RET(__wt_verbose(session,
WT_VERB_SHARED_CACHE, "Cache pool distribution: "));
@@ -521,7 +522,7 @@ __cache_pool_adjust(WT_SESSION_IMPL *session,
* - The reserved size has been adjusted
*/
if (entry->cache_size < reserved) {
- grew = 1;
+ grew = true;
adjusted = reserved - entry->cache_size;
/*
* Conditions for reducing the amount of resources for an
@@ -537,7 +538,7 @@ __cache_pool_adjust(WT_SESSION_IMPL *session,
(read_pressure < WT_CACHE_POOL_REDUCE_THRESHOLD &&
highest > 1 && entry->cache_size > reserved &&
cp->currently_used >= cp->size)) {
- grew = 0;
+ grew = false;
/*
* Shrink by a chunk size if that doesn't drop us
* below the reserved size.
@@ -561,7 +562,7 @@ __cache_pool_adjust(WT_SESSION_IMPL *session,
(entry->cache_size * cache->eviction_target) / 100 &&
cp->currently_used < cp->size &&
read_pressure > bump_threshold) {
- grew = 1;
+ grew = true;
adjusted = WT_MIN(cp->chunk,
cp->size - cp->currently_used);
}
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 54cc1308537..f68004bbe03 100644
--- a/src/conn/conn_dhandle.c
+++ b/src/conn/conn_dhandle.c
@@ -140,7 +140,7 @@ __wt_conn_dhandle_find(WT_SESSION_IMPL *session,
conn = S2C(session);
/* We must be holding the handle list lock at a higher level. */
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED) &&
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST) &&
!LF_ISSET(WT_DHANDLE_HAVE_REF));
/* Increment the reference count if we already have the btree open. */
@@ -229,7 +229,7 @@ __conn_dhandle_get(WT_SESSION_IMPL *session,
* need new files again soon, until they are cached by all sessions.
* Find the right hash bucket to insert into as well.
*/
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
bucket = dhandle->name_hash % WT_HASH_ARRAY_SIZE;
WT_CONN_DHANDLE_INSERT(conn, dhandle, bucket);
@@ -253,9 +253,9 @@ err: WT_TRET(__wt_rwlock_destroy(session, &dhandle->rwlock));
static int
__conn_dhandle_mark_dead(WT_SESSION_IMPL *session)
{
- int evict_reset;
+ bool evict_reset;
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
/*
* Handle forced discard (e.g., when dropping a file).
@@ -275,12 +275,12 @@ __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 no_schema_lock;
+ bool no_schema_lock;
dhandle = session->dhandle;
btree = S2BT(session);
@@ -295,9 +295,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;
- if (!F_ISSET(session, WT_SESSION_SCHEMA_LOCKED)) {
- no_schema_lock = 1;
+ no_schema_lock = false;
+ if (!F_ISSET(session, WT_SESSION_LOCKED_SCHEMA)) {
+ no_schema_lock = true;
F_SET(session, WT_SESSION_NO_SCHEMA_LOCK);
}
@@ -420,7 +420,7 @@ __conn_btree_open(WT_SESSION_IMPL *session, const char *cfg[], uint32_t flags)
dhandle = session->dhandle;
btree = S2BT(session);
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_SCHEMA_LOCKED) &&
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SCHEMA) &&
F_ISSET(dhandle, WT_DHANDLE_EXCLUSIVE) &&
!LF_ISSET(WT_DHANDLE_LOCK_ONLY));
@@ -441,7 +441,7 @@ __conn_btree_open(WT_SESSION_IMPL *session, const char *cfg[], uint32_t flags)
* 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);
@@ -494,7 +494,7 @@ __wt_conn_btree_get(WT_SESSION_IMPL *session,
WT_RET(
__conn_dhandle_open_lock(session, session->dhandle, flags));
else {
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __conn_dhandle_get(session, name, ckpt, flags));
WT_RET(ret);
}
@@ -551,7 +551,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;
@@ -560,7 +560,7 @@ __wt_conn_btree_apply(WT_SESSION_IMPL *session,
conn = S2C(session);
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
/*
* If we're given a URI, then we walk only the hash list for that
@@ -650,7 +650,7 @@ __wt_conn_btree_apply_single(WT_SESSION_IMPL *session,
conn = S2C(session);
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
hash = __wt_hash_city64(uri, strlen(uri));
bucket = hash % WT_HASH_ARRAY_SIZE;
@@ -690,7 +690,7 @@ __wt_conn_btree_apply_single(WT_SESSION_IMPL *session,
*/
int
__wt_conn_dhandle_close_all(
- WT_SESSION_IMPL *session, const char *name, int force)
+ WT_SESSION_IMPL *session, const char *uri, bool force)
{
WT_CONNECTION_IMPL *conn;
WT_DATA_HANDLE *dhandle;
@@ -699,12 +699,12 @@ __wt_conn_dhandle_close_all(
conn = S2C(session);
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
WT_ASSERT(session, session->dhandle == NULL);
- bucket = __wt_hash_city64(name, strlen(name)) % WT_HASH_ARRAY_SIZE;
+ bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE;
TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) {
- if (strcmp(dhandle->name, name) != 0 ||
+ if (strcmp(dhandle->name, uri) != 0 ||
F_ISSET(dhandle, WT_DHANDLE_DEAD))
continue;
@@ -724,7 +724,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.
@@ -750,7 +750,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;
@@ -760,7 +760,7 @@ __conn_dhandle_remove(WT_SESSION_IMPL *session, int final)
dhandle = session->dhandle;
bucket = dhandle->name_hash % WT_HASH_ARRAY_SIZE;
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
WT_ASSERT(session, dhandle != conn->cache->evict_file_next);
/* Check if the handle was reacquired by a session while we waited. */
@@ -778,7 +778,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;
@@ -801,11 +802,11 @@ __wt_conn_dhandle_discard_single(WT_SESSION_IMPL *session, int final, int force)
* Kludge: interrupt the eviction server in case it is holding the
* handle list lock.
*/
- if (!F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED))
+ if (!F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST))
F_SET(S2C(session)->cache, WT_CACHE_CLEAR_WALKS);
/* Try to remove the handle, protected by the data handle lock. */
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
WT_TRET(__conn_dhandle_remove(session, final)));
/*
@@ -852,7 +853,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;
}
@@ -868,7 +870,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 65e0f684382..f9c26a86b92 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));
@@ -281,12 +281,12 @@ __log_file_server(void *arg)
WT_LOG *log;
WT_LSN close_end_lsn, close_lsn;
WT_SESSION_IMPL *session;
- 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
@@ -314,13 +314,13 @@ __log_file_server(void *arg)
close_end_lsn.file++;
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,
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);
} else
/* Wait until the next event. */
@@ -466,12 +466,12 @@ __log_server(void *arg)
WT_DECL_RET;
WT_LOG *log;
WT_SESSION_IMPL *session;
- u_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)) {
/*
* Perform log pre-allocation.
@@ -485,11 +485,11 @@ __log_server(void *arg)
if (FLD_ISSET(conn->log_flags, WT_CONN_LOG_ARCHIVE)) {
if (__wt_try_writelock(
session, log->log_archive_lock) == 0) {
- locked = 1;
+ locked = true;
WT_ERR(__log_archive_once(session, 0));
WT_ERR( __wt_writeunlock(
session, log->log_archive_lock));
- locked = 0;
+ locked = false;
} else
WT_ERR(__wt_verbose(session, WT_VERB_LOG,
"log_archive: Blocked due to open log "
@@ -516,7 +516,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 a140a06628d..1f34da7e7c5 100644
--- a/src/conn/conn_open.c
+++ b/src/conn/conn_open.c
@@ -114,7 +114,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_sweep_destroy(session));
WT_TRET(__wt_evict_destroy(session));
diff --git a/src/conn/conn_stat.c b/src/conn/conn_stat.c
index 07ebfacface..9668b906686 100644
--- a/src/conn/conn_stat.c
+++ b/src/conn/conn_stat.c
@@ -56,7 +56,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;
@@ -70,7 +70,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(
@@ -82,7 +82,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));
@@ -133,7 +133,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;
@@ -207,8 +207,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);
@@ -227,7 +227,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;
@@ -247,7 +248,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;
@@ -259,11 +260,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]);
}
@@ -318,7 +319,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));
#if SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_LOGGING
/* Dump the spinlock statistics. */
@@ -330,9 +331,9 @@ __statlog_log_one(WT_SESSION_IMPL *session, WT_ITEM *path, WT_ITEM *tmp)
* any that match the list of object sources.
*/
if (conn->stat_sources != NULL) {
- WT_WITH_DHANDLE_LOCK(session, ret =
+ 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);
}
@@ -473,7 +474,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;
@@ -484,7 +485,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)
@@ -498,7 +499,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 061d70221c7..c220d1cf604 100644
--- a/src/conn/conn_sweep.c
+++ b/src/conn/conn_sweep.c
@@ -64,7 +64,7 @@ __sweep_expire_one(WT_SESSION_IMPL *session)
WT_BTREE *btree;
WT_DATA_HANDLE *dhandle;
WT_DECL_RET;
- int evict_reset;
+ bool evict_reset;
btree = S2BT(session);
dhandle = session->dhandle;
@@ -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);
@@ -139,7 +139,7 @@ __sweep_expire(WT_SESSION_IMPL *session, time_t now)
now <= dhandle->timeofdeath + conn->sweep_idle_time)
continue;
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
WT_WITH_DHANDLE(session, dhandle,
ret = __sweep_expire_one(session)));
WT_RET_BUSY_OK(ret);
@@ -173,7 +173,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) {
@@ -208,7 +208,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
@@ -243,7 +243,7 @@ __sweep_remove_handles(WT_SESSION_IMPL *session)
if (!WT_DHANDLE_CAN_DISCARD(dhandle))
continue;
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __sweep_remove_one(session, dhandle));
if (ret == 0)
WT_STAT_FAST_CONN_INCR(session, dh_sweep_remove);