summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-10-01 16:14:10 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-10-01 16:14:10 +1000
commit180db3d2ca3191d1257800d9efb759fbc2e889e8 (patch)
treea713793f0df34ea4d55466401ee4187be6ec5554
parent59ae30a629db3ecb675037dc63e06cd4fcae4aaa (diff)
downloadmongo-180db3d2ca3191d1257800d9efb759fbc2e889e8.tar.gz
Import wiredtiger-wiredtiger-mongodb-3.0.6-28-g0e0d19d.tar.gz from wiredtiger branch mongodb-3.0
-rw-r--r--src/third_party/wiredtiger/dist/flags.py6
-rw-r--r--src/third_party/wiredtiger/dist/log.py3
-rw-r--r--src/third_party/wiredtiger/dist/s_define.list11
-rw-r--r--src/third_party/wiredtiger/src/async/async_api.c23
-rw-r--r--src/third_party/wiredtiger/src/block/block_addr.c4
-rw-r--r--src/third_party/wiredtiger/src/block/block_ckpt.c50
-rw-r--r--src/third_party/wiredtiger/src/block/block_compact.c18
-rw-r--r--src/third_party/wiredtiger/src/block/block_ext.c49
-rw-r--r--src/third_party/wiredtiger/src/block/block_mgr.c42
-rw-r--r--src/third_party/wiredtiger/src/block/block_open.c19
-rw-r--r--src/third_party/wiredtiger/src/block/block_read.c4
-rw-r--r--src/third_party/wiredtiger/src/block/block_slvg.c18
-rw-r--r--src/third_party/wiredtiger/src/block/block_vrfy.c30
-rw-r--r--src/third_party/wiredtiger/src/block/block_write.c22
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_compact.c22
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_curnext.c24
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_curprev.c22
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_cursor.c174
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_debug.c28
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_delete.c16
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_discard.c8
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_handle.c48
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_huffman.c4
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_io.c19
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_ovfl.c14
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_page.c11
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_read.c2
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_ret.c2
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_slvg.c72
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_split.c257
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_stat.c8
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_sync.c12
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_vrfy.c33
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c19
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_walk.c10
-rw-r--r--src/third_party/wiredtiger/src/btree/col_modify.c12
-rw-r--r--src/third_party/wiredtiger/src/btree/row_key.c6
-rw-r--r--src/third_party/wiredtiger/src/btree/row_modify.c10
-rw-r--r--src/third_party/wiredtiger/src/btree/row_srch.c21
-rw-r--r--src/third_party/wiredtiger/src/config/config.c22
-rw-r--r--src/third_party/wiredtiger/src/config/config_check.c26
-rw-r--r--src/third_party/wiredtiger/src/config/config_collapse.c2
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_api.c379
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_cache.c12
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_cache_pool.c47
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_ckpt.c22
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_dhandle.c63
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_handle.c2
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_log.c86
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_open.c9
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_stat.c49
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_sweep.c18
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_backup.c56
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_bulk.c8
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_dump.c27
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_file.c15
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_index.c6
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_json.c85
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_stat.c16
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_std.c22
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_table.c22
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_file.c6
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_lru.c87
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_page.c75
-rw-r--r--src/third_party/wiredtiger/src/include/api.h22
-rw-r--r--src/third_party/wiredtiger/src/include/bitstring.i4
-rw-r--r--src/third_party/wiredtiger/src/include/block.h26
-rw-r--r--src/third_party/wiredtiger/src/include/btmem.h13
-rw-r--r--src/third_party/wiredtiger/src/include/btree.h8
-rw-r--r--src/third_party/wiredtiger/src/include/btree.i202
-rw-r--r--src/third_party/wiredtiger/src/include/cache.i6
-rw-r--r--src/third_party/wiredtiger/src/include/cell.i11
-rw-r--r--src/third_party/wiredtiger/src/include/connection.h18
-rw-r--r--src/third_party/wiredtiger/src/include/cursor.h10
-rw-r--r--src/third_party/wiredtiger/src/include/cursor.i6
-rw-r--r--src/third_party/wiredtiger/src/include/extern.h180
-rw-r--r--src/third_party/wiredtiger/src/include/flags.h24
-rw-r--r--src/third_party/wiredtiger/src/include/gcc.h4
-rw-r--r--src/third_party/wiredtiger/src/include/lint.h12
-rw-r--r--src/third_party/wiredtiger/src/include/misc.h26
-rw-r--r--src/third_party/wiredtiger/src/include/misc.i2
-rw-r--r--src/third_party/wiredtiger/src/include/msvc.h4
-rw-r--r--src/third_party/wiredtiger/src/include/os.h4
-rw-r--r--src/third_party/wiredtiger/src/include/packing.i4
-rw-r--r--src/third_party/wiredtiger/src/include/schema.h88
-rw-r--r--src/third_party/wiredtiger/src/include/serial.i6
-rw-r--r--src/third_party/wiredtiger/src/include/session.h2
-rw-r--r--src/third_party/wiredtiger/src/include/txn.h18
-rw-r--r--src/third_party/wiredtiger/src/include/txn.i70
-rw-r--r--src/third_party/wiredtiger/src/include/wiredtiger.in7
-rw-r--r--src/third_party/wiredtiger/src/include/wt_internal.h4
-rw-r--r--src/third_party/wiredtiger/src/log/log.c98
-rw-r--r--src/third_party/wiredtiger/src/log/log_auto.c3
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_cursor.c130
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_manager.c16
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_merge.c27
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_meta.c6
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_stat.c10
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_tree.c139
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_work_unit.c33
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_worker.c16
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_apply.c4
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_table.c10
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_track.c10
-rw-r--r--src/third_party/wiredtiger/src/meta/meta_turtle.c16
-rw-r--r--src/third_party/wiredtiger/src/os_posix/os_dir.c6
-rw-r--r--src/third_party/wiredtiger/src/os_posix/os_dlopen.c2
-rw-r--r--src/third_party/wiredtiger/src/os_posix/os_exist.c6
-rw-r--r--src/third_party/wiredtiger/src/os_posix/os_fallocate.c12
-rw-r--r--src/third_party/wiredtiger/src/os_posix/os_flock.c2
-rw-r--r--src/third_party/wiredtiger/src/os_posix/os_mtx_cond.c14
-rw-r--r--src/third_party/wiredtiger/src/os_posix/os_open.c17
-rw-r--r--src/third_party/wiredtiger/src/os_posix/os_path.c4
-rw-r--r--src/third_party/wiredtiger/src/os_posix/os_priv.c2
-rw-r--r--src/third_party/wiredtiger/src/os_win/os_dir.c6
-rw-r--r--src/third_party/wiredtiger/src/os_win/os_dlopen.c2
-rw-r--r--src/third_party/wiredtiger/src/os_win/os_exist.c6
-rw-r--r--src/third_party/wiredtiger/src/os_win/os_fallocate.c2
-rw-r--r--src/third_party/wiredtiger/src/os_win/os_flock.c2
-rw-r--r--src/third_party/wiredtiger/src/os_win/os_mtx_cond.c14
-rw-r--r--src/third_party/wiredtiger/src/os_win/os_open.c17
-rw-r--r--src/third_party/wiredtiger/src/os_win/os_path.c4
-rw-r--r--src/third_party/wiredtiger/src/os_win/os_priv.c2
-rw-r--r--src/third_party/wiredtiger/src/packing/pack_impl.c2
-rw-r--r--src/third_party/wiredtiger/src/reconcile/rec_track.c4
-rw-r--r--src/third_party/wiredtiger/src/reconcile/rec_write.c646
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_create.c38
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_drop.c30
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_list.c4
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_open.c34
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_plan.c32
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_project.c9
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_rename.c12
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_stat.c7
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_truncate.c7
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_worker.c22
-rw-r--r--src/third_party/wiredtiger/src/session/session_api.c27
-rw-r--r--src/third_party/wiredtiger/src/session/session_compact.c9
-rw-r--r--src/third_party/wiredtiger/src/session/session_dhandle.c37
-rw-r--r--src/third_party/wiredtiger/src/support/err.c19
-rw-r--r--src/third_party/wiredtiger/src/support/filename.c2
-rw-r--r--src/third_party/wiredtiger/src/support/global.c8
-rw-r--r--src/third_party/wiredtiger/src/support/hazard.c12
-rw-r--r--src/third_party/wiredtiger/src/support/pow.c2
-rw-r--r--src/third_party/wiredtiger/src/support/scratch.c6
-rw-r--r--src/third_party/wiredtiger/src/txn/txn.c46
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_ckpt.c97
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_log.c31
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_nsnap.c22
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_recover.c29
-rw-r--r--src/third_party/wiredtiger/src/utilities/util.h4
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_backup.c4
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_dump.c48
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_list.c17
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_load.c52
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_load_json.c31
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_loadtext.c19
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_main.c12
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_misc.c6
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_printlog.c7
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_read.c11
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_stat.c7
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_verify.c13
-rw-r--r--src/third_party/wiredtiger/src/utilities/util_write.c11
164 files changed, 2702 insertions, 2468 deletions
diff --git a/src/third_party/wiredtiger/dist/flags.py b/src/third_party/wiredtiger/dist/flags.py
index b8d9e5db469..394154fcb75 100644
--- a/src/third_party/wiredtiger/dist/flags.py
+++ b/src/third_party/wiredtiger/dist/flags.py
@@ -106,8 +106,10 @@ flags = {
'SESSION_CAN_WAIT',
'SESSION_CLEAR_EVICT_WALK',
'SESSION_DISCARD_FORCE',
- 'SESSION_HANDLE_LIST_LOCKED',
'SESSION_INTERNAL',
+ 'SESSION_LOCKED_HANDLE_LIST',
+ 'SESSION_LOCKED_SCHEMA',
+ 'SESSION_LOCKED_TABLE',
'SESSION_LOGGING_INMEM',
'SESSION_NO_CACHE',
'SESSION_NO_CACHE_CHECK',
@@ -115,9 +117,7 @@ flags = {
'SESSION_NO_LOGGING',
'SESSION_NO_SCHEMA_LOCK',
'SESSION_SALVAGE_CORRUPT_OK',
- 'SESSION_SCHEMA_LOCKED',
'SESSION_SERVER_ASYNC',
- 'SESSION_TABLE_LOCKED',
],
}
diff --git a/src/third_party/wiredtiger/dist/log.py b/src/third_party/wiredtiger/dist/log.py
index abe72cea5c4..0ca2067bca2 100644
--- a/src/third_party/wiredtiger/dist/log.py
+++ b/src/third_party/wiredtiger/dist/log.py
@@ -159,7 +159,8 @@ __logrec_json_unpack_str(char *dest, size_t destlen, const char *src,
\ttotal = 0;
\twhile (srclen > 0) {
-\t\tn = __wt_json_unpack_char(*src++, (u_char *)dest, destlen, 0);
+\t\tn = __wt_json_unpack_char(
+\t\t *src++, (u_char *)dest, destlen, false);
\t\tsrclen--;
\t\tif (n > destlen)
\t\t\tdestlen = 0;
diff --git a/src/third_party/wiredtiger/dist/s_define.list b/src/third_party/wiredtiger/dist/s_define.list
index 65fc60e9c7a..1ad29fe21ba 100644
--- a/src/third_party/wiredtiger/dist/s_define.list
+++ b/src/third_party/wiredtiger/dist/s_define.list
@@ -3,23 +3,17 @@ ALIGN_CHECK
API_CALL
API_CALL_NOCONF
API_SESSION_INIT
-FLD_CLR
-F_CAS_ATOMIC
-F_CLR_ATOMIC
-F_SET_ATOMIC
-LF_CLR
-LF_SET
+FLD_MASK
+LF_MASK
LLONG_MAX
LLONG_MIN
SIZE_CHECK
-TXNID_LE
TXN_API_CALL
TXN_API_CALL_NOCONF
TXN_API_END
WIN32_LEAN_AND_MEAN
WT_ATOMIC_CAS
WT_ATOMIC_FUNC
-WT_BARRIER
WT_BLOCK_DESC_SIZE
WT_CACHE_LINE_ALIGNMENT
WT_COMPILER_TYPE_ALIGN
@@ -37,6 +31,7 @@ WT_STAT_ATOMIC_DECR
WT_STAT_ATOMIC_DECRV
WT_STAT_ATOMIC_INCR
WT_STAT_ATOMIC_INCRV
+WT_SESSION_LOCKED_CHECKPOINT
WT_STAT_DECR
WT_STAT_DECRV
WT_STAT_FAST_ATOMIC_DECR
diff --git a/src/third_party/wiredtiger/src/async/async_api.c b/src/third_party/wiredtiger/src/async/async_api.c
index cd232af5340..6ce4288d04b 100644
--- a/src/third_party/wiredtiger/src/async/async_api.c
+++ b/src/third_party/wiredtiger/src/async/async_api.c
@@ -52,8 +52,8 @@ __async_get_format(WT_CONNECTION_IMPL *conn, const char *uri,
* Insert it at the head expecting LRU usage. We need a real session
* for the cursor.
*/
- WT_RET(
- __wt_open_internal_session(conn, "async-cursor", 1, 1, &session));
+ WT_RET(__wt_open_internal_session(
+ conn, "async-cursor", true, true, &session));
__wt_spin_lock(session, &async->ops_lock);
WT_ERR(__wt_calloc_one(session, &af));
WT_ERR(__wt_strdup(session, uri, &af->uri));
@@ -171,7 +171,7 @@ retry:
*/
static int
__async_config(WT_SESSION_IMPL *session,
- WT_CONNECTION_IMPL *conn, const char **cfg, int *runp)
+ WT_CONNECTION_IMPL *conn, const char **cfg, bool *runp)
{
WT_CONFIG_ITEM cval;
@@ -240,7 +240,8 @@ __async_start(WT_SESSION_IMPL *session)
async = conn->async;
TAILQ_INIT(&async->formatqh);
WT_RET(__wt_spin_init(session, &async->ops_lock, "ops"));
- WT_RET(__wt_cond_alloc(session, "async flush", 0, &async->flush_cond));
+ WT_RET(__wt_cond_alloc(
+ session, "async flush", false, &async->flush_cond));
WT_RET(__wt_async_op_init(session));
/*
@@ -255,8 +256,8 @@ __async_start(WT_SESSION_IMPL *session)
* workers and we may want to selectively stop some workers
* while leaving the rest running.
*/
- WT_RET(__wt_open_internal_session(
- conn, "async-worker", 1, 1, &async->worker_sessions[i]));
+ WT_RET(__wt_open_internal_session(conn,
+ "async-worker", true, true, &async->worker_sessions[i]));
F_SET(async->worker_sessions[i], WT_SESSION_SERVER_ASYNC);
}
for (i = 0; i < conn->async_workers; i++) {
@@ -278,12 +279,12 @@ int
__wt_async_create(WT_SESSION_IMPL *session, const char *cfg[])
{
WT_CONNECTION_IMPL *conn;
- int run;
+ bool run;
conn = S2C(session);
/* Handle configuration. */
- run = 0;
+ run = false;
WT_RET(__async_config(session, conn, cfg, &run));
/* If async is not configured, we're done. */
@@ -303,7 +304,7 @@ __wt_async_reconfig(WT_SESSION_IMPL *session, const char *cfg[])
WT_CONNECTION_IMPL *conn, tmp_conn;
WT_DECL_RET;
WT_SESSION *wt_session;
- int run;
+ bool run;
uint32_t i;
conn = S2C(session);
@@ -370,8 +371,8 @@ __wt_async_reconfig(WT_SESSION_IMPL *session, const char *cfg[])
/*
* Each worker has its own session.
*/
- WT_RET(__wt_open_internal_session(conn,
- "async-worker", 1, 1, &async->worker_sessions[i]));
+ WT_RET(__wt_open_internal_session(conn, "async-worker",
+ true, true, &async->worker_sessions[i]));
F_SET(async->worker_sessions[i],
WT_SESSION_SERVER_ASYNC);
}
diff --git a/src/third_party/wiredtiger/src/block/block_addr.c b/src/third_party/wiredtiger/src/block/block_addr.c
index 6b5610eb17c..ff41ccd87f8 100644
--- a/src/third_party/wiredtiger/src/block/block_addr.c
+++ b/src/third_party/wiredtiger/src/block/block_addr.c
@@ -35,7 +35,7 @@ __block_buffer_to_addr(WT_BLOCK *block,
* can be invalid offsets, that's simpler than testing sizes of 0 all
* over the place.
*/
- if (s == 0) {
+ if (s == 0) {
*offsetp = 0;
*sizep = *cksump = 0;
} else {
@@ -89,7 +89,7 @@ __wt_block_buffer_to_addr(WT_BLOCK *block,
*/
int
__wt_block_addr_valid(WT_SESSION_IMPL *session,
- WT_BLOCK *block, const uint8_t *addr, size_t addr_size, int live)
+ WT_BLOCK *block, const uint8_t *addr, size_t addr_size, bool live)
{
wt_off_t offset;
uint32_t cksum, size;
diff --git a/src/third_party/wiredtiger/src/block/block_ckpt.c b/src/third_party/wiredtiger/src/block/block_ckpt.c
index 40bba8184a1..8ff69bbf69e 100644
--- a/src/third_party/wiredtiger/src/block/block_ckpt.c
+++ b/src/third_party/wiredtiger/src/block/block_ckpt.c
@@ -12,7 +12,7 @@ static int __ckpt_process(WT_SESSION_IMPL *, WT_BLOCK *, WT_CKPT *);
static int __ckpt_string(
WT_SESSION_IMPL *, WT_BLOCK *, const uint8_t *, WT_ITEM *);
static int __ckpt_update(
- WT_SESSION_IMPL *, WT_BLOCK *, WT_CKPT *, WT_BLOCK_CKPT *, int);
+ WT_SESSION_IMPL *, WT_BLOCK *, WT_CKPT *, WT_BLOCK_CKPT *, bool);
/*
* __wt_block_ckpt_init --
@@ -27,12 +27,14 @@ __wt_block_ckpt_init(
ci->version = WT_BM_CHECKPOINT_VERSION;
ci->root_offset = WT_BLOCK_INVALID_OFFSET;
- WT_RET(__wt_block_extlist_init(session, &ci->alloc, name, "alloc", 0));
- WT_RET(__wt_block_extlist_init(session, &ci->avail, name, "avail", 1));
WT_RET(__wt_block_extlist_init(
- session, &ci->discard, name, "discard", 0));
+ session, &ci->alloc, name, "alloc", false));
WT_RET(__wt_block_extlist_init(
- session, &ci->ckpt_avail, name, "ckpt_avail", 1));
+ session, &ci->avail, name, "avail", true));
+ WT_RET(__wt_block_extlist_init(
+ session, &ci->discard, name, "discard", false));
+ WT_RET(__wt_block_extlist_init(
+ session, &ci->ckpt_avail, name, "ckpt_avail", true));
return (0);
}
@@ -44,7 +46,7 @@ __wt_block_ckpt_init(
int
__wt_block_checkpoint_load(WT_SESSION_IMPL *session, WT_BLOCK *block,
const uint8_t *addr, size_t addr_size,
- uint8_t *root_addr, size_t *root_addr_sizep, int checkpoint)
+ uint8_t *root_addr, size_t *root_addr_sizep, bool checkpoint)
{
WT_BLOCK_CKPT *ci, _ci;
WT_DECL_ITEM(tmp);
@@ -165,7 +167,7 @@ err: /*
*/
int
__wt_block_checkpoint_unload(
- WT_SESSION_IMPL *session, WT_BLOCK *block, int checkpoint)
+ WT_SESSION_IMPL *session, WT_BLOCK *block, bool checkpoint)
{
WT_DECL_RET;
@@ -217,7 +219,7 @@ __wt_block_ckpt_destroy(WT_SESSION_IMPL *session, WT_BLOCK_CKPT *ci)
*/
int
__wt_block_checkpoint(WT_SESSION_IMPL *session,
- WT_BLOCK *block, WT_ITEM *buf, WT_CKPT *ckptbase, int data_cksum)
+ WT_BLOCK *block, WT_ITEM *buf, WT_CKPT *ckptbase, bool data_cksum)
{
WT_BLOCK_CKPT *ci;
WT_DECL_RET;
@@ -225,7 +227,7 @@ __wt_block_checkpoint(WT_SESSION_IMPL *session,
ci = &block->live;
/* Switch to first-fit allocation. */
- __wt_block_configure_first_fit(block, 1);
+ __wt_block_configure_first_fit(block, true);
/*
* Write the root page: it's possible for there to be a checkpoint of
@@ -242,7 +244,7 @@ __wt_block_checkpoint(WT_SESSION_IMPL *session,
} else
WT_ERR(__wt_block_write_off(session, block, buf,
&ci->root_offset, &ci->root_size, &ci->root_cksum,
- data_cksum, 0));
+ data_cksum, false));
/*
* Checkpoints are potentially reading/writing/merging lots of blocks,
@@ -257,7 +259,7 @@ __wt_block_checkpoint(WT_SESSION_IMPL *session,
WT_TRET(__wt_block_ext_discard(session, 250));
/* Restore the original allocation plan. */
-err: __wt_block_configure_first_fit(block, 0);
+err: __wt_block_configure_first_fit(block, false);
return (ret);
}
@@ -363,10 +365,10 @@ __ckpt_process(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase)
WT_DECL_ITEM(tmp);
WT_DECL_RET;
uint64_t ckpt_size;
- int deleting, locked;
+ bool deleting, locked;
ci = &block->live;
- locked = 0;
+ locked = false;
#ifdef HAVE_DIAGNOSTIC
WT_RET(__ckpt_verify(session, ckptbase));
@@ -426,7 +428,7 @@ __ckpt_process(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase)
*/
__wt_block_extlist_free(session, &ci->ckpt_avail);
WT_RET(__wt_block_extlist_init(
- session, &ci->ckpt_avail, "live", "ckpt_avail", 1));
+ session, &ci->ckpt_avail, "live", "ckpt_avail", true));
__wt_block_extlist_free(session, &ci->ckpt_alloc);
__wt_block_extlist_free(session, &ci->ckpt_discard);
@@ -435,12 +437,12 @@ __ckpt_process(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase)
* the subsequent checkpoint into which it gets rolled; read them from
* disk before we lock things down.
*/
- deleting = 0;
+ deleting = false;
WT_CKPT_FOREACH(ckptbase, ckpt) {
if (F_ISSET(ckpt, WT_CKPT_FAKE) ||
!F_ISSET(ckpt, WT_CKPT_DELETE))
continue;
- deleting = 1;
+ deleting = true;
/*
* Read the checkpoint and next checkpoint extent lists if we
@@ -472,7 +474,7 @@ __ckpt_process(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase)
* the final merge of ranges into the live tree.
*/
__wt_spin_lock(session, &block->live_lock);
- locked = 1;
+ locked = true;
/*
* We've allocated our last page, update the checkpoint size. We need
@@ -598,7 +600,7 @@ __ckpt_process(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase)
WT_CKPT_FOREACH(ckptbase, ckpt)
if (F_ISSET(ckpt, WT_CKPT_UPDATE))
WT_ERR(__ckpt_update(
- session, block, ckpt, ckpt->bpriv, 0));
+ session, block, ckpt, ckpt->bpriv, false));
live_update:
/* Truncate the file if that's possible. */
@@ -619,7 +621,7 @@ live_update:
*/
ckpt->ckpt_size = ci->ckpt_size = ckpt_size;
- WT_ERR(__ckpt_update(session, block, ckpt, ci, 1));
+ WT_ERR(__ckpt_update(session, block, ckpt, ci, true));
}
/*
@@ -630,10 +632,10 @@ live_update:
*/
ci->ckpt_alloc = ci->alloc;
WT_ERR(__wt_block_extlist_init(
- session, &ci->alloc, "live", "alloc", 0));
+ session, &ci->alloc, "live", "alloc", false));
ci->ckpt_discard = ci->discard;
WT_ERR(__wt_block_extlist_init(
- session, &ci->discard, "live", "discard", 0));
+ session, &ci->discard, "live", "discard", false));
#ifdef HAVE_DIAGNOSTIC
/*
@@ -654,7 +656,7 @@ live_update:
}
#endif
- block->ckpt_inprogress = 1;
+ block->ckpt_inprogress = true;
err: if (locked)
__wt_spin_unlock(session, &block->live_lock);
@@ -674,7 +676,7 @@ err: if (locked)
*/
static int
__ckpt_update(WT_SESSION_IMPL *session,
- WT_BLOCK *block, WT_CKPT *ckpt, WT_BLOCK_CKPT *ci, int is_live)
+ WT_BLOCK *block, WT_CKPT *ckpt, WT_BLOCK_CKPT *ci, bool is_live)
{
WT_DECL_ITEM(tmp);
WT_DECL_RET;
@@ -772,7 +774,7 @@ __wt_block_checkpoint_resolve(WT_SESSION_IMPL *session, WT_BLOCK *block)
WT_RET_MSG(session, WT_ERROR,
"%s: checkpoint resolved, but no checkpoint in progress",
block->name);
- block->ckpt_inprogress = 0;
+ block->ckpt_inprogress = false;
__wt_spin_lock(session, &block->live_lock);
ret = __wt_block_extlist_merge(
diff --git a/src/third_party/wiredtiger/src/block/block_compact.c b/src/third_party/wiredtiger/src/block/block_compact.c
index 862bd62596a..bd5fff17d07 100644
--- a/src/third_party/wiredtiger/src/block/block_compact.c
+++ b/src/third_party/wiredtiger/src/block/block_compact.c
@@ -20,7 +20,7 @@ __wt_block_compact_start(WT_SESSION_IMPL *session, WT_BLOCK *block)
WT_UNUSED(session);
/* Switch to first-fit allocation. */
- __wt_block_configure_first_fit(block, 1);
+ __wt_block_configure_first_fit(block, true);
block->compact_pct_tenths = 0;
@@ -37,7 +37,7 @@ __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block)
WT_UNUSED(session);
/* Restore the original allocation plan. */
- __wt_block_configure_first_fit(block, 0);
+ __wt_block_configure_first_fit(block, false);
block->compact_pct_tenths = 0;
@@ -49,7 +49,7 @@ __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block)
* Return if compaction will shrink the file.
*/
int
-__wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, int *skipp)
+__wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp)
{
WT_DECL_RET;
WT_EXT *ext;
@@ -57,7 +57,7 @@ __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, int *skipp)
WT_FH *fh;
wt_off_t avail_eighty, avail_ninety, eighty, ninety;
- *skipp = 1; /* Return a default skip. */
+ *skipp = true; /* Return a default skip. */
fh = block->fh;
@@ -119,11 +119,11 @@ __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, int *skipp)
*/
if (avail_eighty > WT_MEGABYTE &&
avail_eighty >= ((fh->size / 10) * 2)) {
- *skipp = 0;
+ *skipp = false;
block->compact_pct_tenths = 2;
} else if (avail_ninety > WT_MEGABYTE &&
avail_ninety >= fh->size / 10) {
- *skipp = 0;
+ *skipp = false;
block->compact_pct_tenths = 1;
}
@@ -138,7 +138,7 @@ err: __wt_spin_unlock(session, &block->live_lock);
*/
int
__wt_block_compact_page_skip(WT_SESSION_IMPL *session,
- WT_BLOCK *block, const uint8_t *addr, size_t addr_size, int *skipp)
+ WT_BLOCK *block, const uint8_t *addr, size_t addr_size, bool *skipp)
{
WT_DECL_RET;
WT_EXT *ext;
@@ -148,7 +148,7 @@ __wt_block_compact_page_skip(WT_SESSION_IMPL *session,
uint32_t size, cksum;
WT_UNUSED(addr_size);
- *skipp = 1; /* Return a default skip. */
+ *skipp = true; /* Return a default skip. */
fh = block->fh;
@@ -170,7 +170,7 @@ __wt_block_compact_page_skip(WT_SESSION_IMPL *session,
if (ext->off >= limit)
break;
if (ext->size >= size) {
- *skipp = 0;
+ *skipp = false;
break;
}
}
diff --git a/src/third_party/wiredtiger/src/block/block_ext.c b/src/third_party/wiredtiger/src/block/block_ext.c
index d593537446b..a7711d73941 100644
--- a/src/third_party/wiredtiger/src/block/block_ext.c
+++ b/src/third_party/wiredtiger/src/block/block_ext.c
@@ -24,7 +24,7 @@ static int __block_append(WT_SESSION_IMPL *,
static int __block_ext_overlap(WT_SESSION_IMPL *,
WT_BLOCK *, WT_EXTLIST *, WT_EXT **, WT_EXTLIST *, WT_EXT **);
static int __block_extlist_dump(
- WT_SESSION_IMPL *, const char *, WT_EXTLIST *, int);
+ WT_SESSION_IMPL *, const char *, WT_EXTLIST *, bool);
static int __block_merge(WT_SESSION_IMPL *,
WT_BLOCK *, WT_EXTLIST *, wt_off_t, wt_off_t);
@@ -59,7 +59,7 @@ __block_off_srch_last(WT_EXT **head, WT_EXT ***stack)
* by-offset list referenced by a size entry), for the specified offset.
*/
static inline void
-__block_off_srch(WT_EXT **head, wt_off_t off, WT_EXT ***stack, int skip_off)
+__block_off_srch(WT_EXT **head, wt_off_t off, WT_EXT ***stack, bool skip_off)
{
WT_EXT **extp;
int i;
@@ -86,7 +86,7 @@ __block_off_srch(WT_EXT **head, wt_off_t off, WT_EXT ***stack, int skip_off)
* __block_first_srch --
* Search the skiplist for the first available slot.
*/
-static inline int
+static inline bool
__block_first_srch(WT_EXT **head, wt_off_t size, WT_EXT ***stack)
{
WT_EXT *ext;
@@ -99,11 +99,11 @@ __block_first_srch(WT_EXT **head, wt_off_t size, WT_EXT ***stack)
if (ext->size >= size)
break;
if (ext == NULL)
- return (0);
+ return (false);
/* Build a stack for the offset we want. */
- __block_off_srch(head, ext->off, stack, 0);
- return (1);
+ __block_off_srch(head, ext->off, stack, false);
+ return (true);
}
/*
@@ -199,7 +199,7 @@ __block_ext_insert(WT_SESSION_IMPL *session, WT_EXTLIST *el, WT_EXT *ext)
* Insert the new WT_EXT structure into the size element's
* offset skiplist.
*/
- __block_off_srch(szp->off, ext->off, astack, 1);
+ __block_off_srch(szp->off, ext->off, astack, true);
for (i = 0; i < ext->depth; ++i) {
ext->next[i + ext->depth] = *astack[i];
*astack[i] = ext;
@@ -212,7 +212,7 @@ __block_ext_insert(WT_SESSION_IMPL *session, WT_EXTLIST *el, WT_EXT *ext)
#endif
/* Insert the new WT_EXT structure into the offset skiplist. */
- __block_off_srch(el->off, ext->off, astack, 0);
+ __block_off_srch(el->off, ext->off, astack, false);
for (i = 0; i < ext->depth; ++i) {
ext->next[i] = *astack[i];
*astack[i] = ext;
@@ -251,7 +251,7 @@ __block_off_insert(
* Return if any part of a specified range appears on a specified extent
* list.
*/
-static int
+static bool
__block_off_match(WT_EXTLIST *el, wt_off_t off, wt_off_t size)
{
WT_EXT *before, *after;
@@ -261,10 +261,10 @@ __block_off_match(WT_EXTLIST *el, wt_off_t off, wt_off_t size)
/* If "before" or "after" overlaps, we have a winner. */
if (before != NULL && before->off + before->size > off)
- return (1);
+ return (true);
if (after != NULL && off + size > after->off)
- return (1);
- return (0);
+ return (true);
+ return (false);
}
/*
@@ -273,7 +273,7 @@ __block_off_match(WT_EXTLIST *el, wt_off_t off, wt_off_t size)
*/
int
__wt_block_misplaced(WT_SESSION_IMPL *session,
- WT_BLOCK *block, const char *tag, wt_off_t offset, uint32_t size, int live)
+ WT_BLOCK *block, const char *tag, wt_off_t offset, uint32_t size, bool live)
{
const char *name;
@@ -329,7 +329,7 @@ __block_off_remove(WT_SESSION_IMPL *session, WT_BLOCK *block,
u_int i;
/* Find and remove the record from the by-offset skiplist. */
- __block_off_srch(el->off, off, astack, 0);
+ __block_off_srch(el->off, off, astack, false);
ext = *astack[0];
if (ext == NULL || ext->off != off)
goto corrupt;
@@ -345,7 +345,7 @@ __block_off_remove(WT_SESSION_IMPL *session, WT_BLOCK *block,
szp = *sstack[0];
if (szp == NULL || szp->size != ext->size)
return (EINVAL);
- __block_off_srch(szp->off, off, astack, 1);
+ __block_off_srch(szp->off, off, astack, true);
ext = *astack[0];
if (ext == NULL || ext->off != off)
goto corrupt;
@@ -359,11 +359,11 @@ __block_off_remove(WT_SESSION_IMPL *session, WT_BLOCK *block,
}
#ifdef HAVE_DIAGNOSTIC
if (!el->track_size) {
- int not_null;
- for (i = 0, not_null = 0; i < ext->depth; ++i)
+ bool not_null;
+ for (i = 0, not_null = false; i < ext->depth; ++i)
if (ext->next[i + ext->depth] != NULL)
- not_null = 1;
- WT_ASSERT(session, not_null == 0);
+ not_null = true;
+ WT_ASSERT(session, not_null == false);
}
#endif
@@ -603,7 +603,8 @@ __wt_block_free(WT_SESSION_IMPL *session,
"free %" PRIdMAX "/%" PRIdMAX, (intmax_t)offset, (intmax_t)size));
#ifdef HAVE_DIAGNOSTIC
- WT_RET(__wt_block_misplaced(session, block, "free", offset, size, 1));
+ WT_RET(
+ __wt_block_misplaced(session, block, "free", offset, size, true));
#endif
WT_RET(__wt_block_ext_prealloc(session, 5));
__wt_spin_lock(session, &block->live_lock);
@@ -1315,8 +1316,8 @@ __wt_block_extlist_write(WT_SESSION_IMPL *session,
#endif
/* Write the extent list to disk. */
- WT_ERR(__wt_block_write_off(
- session, block, tmp, &el->offset, &el->size, &el->cksum, 1, 1));
+ WT_ERR(__wt_block_write_off(session,
+ block, tmp, &el->offset, &el->size, &el->cksum, true, true));
/*
* Remove the allocated blocks from the system's allocation list, extent
@@ -1386,7 +1387,7 @@ __wt_block_extlist_truncate(
*/
int
__wt_block_extlist_init(WT_SESSION_IMPL *session,
- WT_EXTLIST *el, const char *name, const char *extname, int track_size)
+ WT_EXTLIST *el, const char *name, const char *extname, bool track_size)
{
size_t size;
@@ -1434,7 +1435,7 @@ __wt_block_extlist_free(WT_SESSION_IMPL *session, WT_EXTLIST *el)
*/
static int
__block_extlist_dump(
- WT_SESSION_IMPL *session, const char *tag, WT_EXTLIST *el, int show_size)
+ WT_SESSION_IMPL *session, const char *tag, WT_EXTLIST *el, bool show_size)
{
WT_EXT *ext;
WT_SIZE *szp;
diff --git a/src/third_party/wiredtiger/src/block/block_mgr.c b/src/third_party/wiredtiger/src/block/block_mgr.c
index 558008ee7b0..d1875d73bea 100644
--- a/src/third_party/wiredtiger/src/block/block_mgr.c
+++ b/src/third_party/wiredtiger/src/block/block_mgr.c
@@ -8,7 +8,7 @@
#include "wt_internal.h"
-static void __bm_method_set(WT_BM *, int);
+static void __bm_method_set(WT_BM *, bool);
/*
* __bm_readonly --
@@ -62,7 +62,7 @@ __bm_block_header(WT_BM *bm)
*/
static int
__bm_checkpoint(WT_BM *bm,
- WT_SESSION_IMPL *session, WT_ITEM *buf, WT_CKPT *ckptbase, int data_cksum)
+ WT_SESSION_IMPL *session, WT_ITEM *buf, WT_CKPT *ckptbase, bool data_cksum)
{
return (__wt_block_checkpoint(
session, bm->block, buf, ckptbase, data_cksum));
@@ -73,7 +73,7 @@ __bm_checkpoint(WT_BM *bm,
* Flush a file to disk.
*/
static int
-__bm_sync(WT_BM *bm, WT_SESSION_IMPL *session, int async)
+__bm_sync(WT_BM *bm, WT_SESSION_IMPL *session, bool async)
{
return (async ?
__wt_fsync_async(session, bm->block->fh) :
@@ -87,7 +87,7 @@ __bm_sync(WT_BM *bm, WT_SESSION_IMPL *session, int async)
static int
__bm_checkpoint_load(WT_BM *bm, WT_SESSION_IMPL *session,
const uint8_t *addr, size_t addr_size,
- uint8_t *root_addr, size_t *root_addr_sizep, int checkpoint)
+ uint8_t *root_addr, size_t *root_addr_sizep, bool checkpoint)
{
WT_CONNECTION_IMPL *conn;
@@ -113,7 +113,7 @@ __bm_checkpoint_load(WT_BM *bm, WT_SESSION_IMPL *session,
* prevents attempts to write a checkpoint reference, paranoia
* is healthy.
*/
- __bm_method_set(bm, 1);
+ __bm_method_set(bm, true);
}
return (0);
@@ -183,7 +183,7 @@ __bm_compact_start(WT_BM *bm, WT_SESSION_IMPL *session)
*/
static int
__bm_compact_page_skip(WT_BM *bm, WT_SESSION_IMPL *session,
- const uint8_t *addr, size_t addr_size, int *skipp)
+ const uint8_t *addr, size_t addr_size, bool *skipp)
{
return (__wt_block_compact_page_skip(
session, bm->block, addr, addr_size, skipp));
@@ -194,7 +194,7 @@ __bm_compact_page_skip(WT_BM *bm, WT_SESSION_IMPL *session,
* Return if a file can be compacted.
*/
static int
-__bm_compact_skip(WT_BM *bm, WT_SESSION_IMPL *session, int *skipp)
+__bm_compact_skip(WT_BM *bm, WT_SESSION_IMPL *session, bool *skipp)
{
return (__wt_block_compact_skip(session, bm->block, skipp));
}
@@ -237,7 +237,7 @@ __bm_stat(WT_BM *bm, WT_SESSION_IMPL *session, WT_DSRC_STATS *stats)
*/
static int
__bm_write(WT_BM *bm, WT_SESSION_IMPL *session,
- WT_ITEM *buf, uint8_t *addr, size_t *addr_sizep, int data_cksum)
+ WT_ITEM *buf, uint8_t *addr, size_t *addr_sizep, bool data_cksum)
{
return (__wt_block_write(
session, bm->block, buf, addr, addr_sizep, data_cksum));
@@ -269,7 +269,7 @@ __bm_salvage_start(WT_BM *bm, WT_SESSION_IMPL *session)
*/
static int
__bm_salvage_valid(WT_BM *bm,
- WT_SESSION_IMPL *session, uint8_t *addr, size_t addr_size, int valid)
+ WT_SESSION_IMPL *session, uint8_t *addr, size_t addr_size, bool valid)
{
return (__wt_block_salvage_valid(
session, bm->block, addr, addr_size, valid));
@@ -281,7 +281,7 @@ __bm_salvage_valid(WT_BM *bm,
*/
static int
__bm_salvage_next(WT_BM *bm,
- WT_SESSION_IMPL *session, uint8_t *addr, size_t *addr_sizep, int *eofp)
+ WT_SESSION_IMPL *session, uint8_t *addr, size_t *addr_sizep, bool *eofp)
{
return (__wt_block_salvage_next(
session, bm->block, addr, addr_sizep, eofp));
@@ -334,14 +334,14 @@ __bm_verify_end(WT_BM *bm, WT_SESSION_IMPL *session)
* Set up the legal methods.
*/
static void
-__bm_method_set(WT_BM *bm, int readonly)
+__bm_method_set(WT_BM *bm, bool readonly)
{
if (readonly) {
bm->addr_string = __bm_addr_string;
bm->addr_valid = __bm_addr_valid;
bm->block_header = __bm_block_header;
- bm->checkpoint = (int (*)(WT_BM *,
- WT_SESSION_IMPL *, WT_ITEM *, WT_CKPT *, int))__bm_readonly;
+ bm->checkpoint = (int (*)(WT_BM *, WT_SESSION_IMPL *,
+ WT_ITEM *, WT_CKPT *, bool))__bm_readonly;
bm->checkpoint_load = __bm_checkpoint_load;
bm->checkpoint_resolve =
(int (*)(WT_BM *, WT_SESSION_IMPL *))__bm_readonly;
@@ -350,9 +350,9 @@ __bm_method_set(WT_BM *bm, int readonly)
bm->compact_end =
(int (*)(WT_BM *, WT_SESSION_IMPL *))__bm_readonly;
bm->compact_page_skip = (int (*)(WT_BM *, WT_SESSION_IMPL *,
- const uint8_t *, size_t, int *))__bm_readonly;
+ const uint8_t *, size_t, bool *))__bm_readonly;
bm->compact_skip = (int (*)
- (WT_BM *, WT_SESSION_IMPL *, int *))__bm_readonly;
+ (WT_BM *, WT_SESSION_IMPL *, bool *))__bm_readonly;
bm->compact_start =
(int (*)(WT_BM *, WT_SESSION_IMPL *))__bm_readonly;
bm->free = (int (*)(WT_BM *,
@@ -362,19 +362,19 @@ __bm_method_set(WT_BM *bm, int readonly)
bm->salvage_end = (int (*)
(WT_BM *, WT_SESSION_IMPL *))__bm_readonly;
bm->salvage_next = (int (*)(WT_BM *, WT_SESSION_IMPL *,
- uint8_t *, size_t *, int *))__bm_readonly;
+ uint8_t *, size_t *, bool *))__bm_readonly;
bm->salvage_start = (int (*)
(WT_BM *, WT_SESSION_IMPL *))__bm_readonly;
bm->salvage_valid = (int (*)(WT_BM *,
- WT_SESSION_IMPL *, uint8_t *, size_t, int))__bm_readonly;
+ WT_SESSION_IMPL *, uint8_t *, size_t, bool))__bm_readonly;
bm->stat = __bm_stat;
bm->sync =
- (int (*)(WT_BM *, WT_SESSION_IMPL *, int))__bm_readonly;
+ (int (*)(WT_BM *, WT_SESSION_IMPL *, bool))__bm_readonly;
bm->verify_addr = __bm_verify_addr;
bm->verify_end = __bm_verify_end;
bm->verify_start = __bm_verify_start;
bm->write = (int (*)(WT_BM *, WT_SESSION_IMPL *,
- WT_ITEM *, uint8_t *, size_t *, int))__bm_readonly;
+ WT_ITEM *, uint8_t *, size_t *, bool))__bm_readonly;
bm->write_size = (int (*)
(WT_BM *, WT_SESSION_IMPL *, size_t *))__bm_readonly;
} else {
@@ -414,7 +414,7 @@ __bm_method_set(WT_BM *bm, int readonly)
int
__wt_block_manager_open(WT_SESSION_IMPL *session,
const char *filename, const char *cfg[],
- int forced_salvage, int readonly, uint32_t allocsize, WT_BM **bmp)
+ bool forced_salvage, bool readonly, uint32_t allocsize, WT_BM **bmp)
{
WT_BM *bm;
WT_DECL_RET;
@@ -422,7 +422,7 @@ __wt_block_manager_open(WT_SESSION_IMPL *session,
*bmp = NULL;
WT_RET(__wt_calloc_one(session, &bm));
- __bm_method_set(bm, 0);
+ __bm_method_set(bm, false);
WT_ERR(__wt_block_open(session, filename, cfg,
forced_salvage, readonly, allocsize, &bm->block));
diff --git a/src/third_party/wiredtiger/src/block/block_open.c b/src/third_party/wiredtiger/src/block/block_open.c
index 9223c1ad8e4..4f4b7c57279 100644
--- a/src/third_party/wiredtiger/src/block/block_open.c
+++ b/src/third_party/wiredtiger/src/block/block_open.c
@@ -22,7 +22,8 @@ __wt_block_manager_truncate(
WT_FH *fh;
/* Open the underlying file handle. */
- WT_RET(__wt_open(session, filename, 0, 0, WT_FILE_TYPE_DATA, &fh));
+ WT_RET(__wt_open(
+ session, filename, false, false, WT_FILE_TYPE_DATA, &fh));
/* Truncate the file. */
WT_ERR(__wt_block_truncate(session, fh, (wt_off_t)0));
@@ -53,7 +54,8 @@ __wt_block_manager_create(
WT_DECL_RET;
WT_DECL_ITEM(tmp);
WT_FH *fh;
- int exists, suffix;
+ int suffix;
+ bool exists;
char *path;
/*
@@ -65,8 +67,8 @@ __wt_block_manager_create(
* in our space. Move any existing files out of the way and complain.
*/
for (;;) {
- if ((ret = __wt_open(
- session, filename, 1, 1, WT_FILE_TYPE_DATA, &fh)) == 0)
+ if ((ret = __wt_open(session,
+ filename, true, true, WT_FILE_TYPE_DATA, &fh)) == 0)
break;
WT_ERR_TEST(ret != EEXIST, ret);
@@ -150,7 +152,7 @@ __block_destroy(WT_SESSION_IMPL *session, WT_BLOCK *block)
* Configure first-fit allocation.
*/
void
-__wt_block_configure_first_fit(WT_BLOCK *block, int on)
+__wt_block_configure_first_fit(WT_BLOCK *block, bool on)
{
/*
* Switch to first-fit allocation so we rewrite blocks at the start of
@@ -171,7 +173,7 @@ __wt_block_configure_first_fit(WT_BLOCK *block, int on)
int
__wt_block_open(WT_SESSION_IMPL *session,
const char *filename, const char *cfg[],
- int forced_salvage, int readonly, uint32_t allocsize, WT_BLOCK **blockp)
+ bool forced_salvage, bool readonly, uint32_t allocsize, WT_BLOCK **blockp)
{
WT_BLOCK *block;
WT_CONFIG_ITEM cval;
@@ -211,8 +213,7 @@ __wt_block_open(WT_SESSION_IMPL *session,
WT_ERR(__wt_strdup(session, filename, &block->name));
WT_ERR(__wt_config_gets(session, cfg, "block_allocation", &cval));
- block->allocfirst =
- WT_STRING_MATCH("first", cval.str, cval.len) ? 1 : 0;
+ block->allocfirst = WT_STRING_MATCH("first", cval.str, cval.len);
/* Configuration: optional OS buffer cache maximum size. */
WT_ERR(__wt_config_gets(session, cfg, "os_cache_max", &cval));
@@ -249,7 +250,7 @@ __wt_block_open(WT_SESSION_IMPL *session,
#endif
/* Open the underlying file handle. */
- WT_ERR(__wt_open(session, filename, 0, 0,
+ WT_ERR(__wt_open(session, filename, false, false,
readonly ? WT_FILE_TYPE_CHECKPOINT : WT_FILE_TYPE_DATA,
&block->fh));
diff --git a/src/third_party/wiredtiger/src/block/block_read.c b/src/third_party/wiredtiger/src/block/block_read.c
index 0d631396b41..c5e0e4d0146 100644
--- a/src/third_party/wiredtiger/src/block/block_read.c
+++ b/src/third_party/wiredtiger/src/block/block_read.c
@@ -20,7 +20,7 @@ __wt_bm_preload(WT_BM *bm,
WT_DECL_RET;
wt_off_t offset;
uint32_t cksum, size;
- int mapped;
+ bool mapped;
WT_UNUSED(addr_size);
block = bm->block;
@@ -63,9 +63,9 @@ __wt_bm_read(WT_BM *bm, WT_SESSION_IMPL *session,
WT_ITEM *buf, const uint8_t *addr, size_t addr_size)
{
WT_BLOCK *block;
- int mapped;
wt_off_t offset;
uint32_t cksum, size;
+ bool mapped;
WT_UNUSED(addr_size);
block = bm->block;
diff --git a/src/third_party/wiredtiger/src/block/block_slvg.c b/src/third_party/wiredtiger/src/block/block_slvg.c
index c78a6c39942..9f3093c741d 100644
--- a/src/third_party/wiredtiger/src/block/block_slvg.c
+++ b/src/third_party/wiredtiger/src/block/block_slvg.c
@@ -66,26 +66,26 @@ int
__wt_block_salvage_end(WT_SESSION_IMPL *session, WT_BLOCK *block)
{
/* Discard the checkpoint. */
- return (__wt_block_checkpoint_unload(session, block, 0));
+ return (__wt_block_checkpoint_unload(session, block, false));
}
/*
* __wt_block_offset_invalid --
* Return if the block offset is insane.
*/
-int
+bool
__wt_block_offset_invalid(WT_BLOCK *block, wt_off_t offset, uint32_t size)
{
if (size == 0) /* < minimum page size */
- return (1);
+ return (true);
if (size % block->allocsize != 0) /* not allocation-size units */
- return (1);
+ return (true);
if (size > WT_BTREE_PAGE_SIZE_MAX) /* > maximum page size */
- return (1);
+ return (true);
/* past end-of-file */
if (offset + (wt_off_t)size > block->fh->size)
- return (1);
- return (0);
+ return (true);
+ return (false);
}
/*
@@ -94,7 +94,7 @@ __wt_block_offset_invalid(WT_BLOCK *block, wt_off_t offset, uint32_t size)
*/
int
__wt_block_salvage_next(WT_SESSION_IMPL *session,
- WT_BLOCK *block, uint8_t *addr, size_t *addr_sizep, int *eofp)
+ WT_BLOCK *block, uint8_t *addr, size_t *addr_sizep, bool *eofp)
{
WT_BLOCK_HEADER *blk;
WT_DECL_ITEM(tmp);
@@ -165,7 +165,7 @@ err: __wt_scr_free(session, &tmp);
*/
int
__wt_block_salvage_valid(WT_SESSION_IMPL *session,
- WT_BLOCK *block, uint8_t *addr, size_t addr_size, int valid)
+ WT_BLOCK *block, uint8_t *addr, size_t addr_size, bool valid)
{
wt_off_t offset;
uint32_t size, cksum;
diff --git a/src/third_party/wiredtiger/src/block/block_vrfy.c b/src/third_party/wiredtiger/src/block/block_vrfy.c
index c9df768a624..a945b4b2200 100644
--- a/src/third_party/wiredtiger/src/block/block_vrfy.c
+++ b/src/third_party/wiredtiger/src/block/block_vrfy.c
@@ -12,7 +12,7 @@ static int __verify_ckptfrag_add(
WT_SESSION_IMPL *, WT_BLOCK *, wt_off_t, wt_off_t);
static int __verify_ckptfrag_chk(WT_SESSION_IMPL *, WT_BLOCK *);
static int __verify_filefrag_add(
- WT_SESSION_IMPL *, WT_BLOCK *, const char *, wt_off_t, wt_off_t, int);
+ WT_SESSION_IMPL *, WT_BLOCK *, const char *, wt_off_t, wt_off_t, bool);
static int __verify_filefrag_chk(WT_SESSION_IMPL *, WT_BLOCK *);
static int __verify_last_avail(WT_SESSION_IMPL *, WT_BLOCK *, WT_CKPT *);
static int __verify_last_truncate(WT_SESSION_IMPL *, WT_BLOCK *, WT_CKPT *);
@@ -90,14 +90,14 @@ __wt_block_verify_start(WT_SESSION_IMPL *session,
* Set this before reading any extent lists: don't panic if we see
* corruption.
*/
- block->verify = 1;
+ block->verify = true;
/*
* We maintain an allocation list that is rolled forward through the
* set of checkpoints.
*/
WT_RET(__wt_block_extlist_init(
- session, &block->verify_alloc, "verify", "alloc", 0));
+ session, &block->verify_alloc, "verify", "alloc", false));
/*
* The only checkpoint avail list we care about is the last one written;
@@ -107,7 +107,7 @@ __wt_block_verify_start(WT_SESSION_IMPL *session,
/* Configuration: strict behavior on any error. */
WT_RET(__wt_config_gets(session, cfg, "strict", &cval));
- block->verify_strict = cval.val ? 1 : 0;
+ block->verify_strict = cval.val != 0;
return (0);
}
@@ -133,8 +133,9 @@ __verify_last_avail(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckpt)
WT_ERR(__wt_block_extlist_read_avail(
session, block, el, ci->file_size));
WT_EXT_FOREACH(ext, el->off)
- if ((ret = __verify_filefrag_add(session, block,
- "avail-list chunk", ext->off, ext->size, 1)) != 0)
+ if ((ret = __verify_filefrag_add(
+ session, block, "avail-list chunk",
+ ext->off, ext->size, true)) != 0)
break;
}
@@ -173,8 +174,8 @@ __wt_block_verify_end(WT_SESSION_IMPL *session, WT_BLOCK *block)
/* Confirm we verified every file block. */
ret = __verify_filefrag_chk(session, block);
- block->verify = 0;
- block->verify_strict = 0;
+ block->verify = false;
+ block->verify_strict = false;
block->verify_size = 0;
/* Discard the accumulated allocation list. */
@@ -209,16 +210,16 @@ __wt_verify_ckpt_load(
*/
if (ci->root_offset != WT_BLOCK_INVALID_OFFSET)
WT_RET(__verify_filefrag_add(session, block, "checkpoint",
- ci->root_offset, (wt_off_t)ci->root_size, 1));
+ ci->root_offset, (wt_off_t)ci->root_size, true));
if (ci->alloc.offset != WT_BLOCK_INVALID_OFFSET)
WT_RET(__verify_filefrag_add(session, block, "alloc list",
- ci->alloc.offset, (wt_off_t)ci->alloc.size, 1));
+ ci->alloc.offset, (wt_off_t)ci->alloc.size, true));
if (ci->avail.offset != WT_BLOCK_INVALID_OFFSET)
WT_RET(__verify_filefrag_add(session, block, "avail list",
- ci->avail.offset, (wt_off_t)ci->avail.size, 1));
+ ci->avail.offset, (wt_off_t)ci->avail.size, true));
if (ci->discard.offset != WT_BLOCK_INVALID_OFFSET)
WT_RET(__verify_filefrag_add(session, block, "discard list",
- ci->discard.offset, (wt_off_t)ci->discard.size, 1));
+ ci->discard.offset, (wt_off_t)ci->discard.size, true));
/*
* Checkpoint verification is similar to deleting checkpoints. As we
@@ -325,7 +326,8 @@ __wt_block_verify_addr(WT_SESSION_IMPL *session,
WT_RET(__wt_block_buffer_to_addr(block, addr, &offset, &size, &cksum));
/* Add to the per-file list. */
- WT_RET(__verify_filefrag_add(session, block, NULL, offset, size, 0));
+ WT_RET(
+ __verify_filefrag_add(session, block, NULL, offset, size, false));
/*
* It's tempting to try and flag a page as "verified" when we read it.
@@ -354,7 +356,7 @@ __wt_block_verify_addr(WT_SESSION_IMPL *session,
*/
static int
__verify_filefrag_add(WT_SESSION_IMPL *session, WT_BLOCK *block,
- const char *type, wt_off_t offset, wt_off_t size, int nodup)
+ const char *type, wt_off_t offset, wt_off_t size, bool nodup)
{
uint64_t f, frag, frags, i;
diff --git a/src/third_party/wiredtiger/src/block/block_write.c b/src/third_party/wiredtiger/src/block/block_write.c
index af31d82423c..135158a6d7c 100644
--- a/src/third_party/wiredtiger/src/block/block_write.c
+++ b/src/third_party/wiredtiger/src/block/block_write.c
@@ -40,10 +40,10 @@ __wt_block_truncate(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t len)
*/
static inline int
__wt_block_extend(WT_SESSION_IMPL *session, WT_BLOCK *block,
- WT_FH *fh, wt_off_t offset, size_t align_size, int *release_lockp)
+ WT_FH *fh, wt_off_t offset, size_t align_size, bool *release_lockp)
{
WT_DECL_RET;
- int locked;
+ bool locked;
/*
* The locking in this function is messy: the live system is locked when
@@ -55,7 +55,7 @@ __wt_block_extend(WT_SESSION_IMPL *session, WT_BLOCK *block,
* If we unlock, but then find out we need a lock after all, re-acquire
* the lock (and set release_lock so our caller knows to release it).
*/
- locked = 1;
+ locked = true;
/* If not configured to extend the file, we're done. */
if (fh->extend_len == 0)
@@ -94,7 +94,7 @@ __wt_block_extend(WT_SESSION_IMPL *session, WT_BLOCK *block,
* over the extend call.)
*/
if (!fh->fallocate_requires_locking && *release_lockp) {
- *release_lockp = locked = 0;
+ *release_lockp = locked = false;
__wt_spin_unlock(session, &block->live_lock);
}
@@ -119,7 +119,7 @@ __wt_block_extend(WT_SESSION_IMPL *session, WT_BLOCK *block,
*/
if (!locked) {
__wt_spin_lock(session, &block->live_lock);
- *release_lockp = 1;
+ *release_lockp = true;
}
/*
@@ -169,14 +169,14 @@ __wt_block_write_size(WT_SESSION_IMPL *session, WT_BLOCK *block, size_t *sizep)
*/
int
__wt_block_write(WT_SESSION_IMPL *session, WT_BLOCK *block,
- WT_ITEM *buf, uint8_t *addr, size_t *addr_sizep, int data_cksum)
+ WT_ITEM *buf, uint8_t *addr, size_t *addr_sizep, bool data_cksum)
{
wt_off_t offset;
uint32_t size, cksum;
uint8_t *endp;
WT_RET(__wt_block_write_off(
- session, block, buf, &offset, &size, &cksum, data_cksum, 0));
+ session, block, buf, &offset, &size, &cksum, data_cksum, false));
endp = addr;
WT_RET(__wt_block_addr_to_buffer(block, &endp, offset, size, cksum));
@@ -193,14 +193,14 @@ __wt_block_write(WT_SESSION_IMPL *session, WT_BLOCK *block,
int
__wt_block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block,
WT_ITEM *buf, wt_off_t *offsetp, uint32_t *sizep, uint32_t *cksump,
- int data_cksum, int caller_locked)
+ bool data_cksum, bool caller_locked)
{
WT_BLOCK_HEADER *blk;
WT_DECL_RET;
WT_FH *fh;
size_t align_size;
wt_off_t offset;
- int local_locked;
+ bool local_locked;
blk = WT_BLOCK_HEADER_REF(buf->mem);
fh = block->fh;
@@ -269,10 +269,10 @@ __wt_block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block,
* the block-extend function may release the lock).
* Release any locally acquired lock.
*/
- local_locked = 0;
+ local_locked = false;
if (!caller_locked) {
__wt_spin_lock(session, &block->live_lock);
- local_locked = 1;
+ local_locked = true;
}
ret = __wt_block_alloc(session, block, &offset, (wt_off_t)align_size);
if (ret == 0)
diff --git a/src/third_party/wiredtiger/src/btree/bt_compact.c b/src/third_party/wiredtiger/src/btree/bt_compact.c
index 769423f7796..e889c81c9e9 100644
--- a/src/third_party/wiredtiger/src/btree/bt_compact.c
+++ b/src/third_party/wiredtiger/src/btree/bt_compact.c
@@ -13,7 +13,7 @@
* Return if a page needs to be re-written.
*/
static int
-__compact_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
+__compact_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp)
{
WT_BM *bm;
WT_DECL_RET;
@@ -22,7 +22,7 @@ __compact_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
size_t addr_size;
const uint8_t *addr;
- *skipp = 1; /* Default skip. */
+ *skipp = true; /* Default skip. */
bm = S2BT(session)->bm;
page = ref->page;
@@ -44,13 +44,13 @@ __compact_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
* If the page is a 1-to-1 replacement, test the replacement addresses.
* Ignore empty pages, they get merged into the parent.
*/
- if (mod == NULL || F_ISSET(mod, WT_PM_REC_MASK) == 0) {
+ if (mod == NULL || mod->rec_result == 0) {
WT_RET(__wt_ref_info(session, ref, &addr, &addr_size, NULL));
if (addr == NULL)
return (0);
WT_RET(
bm->compact_page_skip(bm, session, addr, addr_size, skipp));
- } else if (F_ISSET(mod, WT_PM_REC_MASK) == WT_PM_REC_REPLACE) {
+ } else if (mod->rec_result == WT_PM_REC_REPLACE) {
/*
* The page's modification information can change underfoot if
* the page is being reconciled, lock the page down.
@@ -76,7 +76,7 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
WT_REF *ref;
- int block_manager_begin, evict_reset, skip;
+ bool block_manager_begin, evict_reset, skip;
WT_UNUSED(cfg);
@@ -84,7 +84,7 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
btree = S2BT(session);
bm = btree->bm;
ref = NULL;
- block_manager_begin = 0;
+ block_manager_begin = false;
WT_STAT_FAST_DATA_INCR(session, session_compact);
@@ -110,7 +110,7 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
*
* We're holding the schema lock which serializes with checkpoints.
*/
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_SCHEMA_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SCHEMA));
/*
* Get the tree handle's flush lock which blocks threads writing leaf
@@ -139,7 +139,7 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
/* Start compaction. */
WT_ERR(bm->compact_start(bm, session));
- block_manager_begin = 1;
+ block_manager_begin = true;
/* Walk the tree reviewing pages to see if they should be re-written. */
for (;;) {
@@ -158,7 +158,7 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
if (skip)
continue;
- session->compaction = 1;
+ session->compaction = true;
/* Rewrite the page: mark the page and tree dirty. */
WT_ERR(__wt_page_modify_init(session, ref->page));
__wt_page_modify_set(session, ref->page);
@@ -187,14 +187,14 @@ err: if (ref != NULL)
* Return if compaction requires we read this page.
*/
int
-__wt_compact_page_skip(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
+__wt_compact_page_skip(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp)
{
WT_BM *bm;
size_t addr_size;
u_int type;
const uint8_t *addr;
- *skipp = 0; /* Default to reading. */
+ *skipp = false; /* Default to reading. */
type = 0; /* Keep compiler quiet. */
bm = S2BT(session)->bm;
diff --git a/src/third_party/wiredtiger/src/btree/bt_curnext.c b/src/third_party/wiredtiger/src/btree/bt_curnext.c
index 5e866dc9233..4720dc685e5 100644
--- a/src/third_party/wiredtiger/src/btree/bt_curnext.c
+++ b/src/third_party/wiredtiger/src/btree/bt_curnext.c
@@ -13,7 +13,7 @@
* Return the next entry on the append list.
*/
static inline int
-__cursor_fix_append_next(WT_CURSOR_BTREE *cbt, int newpage)
+__cursor_fix_append_next(WT_CURSOR_BTREE *cbt, bool newpage)
{
WT_ITEM *val;
WT_SESSION_IMPL *session;
@@ -72,7 +72,7 @@ __cursor_fix_append_next(WT_CURSOR_BTREE *cbt, int newpage)
* Move to the next, fixed-length column-store item.
*/
static inline int
-__cursor_fix_next(WT_CURSOR_BTREE *cbt, int newpage)
+__cursor_fix_next(WT_CURSOR_BTREE *cbt, bool newpage)
{
WT_BTREE *btree;
WT_ITEM *val;
@@ -121,7 +121,7 @@ new_page:
* Return the next variable-length entry on the append list.
*/
static inline int
-__cursor_var_append_next(WT_CURSOR_BTREE *cbt, int newpage)
+__cursor_var_append_next(WT_CURSOR_BTREE *cbt, bool newpage)
{
WT_ITEM *val;
WT_SESSION_IMPL *session;
@@ -160,7 +160,7 @@ new_page: if (cbt->ins == NULL)
* Move to the next, variable-length column-store item.
*/
static inline int
-__cursor_var_next(WT_CURSOR_BTREE *cbt, int newpage)
+__cursor_var_next(WT_CURSOR_BTREE *cbt, bool newpage)
{
WT_CELL *cell;
WT_CELL_UNPACK unpack;
@@ -241,7 +241,7 @@ new_page: /* Find the matching WT_COL slot. */
* Move to the next row-store item.
*/
static inline int
-__cursor_row_next(WT_CURSOR_BTREE *cbt, int newpage)
+__cursor_row_next(WT_CURSOR_BTREE *cbt, bool newpage)
{
WT_INSERT *ins;
WT_ITEM *key, *val;
@@ -335,12 +335,10 @@ new_insert: if ((ins = cbt->ins) != NULL) {
* Initialize a cursor for iteration, usually based on a search.
*/
void
-__wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt, int next)
+__wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt)
{
WT_PAGE *page;
- WT_UNUSED(next);
-
/*
* We don't currently have to do any setup when we switch between next
* and prev calls, but I'm sure we will someday -- I'm leaving support
@@ -399,13 +397,13 @@ __wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt, int next)
* Move to the next record in the tree.
*/
int
-__wt_btcur_next(WT_CURSOR_BTREE *cbt, int truncating)
+__wt_btcur_next(WT_CURSOR_BTREE *cbt, bool truncating)
{
WT_DECL_RET;
WT_PAGE *page;
WT_SESSION_IMPL *session;
uint32_t flags;
- int newpage;
+ bool newpage;
session = (WT_SESSION_IMPL *)cbt->iface.session;
@@ -416,21 +414,21 @@ __wt_btcur_next(WT_CURSOR_BTREE *cbt, int truncating)
if (truncating)
LF_SET(WT_READ_TRUNCATE);
- WT_RET(__cursor_func_init(cbt, 0));
+ WT_RET(__cursor_func_init(cbt, false));
/*
* If we aren't already iterating in the right direction, there's
* some setup to do.
*/
if (!F_ISSET(cbt, WT_CBT_ITERATE_NEXT))
- __wt_btcur_iterate_setup(cbt, 1);
+ __wt_btcur_iterate_setup(cbt);
/*
* Walk any page we're holding until the underlying call returns not-
* found. Then, move to the next page, until we reach the end of the
* file.
*/
- for (newpage = 0;; newpage = 1) {
+ for (newpage = false;; newpage = true) {
page = cbt->ref == NULL ? NULL : cbt->ref->page;
WT_ASSERT(session, page == NULL || !WT_PAGE_IS_INTERNAL(page));
diff --git a/src/third_party/wiredtiger/src/btree/bt_curprev.c b/src/third_party/wiredtiger/src/btree/bt_curprev.c
index 08388938080..f79351c86e8 100644
--- a/src/third_party/wiredtiger/src/btree/bt_curprev.c
+++ b/src/third_party/wiredtiger/src/btree/bt_curprev.c
@@ -124,7 +124,7 @@ restart:
* Return the previous fixed-length entry on the append list.
*/
static inline int
-__cursor_fix_append_prev(WT_CURSOR_BTREE *cbt, int newpage)
+__cursor_fix_append_prev(WT_CURSOR_BTREE *cbt, bool newpage)
{
WT_ITEM *val;
WT_PAGE *page;
@@ -209,7 +209,7 @@ __cursor_fix_append_prev(WT_CURSOR_BTREE *cbt, int newpage)
* Move to the previous, fixed-length column-store item.
*/
static inline int
-__cursor_fix_prev(WT_CURSOR_BTREE *cbt, int newpage)
+__cursor_fix_prev(WT_CURSOR_BTREE *cbt, bool newpage)
{
WT_BTREE *btree;
WT_ITEM *val;
@@ -258,7 +258,7 @@ new_page:
* Return the previous variable-length entry on the append list.
*/
static inline int
-__cursor_var_append_prev(WT_CURSOR_BTREE *cbt, int newpage)
+__cursor_var_append_prev(WT_CURSOR_BTREE *cbt, bool newpage)
{
WT_ITEM *val;
WT_SESSION_IMPL *session;
@@ -297,7 +297,7 @@ new_page: if (cbt->ins == NULL)
* Move to the previous, variable-length column-store item.
*/
static inline int
-__cursor_var_prev(WT_CURSOR_BTREE *cbt, int newpage)
+__cursor_var_prev(WT_CURSOR_BTREE *cbt, bool newpage)
{
WT_CELL *cell;
WT_CELL_UNPACK unpack;
@@ -379,7 +379,7 @@ new_page: if (cbt->recno < page->pg_var_recno)
* Move to the previous row-store item.
*/
static inline int
-__cursor_row_prev(WT_CURSOR_BTREE *cbt, int newpage)
+__cursor_row_prev(WT_CURSOR_BTREE *cbt, bool newpage)
{
WT_INSERT *ins;
WT_ITEM *key, *val;
@@ -486,13 +486,13 @@ new_insert: if ((ins = cbt->ins) != NULL) {
* Move to the previous record in the tree.
*/
int
-__wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating)
+__wt_btcur_prev(WT_CURSOR_BTREE *cbt, bool truncating)
{
WT_DECL_RET;
WT_PAGE *page;
WT_SESSION_IMPL *session;
uint32_t flags;
- int newpage;
+ bool newpage;
session = (WT_SESSION_IMPL *)cbt->iface.session;
@@ -503,21 +503,21 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating)
if (truncating)
LF_SET(WT_READ_TRUNCATE);
- WT_RET(__cursor_func_init(cbt, 0));
+ WT_RET(__cursor_func_init(cbt, false));
/*
* If we aren't already iterating in the right direction, there's
* some setup to do.
*/
if (!F_ISSET(cbt, WT_CBT_ITERATE_PREV))
- __wt_btcur_iterate_setup(cbt, 0);
+ __wt_btcur_iterate_setup(cbt);
/*
* Walk any page we're holding until the underlying call returns not-
* found. Then, move to the previous page, until we reach the start
* of the file.
*/
- for (newpage = 0;; newpage = 1) {
+ for (newpage = false;; newpage = true) {
page = cbt->ref == NULL ? NULL : cbt->ref->page;
WT_ASSERT(session, page == NULL || !WT_PAGE_IS_INTERNAL(page));
@@ -545,7 +545,7 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating)
F_CLR(cbt, WT_CBT_ITERATE_APPEND);
if (ret != WT_NOTFOUND)
break;
- newpage = 1;
+ newpage = true;
}
if (page != NULL) {
switch (page->type) {
diff --git a/src/third_party/wiredtiger/src/btree/bt_cursor.c b/src/third_party/wiredtiger/src/btree/bt_cursor.c
index 8409b0cd6a2..4ecc6a5e5b9 100644
--- a/src/third_party/wiredtiger/src/btree/bt_cursor.c
+++ b/src/third_party/wiredtiger/src/btree/bt_cursor.c
@@ -63,14 +63,14 @@ static inline int
__cursor_fix_implicit(WT_BTREE *btree, WT_CURSOR_BTREE *cbt)
{
return (btree->type == BTREE_COL_FIX &&
- !F_ISSET(cbt, WT_CBT_MAX_RECORD) ? 1 : 0);
+ !F_ISSET(cbt, WT_CBT_MAX_RECORD));
}
/*
* __cursor_valid --
* Return if the cursor references an valid key/value pair.
*/
-static inline int
+static inline bool
__cursor_valid(WT_CURSOR_BTREE *cbt, WT_UPDATE **updp)
{
WT_BTREE *btree;
@@ -133,10 +133,10 @@ __cursor_valid(WT_CURSOR_BTREE *cbt, WT_UPDATE **updp)
if (cbt->ins != NULL &&
(upd = __wt_txn_read(session, cbt->ins->upd)) != NULL) {
if (WT_UPDATE_DELETED_ISSET(upd))
- return (0);
+ return (false);
if (updp != NULL)
*updp = upd;
- return (1);
+ return (true);
}
/*
@@ -155,7 +155,7 @@ __cursor_valid(WT_CURSOR_BTREE *cbt, WT_UPDATE **updp)
* keys, check for retrieval past the end of the page.
*/
if (cbt->recno >= page->pg_fix_recno + page->pg_fix_entries)
- return (0);
+ return (false);
/*
* Updates aren't stored on the page, an update would have
@@ -170,7 +170,7 @@ __cursor_valid(WT_CURSOR_BTREE *cbt, WT_UPDATE **updp)
* "slots", check if search returned a valid slot.
*/
if (cbt->slot >= page->pg_var_entries)
- return (0);
+ return (false);
/*
* Updates aren't stored on the page, an update would have
@@ -181,7 +181,7 @@ __cursor_valid(WT_CURSOR_BTREE *cbt, WT_UPDATE **updp)
cip = &page->pg_var_d[cbt->slot];
if ((cell = WT_COL_PTR(page, cip)) == NULL ||
__wt_cell_type(cell) == WT_CELL_DEL)
- return (0);
+ return (false);
break;
case BTREE_ROW:
/*
@@ -189,7 +189,7 @@ __cursor_valid(WT_CURSOR_BTREE *cbt, WT_UPDATE **updp)
* key as an on-page object, we're done.
*/
if (cbt->ins != NULL)
- return (0);
+ return (false);
/*
* Check if searched returned a valid slot (the failure mode is
@@ -198,19 +198,19 @@ __cursor_valid(WT_CURSOR_BTREE *cbt, WT_UPDATE **updp)
* mirrors the column-store test).
*/
if (cbt->slot >= page->pg_row_entries)
- return (0);
+ return (false);
/* Updates are stored on the page, check for a delete. */
if (page->pg_row_upd != NULL && (upd = __wt_txn_read(
session, page->pg_row_upd[cbt->slot])) != NULL) {
if (WT_UPDATE_DELETED_ISSET(upd))
- return (0);
+ return (false);
if (updp != NULL)
*updp = upd;
}
break;
}
- return (1);
+ return (true);
}
/*
@@ -232,7 +232,8 @@ __cursor_col_search(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt)
* Row-store search from an application cursor.
*/
static inline int
-__cursor_row_search(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int insert)
+__cursor_row_search(
+ WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, bool insert)
{
WT_DECL_RET;
@@ -247,7 +248,7 @@ __cursor_row_search(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int insert)
*/
static inline int
__cursor_col_modify(
- WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int is_remove)
+ WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, bool is_remove)
{
return (__wt_col_modify(session,
cbt, cbt->iface.recno, &cbt->iface.value, NULL, is_remove));
@@ -259,7 +260,7 @@ __cursor_col_modify(
*/
static inline int
__cursor_row_modify(
- WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int is_remove)
+ WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, bool is_remove)
{
return (__wt_row_modify(session,
cbt, &cbt->iface.key, &cbt->iface.value, NULL, is_remove));
@@ -308,7 +309,7 @@ __wt_btcur_search(WT_CURSOR_BTREE *cbt)
WT_RET(__cursor_func_init(cbt, 1));
WT_ERR(btree->type == BTREE_ROW ?
- __cursor_row_search(session, cbt, 0) :
+ __cursor_row_search(session, cbt, false) :
__cursor_col_search(session, cbt));
if (cbt->compare == 0 && __cursor_valid(cbt, &upd))
ret = __wt_kv_return(session, cbt, upd);
@@ -362,7 +363,7 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp)
* existing record.
*/
WT_ERR(btree->type == BTREE_ROW ?
- __cursor_row_search(session, cbt, 1) :
+ __cursor_row_search(session, cbt, true) :
__cursor_col_search(session, cbt));
/*
@@ -391,16 +392,16 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp)
cursor->value.data = &cbt->v;
cursor->value.size = 1;
exact = 0;
- } else if ((ret = __wt_btcur_next(cbt, 0)) != WT_NOTFOUND)
+ } else if ((ret = __wt_btcur_next(cbt, false)) != WT_NOTFOUND)
exact = 1;
else {
WT_ERR(btree->type == BTREE_ROW ?
- __cursor_row_search(session, cbt, 1) :
+ __cursor_row_search(session, cbt, true) :
__cursor_col_search(session, cbt));
if (__cursor_valid(cbt, &upd)) {
exact = cbt->compare;
ret = __wt_kv_return(session, cbt, upd);
- } else if ((ret = __wt_btcur_prev(cbt, 0)) != WT_NOTFOUND)
+ } else if ((ret = __wt_btcur_prev(cbt, false)) != WT_NOTFOUND)
exact = -1;
}
@@ -441,11 +442,11 @@ __wt_btcur_insert(WT_CURSOR_BTREE *cbt)
* and it's no longer possible to bulk-load into it.
*/
if (btree->bulk_load_ok) {
- btree->bulk_load_ok = 0;
- __wt_btree_evictable(session, 1);
+ btree->bulk_load_ok = false;
+ __wt_btree_evictable(session, true);
}
-retry: WT_RET(__cursor_func_init(cbt, 1));
+retry: WT_RET(__cursor_func_init(cbt, true));
switch (btree->type) {
case BTREE_COL_FIX:
@@ -476,12 +477,12 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
(cbt->compare != 0 && __cursor_fix_implicit(btree, cbt))))
WT_ERR(WT_DUPLICATE_KEY);
- WT_ERR(__cursor_col_modify(session, cbt, 0));
+ WT_ERR(__cursor_col_modify(session, cbt, false));
if (F_ISSET(cursor, WT_CURSTD_APPEND))
cbt->iface.recno = cbt->recno;
break;
case BTREE_ROW:
- WT_ERR(__cursor_row_search(session, cbt, 1));
+ WT_ERR(__cursor_row_search(session, cbt, true));
/*
* If not overwriting, fail if the key exists, else insert the
* key/value pair.
@@ -490,7 +491,7 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
cbt->compare == 0 && __cursor_valid(cbt, NULL))
WT_ERR(WT_DUPLICATE_KEY);
- ret = __cursor_row_modify(session, cbt, 0);
+ ret = __cursor_row_modify(session, cbt, false);
break;
WT_ILLEGAL_VALUE_ERR(session);
}
@@ -554,11 +555,11 @@ __wt_btcur_update_check(WT_CURSOR_BTREE *cbt)
btree = cbt->btree;
session = (WT_SESSION_IMPL *)cursor->session;
-retry: WT_RET(__cursor_func_init(cbt, 1));
+retry: WT_RET(__cursor_func_init(cbt, true));
switch (btree->type) {
case BTREE_ROW:
- WT_ERR(__cursor_row_search(session, cbt, 1));
+ WT_ERR(__cursor_row_search(session, cbt, true));
/*
* Just check for conflicts.
@@ -601,7 +602,7 @@ __wt_btcur_remove(WT_CURSOR_BTREE *cbt)
if (btree->type == BTREE_ROW)
WT_RET(__cursor_size_chk(session, &cursor->key));
-retry: WT_RET(__cursor_func_init(cbt, 1));
+retry: WT_RET(__cursor_func_init(cbt, true));
switch (btree->type) {
case BTREE_COL_FIX:
@@ -631,11 +632,11 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
*/
cbt->recno = cursor->recno;
} else
- ret = __cursor_col_modify(session, cbt, 1);
+ ret = __cursor_col_modify(session, cbt, true);
break;
case BTREE_ROW:
/* Remove the record if it exists. */
- WT_ERR(__cursor_row_search(session, cbt, 0));
+ WT_ERR(__cursor_row_search(session, cbt, false));
/* Check whether an update would conflict. */
WT_ERR(__curfile_update_check(cbt));
@@ -643,7 +644,7 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
if (cbt->compare != 0 || !__cursor_valid(cbt, NULL))
WT_ERR(WT_NOTFOUND);
- ret = __cursor_row_modify(session, cbt, 1);
+ ret = __cursor_row_modify(session, cbt, true);
break;
WT_ILLEGAL_VALUE_ERR(session);
}
@@ -693,11 +694,11 @@ __wt_btcur_update(WT_CURSOR_BTREE *cbt)
* and it's no longer possible to bulk-load into it.
*/
if (btree->bulk_load_ok) {
- btree->bulk_load_ok = 0;
- __wt_btree_evictable(session, 1);
+ btree->bulk_load_ok = false;
+ __wt_btree_evictable(session, true);
}
-retry: WT_RET(__cursor_func_init(cbt, 1));
+retry: WT_RET(__cursor_func_init(cbt, true));
switch (btree->type) {
case BTREE_COL_FIX:
@@ -718,10 +719,10 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
!__cursor_fix_implicit(btree, cbt))
WT_ERR(WT_NOTFOUND);
}
- ret = __cursor_col_modify(session, cbt, 0);
+ ret = __cursor_col_modify(session, cbt, false);
break;
case BTREE_ROW:
- WT_ERR(__cursor_row_search(session, cbt, 1));
+ WT_ERR(__cursor_row_search(session, cbt, true));
/*
* If not overwriting, check for conflicts and fail if the key
* does not exist.
@@ -731,7 +732,7 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
if (cbt->compare != 0 || !__cursor_valid(cbt, NULL))
WT_ERR(WT_NOTFOUND);
}
- ret = __cursor_row_modify(session, cbt, 0);
+ ret = __cursor_row_modify(session, cbt, false);
break;
WT_ILLEGAL_VALUE_ERR(session);
}
@@ -780,15 +781,18 @@ __wt_btcur_next_random(WT_CURSOR_BTREE *cbt)
WT_STAT_FAST_CONN_INCR(session, cursor_next);
WT_STAT_FAST_DATA_INCR(session, cursor_next);
- WT_RET(__cursor_func_init(cbt, 1));
+ WT_RET(__cursor_func_init(cbt, true));
WT_WITH_PAGE_INDEX(session,
ret = __wt_row_random(session, cbt));
WT_ERR(ret);
if (__cursor_valid(cbt, &upd))
WT_ERR(__wt_kv_return(session, cbt, upd));
- else
- WT_ERR(__wt_btcur_search_near(cbt, 0));
+ else {
+ if ((ret = __wt_btcur_next(cbt, false)) == WT_NOTFOUND)
+ ret = __wt_btcur_prev(cbt, false);
+ WT_ERR(ret);
+ }
err: if (ret != 0)
WT_TRET(__cursor_reset(cbt));
@@ -842,7 +846,7 @@ __wt_btcur_compare(WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *cmpp)
* __cursor_equals --
* Return if two cursors reference the same row.
*/
-static inline int
+static inline bool
__cursor_equals(WT_CURSOR_BTREE *a, WT_CURSOR_BTREE *b)
{
switch (a->btree->type) {
@@ -854,21 +858,21 @@ __cursor_equals(WT_CURSOR_BTREE *a, WT_CURSOR_BTREE *b)
* one being returned to the application.
*/
if (((WT_CURSOR *)a)->recno == ((WT_CURSOR *)b)->recno)
- return (1);
+ return (true);
break;
case BTREE_ROW:
if (a->ref != b->ref)
- return (0);
+ return (false);
if (a->ins != NULL || b->ins != NULL) {
if (a->ins == b->ins)
- return (1);
+ return (true);
break;
}
if (a->slot == b->slot)
- return (1);
+ return (true);
break;
}
- return (0);
+ return (false);
}
/*
@@ -876,8 +880,7 @@ __cursor_equals(WT_CURSOR_BTREE *a, WT_CURSOR_BTREE *b)
* Return an equality comparison between two cursors.
*/
int
-__wt_btcur_equals(
- WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp)
+__wt_btcur_equals(WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp)
{
WT_CURSOR *a, *b;
WT_SESSION_IMPL *session;
@@ -916,7 +919,7 @@ __wt_btcur_equals(
static int
__cursor_truncate(WT_SESSION_IMPL *session,
WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop,
- int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, int))
+ int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, bool))
{
WT_DECL_RET;
@@ -936,22 +939,24 @@ __cursor_truncate(WT_SESSION_IMPL *session,
* instantiated the end cursor, so we know that page is pinned in memory
* and we can proceed without concern.
*/
- do {
- WT_RET(__wt_btcur_remove(start));
- /*
- * Reset ret each time through so that we don't loop forever in
- * the cursor equals case.
- */
- for (ret = 0;;) {
- if (stop != NULL && __cursor_equals(start, stop))
- break;
- if ((ret = __wt_btcur_next(start, 1)) != 0)
- break;
- start->compare = 0; /* Exact match */
- if ((ret = rmfunc(session, start, 1)) != 0)
- break;
- }
- } while (ret == WT_RESTART);
+retry: WT_RET(__wt_btcur_remove(start));
+
+ /*
+ * Reset ret each time through so that we don't loop forever in
+ * the cursor equals case.
+ */
+ for (ret = 0;;) {
+ if (stop != NULL && __cursor_equals(start, stop))
+ break;
+ if ((ret = __wt_btcur_next(start, true)) != 0)
+ break;
+ start->compare = 0; /* Exact match */
+ if ((ret = rmfunc(session, start, 1)) != 0)
+ break;
+ }
+
+ if (ret == WT_RESTART)
+ goto retry;
WT_RET_NOTFOUND_OK(ret);
return (0);
@@ -964,7 +969,7 @@ __cursor_truncate(WT_SESSION_IMPL *session,
static int
__cursor_truncate_fix(WT_SESSION_IMPL *session,
WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop,
- int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, int))
+ int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, bool))
{
WT_DECL_RET;
uint8_t *value;
@@ -985,24 +990,25 @@ __cursor_truncate_fix(WT_SESSION_IMPL *session,
* other thread of control; in that case, repeat the full search to
* refresh the page's modification information.
*/
- do {
- WT_RET(__wt_btcur_remove(start));
- /*
- * Reset ret each time through so that we don't loop forever in
- * the cursor equals case.
- */
- for (ret = 0;;) {
- if (stop != NULL && __cursor_equals(start, stop))
- break;
- if ((ret = __wt_btcur_next(start, 1)) != 0)
- break;
- start->compare = 0; /* Exact match */
- value = (uint8_t *)start->iface.value.data;
- if (*value != 0 &&
- (ret = rmfunc(session, start, 1)) != 0)
- break;
- }
- } while (ret == WT_RESTART);
+retry: WT_RET(__wt_btcur_remove(start));
+ /*
+ * Reset ret each time through so that we don't loop forever in
+ * the cursor equals case.
+ */
+ for (ret = 0;;) {
+ if (stop != NULL && __cursor_equals(start, stop))
+ break;
+ if ((ret = __wt_btcur_next(start, true)) != 0)
+ break;
+ start->compare = 0; /* Exact match */
+ value = (uint8_t *)start->iface.value.data;
+ if (*value != 0 &&
+ (ret = rmfunc(session, start, 1)) != 0)
+ break;
+ }
+
+ if (ret == WT_RESTART)
+ goto retry;
WT_RET_NOTFOUND_OK(ret);
return (0);
diff --git a/src/third_party/wiredtiger/src/btree/bt_debug.c b/src/third_party/wiredtiger/src/btree/bt_debug.c
index 041398d4e43..4affc9c243e 100644
--- a/src/third_party/wiredtiger/src/btree/bt_debug.c
+++ b/src/third_party/wiredtiger/src/btree/bt_debug.c
@@ -31,7 +31,7 @@ static const /* Output separator */
static int __debug_cell(WT_DBG *, const WT_PAGE_HEADER *, WT_CELL_UNPACK *);
static int __debug_cell_data(
WT_DBG *, WT_PAGE *, int type, const char *, WT_CELL_UNPACK *);
-static void __debug_col_skip(WT_DBG *, WT_INSERT_HEAD *, const char *, int);
+static void __debug_col_skip(WT_DBG *, WT_INSERT_HEAD *, const char *, bool);
static int __debug_config(WT_SESSION_IMPL *, WT_DBG *, const char *);
static int __debug_dsk_cell(WT_DBG *, const WT_PAGE_HEADER *);
static void __debug_dsk_col_fix(WT_DBG *, const WT_PAGE_HEADER *);
@@ -46,7 +46,7 @@ static int __debug_page_row_leaf(WT_DBG *, WT_PAGE *);
static int __debug_ref(WT_DBG *, WT_REF *);
static void __debug_row_skip(WT_DBG *, WT_INSERT_HEAD *);
static int __debug_tree(WT_SESSION_IMPL *, WT_PAGE *, const char *, uint32_t);
-static void __debug_update(WT_DBG *, WT_UPDATE *, int);
+static void __debug_update(WT_DBG *, WT_UPDATE *, bool);
static void __dmsg(WT_DBG *, const char *, ...)
WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 2, 3)));
static void __dmsg_wrapup(WT_DBG *);
@@ -638,7 +638,7 @@ __debug_page_metadata(WT_DBG *ds, WT_PAGE *page)
__dmsg(ds, ", split locked");
if (mod != NULL)
- switch (F_ISSET(mod, WT_PM_REC_MASK)) {
+ switch (mod->rec_result) {
case WT_PM_REC_EMPTY:
__dmsg(ds, ", empty");
break;
@@ -694,7 +694,7 @@ __debug_page_col_fix(WT_DBG *ds, WT_PAGE *page)
__dmsg(ds,
"\tupdate %" PRIu64 "\n",
WT_INSERT_RECNO(ins));
- __debug_update(ds, ins->upd, 1);
+ __debug_update(ds, ins->upd, true);
ins = WT_SKIP_NEXT(ins);
}
++recno;
@@ -703,11 +703,12 @@ __debug_page_col_fix(WT_DBG *ds, WT_PAGE *page)
if (WT_COL_UPDATE_SINGLE(page) != NULL) {
__dmsg(ds, "%s", sep);
- __debug_col_skip(ds, WT_COL_UPDATE_SINGLE(page), "update", 1);
+ __debug_col_skip(
+ ds, WT_COL_UPDATE_SINGLE(page), "update", true);
}
if (WT_COL_APPEND(page) != NULL) {
__dmsg(ds, "%s", sep);
- __debug_col_skip(ds, WT_COL_APPEND(page), "append", 1);
+ __debug_col_skip(ds, WT_COL_APPEND(page), "append", true);
}
}
@@ -770,13 +771,13 @@ __debug_page_col_var(WT_DBG *ds, WT_PAGE *page)
__debug_cell_data(ds, page, WT_PAGE_COL_VAR, tag, unpack));
if ((update = WT_COL_UPDATE(page, cip)) != NULL)
- __debug_col_skip(ds, update, "update", 0);
+ __debug_col_skip(ds, update, "update", false);
recno += rle;
}
if (WT_COL_APPEND(page) != NULL) {
__dmsg(ds, "%s", sep);
- __debug_col_skip(ds, WT_COL_APPEND(page), "append", 0);
+ __debug_col_skip(ds, WT_COL_APPEND(page), "append", false);
}
return (0);
@@ -842,7 +843,7 @@ __debug_page_row_leaf(WT_DBG *ds, WT_PAGE *page)
/* Dump the page's K/V pairs. */
WT_ROW_FOREACH(page, rip, i) {
- WT_RET(__wt_row_leaf_key(session, page, rip, key, 0));
+ WT_RET(__wt_row_leaf_key(session, page, rip, key, false));
__debug_item(ds, "K", key->data, key->size);
if ((cell = __wt_row_leaf_value_cell(page, rip, NULL)) == NULL)
@@ -854,7 +855,7 @@ __debug_page_row_leaf(WT_DBG *ds, WT_PAGE *page)
}
if ((upd = WT_ROW_UPDATE(page, rip)) != NULL)
- __debug_update(ds, upd, 0);
+ __debug_update(ds, upd, false);
if ((insert = WT_ROW_INSERT(page, rip)) != NULL)
__debug_row_skip(ds, insert);
@@ -869,7 +870,8 @@ err: __wt_scr_free(session, &key);
* Dump a column-store skiplist.
*/
static void
-__debug_col_skip(WT_DBG *ds, WT_INSERT_HEAD *head, const char *tag, int hexbyte)
+__debug_col_skip(
+ WT_DBG *ds, WT_INSERT_HEAD *head, const char *tag, bool hexbyte)
{
WT_INSERT *ins;
@@ -892,7 +894,7 @@ __debug_row_skip(WT_DBG *ds, WT_INSERT_HEAD *head)
WT_SKIP_FOREACH(ins, head) {
__debug_item(ds,
"insert", WT_INSERT_KEY(ins), WT_INSERT_KEY_SIZE(ins));
- __debug_update(ds, ins->upd, 0);
+ __debug_update(ds, ins->upd, false);
}
}
@@ -901,7 +903,7 @@ __debug_row_skip(WT_DBG *ds, WT_INSERT_HEAD *head)
* Dump an update list.
*/
static void
-__debug_update(WT_DBG *ds, WT_UPDATE *upd, int hexbyte)
+__debug_update(WT_DBG *ds, WT_UPDATE *upd, bool hexbyte)
{
for (; upd != NULL; upd = upd->next)
if (WT_UPDATE_DELETED_ISSET(upd))
diff --git a/src/third_party/wiredtiger/src/btree/bt_delete.c b/src/third_party/wiredtiger/src/btree/bt_delete.c
index cddfa0ef801..1da2923489c 100644
--- a/src/third_party/wiredtiger/src/btree/bt_delete.c
+++ b/src/third_party/wiredtiger/src/btree/bt_delete.c
@@ -61,12 +61,12 @@
* If deleting a range, try to delete the page without instantiating it.
*/
int
-__wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
+__wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp)
{
WT_DECL_RET;
WT_PAGE *parent;
- *skipp = 0;
+ *skipp = false;
/* If we have a clean page in memory, attempt to evict it. */
if (ref->state == WT_REF_MEM &&
@@ -126,7 +126,7 @@ __wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
* future reconciliation of the child leaf page that will dirty it as
* we write the tree.
*/
- WT_ERR(__wt_page_parent_modify_set(session, ref, 0));
+ WT_ERR(__wt_page_parent_modify_set(session, ref, false));
/*
* Record the change in the transaction structure and set the change's
@@ -137,7 +137,7 @@ __wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
WT_ERR(__wt_txn_modify_ref(session, ref));
- *skipp = 1;
+ *skipp = true;
WT_PUBLISH(ref->state, WT_REF_DELETED);
return (0);
@@ -216,10 +216,10 @@ __wt_delete_page_rollback(WT_SESSION_IMPL *session, WT_REF *ref)
* __wt_delete_page_skip --
* If iterating a cursor, skip deleted pages that are visible to us.
*/
-int
+bool
__wt_delete_page_skip(WT_SESSION_IMPL *session, WT_REF *ref)
{
- int skip;
+ bool skip;
/*
* Deleted pages come from two sources: either it's a fast-delete as
@@ -240,10 +240,10 @@ __wt_delete_page_skip(WT_SESSION_IMPL *session, WT_REF *ref)
* the structure, just to be safe.
*/
if (ref->page_del == NULL)
- return (1);
+ return (true);
if (!__wt_atomic_casv32(&ref->state, WT_REF_DELETED, WT_REF_LOCKED))
- return (0);
+ return (false);
skip = (ref->page_del == NULL ||
__wt_txn_visible(session, ref->page_del->txnid));
diff --git a/src/third_party/wiredtiger/src/btree/bt_discard.c b/src/third_party/wiredtiger/src/btree/bt_discard.c
index a05c6217338..c876da6309c 100644
--- a/src/third_party/wiredtiger/src/btree/bt_discard.c
+++ b/src/third_party/wiredtiger/src/btree/bt_discard.c
@@ -148,7 +148,7 @@ __free_page_modify(WT_SESSION_IMPL *session, WT_PAGE *page)
mod = page->modify;
- switch (F_ISSET(mod, WT_PM_REC_MASK)) {
+ switch (mod->rec_result) {
case WT_PM_REC_MULTIBLOCK:
case WT_PM_REC_REWRITE:
/* Free list of replacement blocks. */
@@ -210,7 +210,7 @@ __free_page_modify(WT_SESSION_IMPL *session, WT_PAGE *page)
static void
__free_page_int(WT_SESSION_IMPL *session, WT_PAGE *page)
{
- __wt_free_ref_index(session, page, WT_INTL_INDEX_GET_SAFE(page), 0);
+ __wt_free_ref_index(session, page, WT_INTL_INDEX_GET_SAFE(page), false);
}
/*
@@ -220,7 +220,7 @@ __free_page_int(WT_SESSION_IMPL *session, WT_PAGE *page)
*/
void
__wt_free_ref(
- WT_SESSION_IMPL *session, WT_PAGE *page, WT_REF *ref, int free_pages)
+ WT_SESSION_IMPL *session, WT_PAGE *page, WT_REF *ref, bool free_pages)
{
WT_IKEY *ikey;
@@ -272,7 +272,7 @@ __wt_free_ref(
*/
void
__wt_free_ref_index(WT_SESSION_IMPL *session,
- WT_PAGE *page, WT_PAGE_INDEX *pindex, int free_pages)
+ WT_PAGE *page, WT_PAGE_INDEX *pindex, bool free_pages)
{
uint32_t i;
diff --git a/src/third_party/wiredtiger/src/btree/bt_handle.c b/src/third_party/wiredtiger/src/btree/bt_handle.c
index e249f997d87..f9ddc7f2dd3 100644
--- a/src/third_party/wiredtiger/src/btree/bt_handle.c
+++ b/src/third_party/wiredtiger/src/btree/bt_handle.c
@@ -12,7 +12,7 @@ static int __btree_conf(WT_SESSION_IMPL *, WT_CKPT *ckpt);
static int __btree_get_last_recno(WT_SESSION_IMPL *);
static int __btree_page_sizes(WT_SESSION_IMPL *);
static int __btree_preload(WT_SESSION_IMPL *);
-static int __btree_tree_open_empty(WT_SESSION_IMPL *, int);
+static int __btree_tree_open_empty(WT_SESSION_IMPL *, bool);
/*
* __wt_btree_open --
@@ -29,14 +29,14 @@ __wt_btree_open(WT_SESSION_IMPL *session, const char *op_cfg[])
WT_DECL_RET;
size_t root_addr_size;
uint8_t root_addr[WT_BTREE_MAX_ADDR_COOKIE];
- int creation, forced_salvage, readonly;
const char *filename;
+ bool creation, forced_salvage, readonly;
dhandle = session->dhandle;
btree = S2BT(session);
/* Checkpoint files are readonly. */
- readonly = dhandle->checkpoint == NULL ? 0 : 1;
+ readonly = dhandle->checkpoint != NULL;
/* Get the checkpoint information for this name/checkpoint pair. */
WT_CLEAR(ckpt);
@@ -53,10 +53,10 @@ __wt_btree_open(WT_SESSION_IMPL *session, const char *op_cfg[])
"bulk-load is only supported on newly created objects");
/* Handle salvage configuration. */
- forced_salvage = 0;
+ forced_salvage = false;
if (F_ISSET(btree, WT_BTREE_SALVAGE)) {
WT_ERR(__wt_config_gets(session, op_cfg, "force", &cval));
- forced_salvage = (cval.val != 0);
+ forced_salvage = cval.val != 0;
}
/* Initialize and configure the WT_BTREE structure. */
@@ -171,7 +171,7 @@ __wt_btree_close(WT_SESSION_IMPL *session)
}
btree->collator = NULL;
- btree->bulk_load_ok = 0;
+ btree->bulk_load_ok = false;
return (ret);
}
@@ -187,7 +187,7 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt)
WT_CONFIG_ITEM cval, metadata;
int64_t maj_version, min_version;
uint32_t bitcnt;
- int fixed;
+ bool fixed;
const char **cfg;
btree = S2BT(session);
@@ -289,11 +289,11 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt)
case BTREE_ROW:
WT_RET(__wt_config_gets(
session, cfg, "internal_key_truncate", &cval));
- btree->internal_key_truncate = cval.val == 0 ? 0 : 1;
+ btree->internal_key_truncate = cval.val != 0;
WT_RET(__wt_config_gets(
session, cfg, "prefix_compression", &cval));
- btree->prefix_compression = cval.val == 0 ? 0 : 1;
+ btree->prefix_compression = cval.val != 0;
WT_RET(__wt_config_gets(
session, cfg, "prefix_compression_min", &cval));
btree->prefix_compression_min = (u_int)cval.val;
@@ -325,7 +325,7 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt)
* Initialize a tree root reference, and link in the root page.
*/
void
-__wt_root_ref_init(WT_REF *root_ref, WT_PAGE *root, int is_recno)
+__wt_root_ref_init(WT_REF *root_ref, WT_PAGE *root, bool is_recno)
{
memset(root_ref, 0, sizeof(*root_ref));
@@ -381,7 +381,7 @@ err: __wt_buf_free(session, &dsk);
* Create an empty in-memory tree.
*/
static int
-__btree_tree_open_empty(WT_SESSION_IMPL *session, int creation)
+__btree_tree_open_empty(WT_SESSION_IMPL *session, bool creation)
{
WT_BTREE *btree;
WT_DECL_RET;
@@ -400,8 +400,8 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session, int creation)
* globally, there's no point in searching empty trees for eviction.
*/
if (creation) {
- btree->bulk_load_ok = 1;
- __wt_btree_evictable(session, 0);
+ btree->bulk_load_ok = true;
+ __wt_btree_evictable(session, false);
}
/*
@@ -418,8 +418,8 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session, int creation)
switch (btree->type) {
case BTREE_COL_FIX:
case BTREE_COL_VAR:
- WT_ERR(
- __wt_page_alloc(session, WT_PAGE_COL_INT, 1, 1, 1, &root));
+ WT_ERR(__wt_page_alloc(
+ session, WT_PAGE_COL_INT, 1, 1, true, &root));
root->pg_intl_parent_ref = &btree->root;
pindex = WT_INTL_INDEX_GET_SAFE(root);
@@ -431,8 +431,8 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session, int creation)
ref->key.recno = 1;
break;
case BTREE_ROW:
- WT_ERR(
- __wt_page_alloc(session, WT_PAGE_ROW_INT, 0, 1, 1, &root));
+ WT_ERR(__wt_page_alloc(
+ session, WT_PAGE_ROW_INT, 0, 1, true, &root));
root->pg_intl_parent_ref = &btree->root;
pindex = WT_INTL_INDEX_GET_SAFE(root);
@@ -480,16 +480,16 @@ __wt_btree_new_leaf_page(WT_SESSION_IMPL *session, WT_PAGE **pagep)
switch (btree->type) {
case BTREE_COL_FIX:
- WT_RET(
- __wt_page_alloc(session, WT_PAGE_COL_FIX, 1, 0, 0, pagep));
+ WT_RET(__wt_page_alloc(
+ session, WT_PAGE_COL_FIX, 1, 0, false, pagep));
break;
case BTREE_COL_VAR:
- WT_RET(
- __wt_page_alloc(session, WT_PAGE_COL_VAR, 1, 0, 0, pagep));
+ WT_RET(__wt_page_alloc(
+ session, WT_PAGE_COL_VAR, 1, 0, false, pagep));
break;
case BTREE_ROW:
- WT_RET(
- __wt_page_alloc(session, WT_PAGE_ROW_LEAF, 0, 0, 0, pagep));
+ WT_RET(__wt_page_alloc(
+ session, WT_PAGE_ROW_LEAF, 0, 0, false, pagep));
break;
WT_ILLEGAL_VALUE(session);
}
@@ -501,7 +501,7 @@ __wt_btree_new_leaf_page(WT_SESSION_IMPL *session, WT_PAGE **pagep)
* Setup or release a cache-resident tree.
*/
void
-__wt_btree_evictable(WT_SESSION_IMPL *session, int on)
+__wt_btree_evictable(WT_SESSION_IMPL *session, bool on)
{
WT_BTREE *btree;
diff --git a/src/third_party/wiredtiger/src/btree/bt_huffman.c b/src/third_party/wiredtiger/src/btree/bt_huffman.c
index c75e9dfed83..2d59a9ac977 100644
--- a/src/third_party/wiredtiger/src/btree/bt_huffman.c
+++ b/src/third_party/wiredtiger/src/btree/bt_huffman.c
@@ -134,7 +134,7 @@ static int __wt_huffman_read(WT_SESSION_IMPL *,
*/
static int
__huffman_confchk_file(
- WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v, int *is_utf8p, FILE **fpp)
+ WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v, bool *is_utf8p, FILE **fpp)
{
FILE *fp;
WT_DECL_RET;
@@ -302,7 +302,7 @@ __wt_huffman_read(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *ip,
WT_DECL_RET;
int64_t symbol, frequency;
u_int entries, lineno;
- int is_utf8;
+ bool is_utf8;
*tablep = NULL;
*entriesp = *numbytesp = 0;
diff --git a/src/third_party/wiredtiger/src/btree/bt_io.c b/src/third_party/wiredtiger/src/btree/bt_io.c
index 3ff395dbbfd..226f9827f51 100644
--- a/src/third_party/wiredtiger/src/btree/bt_io.c
+++ b/src/third_party/wiredtiger/src/btree/bt_io.c
@@ -128,7 +128,7 @@ err: __wt_scr_free(session, &tmp);
*/
int
__wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf,
- uint8_t *addr, size_t *addr_sizep, int checkpoint, int compressed)
+ uint8_t *addr, size_t *addr_sizep, bool checkpoint, bool compressed)
{
WT_BM *bm;
WT_BTREE *btree;
@@ -136,17 +136,18 @@ __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf,
WT_DECL_ITEM(tmp);
WT_DECL_RET;
WT_PAGE_HEADER *dsk;
- size_t len, src_len, dst_len, result_len, size;
- int data_cksum, compression_failed;
- uint8_t *src, *dst;
+ size_t dst_len, len, result_len, size, src_len;
+ int compression_failed; /* Extension API, so not a bool. */
+ uint8_t *dst, *src;
+ bool data_cksum;
btree = S2BT(session);
bm = btree->bm;
/* Checkpoint calls are different than standard calls. */
WT_ASSERT(session,
- (checkpoint == 0 && addr != NULL && addr_sizep != NULL) ||
- (checkpoint == 1 && addr == NULL && addr_sizep == NULL));
+ (!checkpoint && addr != NULL && addr_sizep != NULL) ||
+ (checkpoint && addr == NULL && addr_sizep == NULL));
#ifdef HAVE_DIAGNOSTIC
/*
@@ -237,7 +238,7 @@ __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf,
ip = buf;
WT_STAT_FAST_DATA_INCR(session, compress_write_fail);
} else {
- compressed = 1;
+ compressed = true;
WT_STAT_FAST_DATA_INCR(session, compress_write);
/*
@@ -278,10 +279,10 @@ __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf,
*/
switch (btree->checksum) {
case CKSUM_ON:
- data_cksum = 1;
+ data_cksum = true;
break;
case CKSUM_OFF:
- data_cksum = 0;
+ data_cksum = false;
break;
case CKSUM_UNCOMPRESSED:
default:
diff --git a/src/third_party/wiredtiger/src/btree/bt_ovfl.c b/src/third_party/wiredtiger/src/btree/bt_ovfl.c
index d8456c5b61f..651cbc8d4ad 100644
--- a/src/third_party/wiredtiger/src/btree/bt_ovfl.c
+++ b/src/third_party/wiredtiger/src/btree/bt_ovfl.c
@@ -79,7 +79,7 @@ __wt_ovfl_read(WT_SESSION_IMPL *session,
* __ovfl_cache_col_visible --
* column-store: check for a globally visible update.
*/
-static int
+static bool
__ovfl_cache_col_visible(
WT_SESSION_IMPL *session, WT_UPDATE *upd, WT_CELL_UNPACK *unpack)
{
@@ -99,15 +99,15 @@ __ovfl_cache_col_visible(
if (__wt_cell_rle(unpack) == 1 &&
upd != NULL && /* Sanity: upd should always be set. */
__wt_txn_visible_all(session, upd->txnid))
- return (1);
- return (0);
+ return (true);
+ return (false);
}
/*
* __ovfl_cache_row_visible --
* row-store: check for a globally visible update.
*/
-static int
+static bool
__ovfl_cache_row_visible(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip)
{
WT_UPDATE *upd;
@@ -115,9 +115,9 @@ __ovfl_cache_row_visible(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip)
/* Check to see if there's a globally visible update. */
for (upd = WT_ROW_UPDATE(page, rip); upd != NULL; upd = upd->next)
if (__wt_txn_visible_all(session, upd->txnid))
- return (1);
+ return (true);
- return (0);
+ return (false);
}
/*
@@ -154,7 +154,7 @@ int
__wt_ovfl_cache(WT_SESSION_IMPL *session,
WT_PAGE *page, void *cookie, WT_CELL_UNPACK *vpack)
{
- int visible;
+ bool visible;
/*
* This function solves a problem in reconciliation. The scenario is:
diff --git a/src/third_party/wiredtiger/src/btree/bt_page.c b/src/third_party/wiredtiger/src/btree/bt_page.c
index 3ae3ee23e58..41cc8f9398c 100644
--- a/src/third_party/wiredtiger/src/btree/bt_page.c
+++ b/src/third_party/wiredtiger/src/btree/bt_page.c
@@ -53,7 +53,7 @@ __evict_force_check(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t flags)
__wt_txn_update_oldest(session, 0);
/* If eviction cannot succeed, don't try. */
- return (__wt_page_can_evict(session, page, 1));
+ return (__wt_page_can_evict(session, page, 1, NULL));
}
/*
@@ -71,9 +71,10 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags
WT_DECL_RET;
WT_PAGE *page;
u_int sleep_cnt, wait_cnt;
- int busy, force_attempts, oldgen;
+ int force_attempts;
+ bool busy, oldgen;
- for (force_attempts = oldgen = 0, wait_cnt = 0;;) {
+ for (force_attempts = 0, oldgen = false, wait_cnt = 0;;) {
switch (ref->state) {
case WT_REF_DISK:
case WT_REF_DELETED:
@@ -208,7 +209,7 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags
*/
int
__wt_page_alloc(WT_SESSION_IMPL *session, uint8_t type,
- uint64_t recno, uint32_t alloc_entries, int alloc_refs, WT_PAGE **pagep)
+ uint64_t recno, uint32_t alloc_entries, bool alloc_refs, WT_PAGE **pagep)
{
WT_CACHE *cache;
WT_DECL_RET;
@@ -378,7 +379,7 @@ __wt_page_inmem(WT_SESSION_IMPL *session, WT_REF *ref,
/* Allocate and initialize a new WT_PAGE. */
WT_RET(__wt_page_alloc(
- session, dsk->type, dsk->recno, alloc_entries, 1, &page));
+ session, dsk->type, dsk->recno, alloc_entries, true, &page));
page->dsk = dsk;
F_SET_ATOMIC(page, flags);
diff --git a/src/third_party/wiredtiger/src/btree/bt_read.c b/src/third_party/wiredtiger/src/btree/bt_read.c
index a3ce39b7758..0d2422727d0 100644
--- a/src/third_party/wiredtiger/src/btree/bt_read.c
+++ b/src/third_party/wiredtiger/src/btree/bt_read.c
@@ -10,7 +10,7 @@
/*
* __wt_cache_read --
- * Read a page from the file.
+ * Read a page from the file into cache.
*/
int
__wt_cache_read(WT_SESSION_IMPL *session, WT_REF *ref)
diff --git a/src/third_party/wiredtiger/src/btree/bt_ret.c b/src/third_party/wiredtiger/src/btree/bt_ret.c
index c37ff6dc809..cc92b1e02e3 100644
--- a/src/third_party/wiredtiger/src/btree/bt_ret.c
+++ b/src/third_party/wiredtiger/src/btree/bt_ret.c
@@ -83,7 +83,7 @@ __wt_kv_return(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_UPDATE *upd)
cursor->key.size = cbt->search_key.size;
} else
WT_RET(__wt_row_leaf_key(
- session, page, rip, &cursor->key, 0));
+ session, page, rip, &cursor->key, false));
/* If the cursor references a WT_UPDATE item, return it. */
if (upd != NULL) {
diff --git a/src/third_party/wiredtiger/src/btree/bt_slvg.c b/src/third_party/wiredtiger/src/btree/bt_slvg.c
index e493a84679a..89355baeb5c 100644
--- a/src/third_party/wiredtiger/src/btree/bt_slvg.c
+++ b/src/third_party/wiredtiger/src/btree/bt_slvg.c
@@ -32,7 +32,7 @@ struct __wt_stuff {
uint8_t page_type; /* Page type */
/* If need to free blocks backing merged page ranges. */
- int merge_free;
+ bool merge_free;
WT_ITEM *tmp1; /* Verbose print buffer */
WT_ITEM *tmp2; /* Verbose print buffer */
@@ -127,7 +127,7 @@ static int __slvg_merge_block_free(WT_SESSION_IMPL *, WT_STUFF *);
static int WT_CDECL __slvg_ovfl_compare(const void *, const void *);
static int __slvg_ovfl_discard(WT_SESSION_IMPL *, WT_STUFF *);
static int __slvg_ovfl_reconcile(WT_SESSION_IMPL *, WT_STUFF *);
-static int __slvg_ovfl_ref(WT_SESSION_IMPL *, WT_TRACK *, int);
+static int __slvg_ovfl_ref(WT_SESSION_IMPL *, WT_TRACK *, bool);
static int __slvg_ovfl_ref_all(WT_SESSION_IMPL *, WT_TRACK *);
static int __slvg_read(WT_SESSION_IMPL *, WT_STUFF *);
static int __slvg_row_build_internal(WT_SESSION_IMPL *, uint32_t, WT_STUFF *);
@@ -143,7 +143,7 @@ static int __slvg_row_trk_update_start(
static int WT_CDECL __slvg_trk_compare_addr(const void *, const void *);
static int WT_CDECL __slvg_trk_compare_gen(const void *, const void *);
static int WT_CDECL __slvg_trk_compare_key(const void *, const void *);
-static int __slvg_trk_free(WT_SESSION_IMPL *, WT_TRACK **, int);
+static int __slvg_trk_free(WT_SESSION_IMPL *, WT_TRACK **, bool);
static void __slvg_trk_free_addr(WT_SESSION_IMPL *, WT_TRACK *);
static int __slvg_trk_init(WT_SESSION_IMPL *, uint8_t *,
size_t, uint32_t, uint64_t, WT_STUFF *, WT_TRACK **);
@@ -369,7 +369,7 @@ __slvg_read(WT_SESSION_IMPL *session, WT_STUFF *ss)
const WT_PAGE_HEADER *dsk;
size_t addr_size;
uint8_t addr[WT_BTREE_MAX_ADDR_COOKIE];
- int eof, valid;
+ bool eof, valid;
bm = S2BT(session)->bm;
WT_ERR(__wt_scr_alloc(session, 0, &as));
@@ -394,9 +394,9 @@ __slvg_read(WT_SESSION_IMPL *session, WT_STUFF *ss)
* Report the block's status to the block manager.
*/
if ((ret = __wt_bt_read(session, buf, addr, addr_size)) == 0)
- valid = 1;
+ valid = true;
else {
- valid = 0;
+ valid = false;
if (ret == WT_ERROR)
ret = 0;
WT_ERR(ret);
@@ -1010,8 +1010,8 @@ delete_b: /*
if (b_trk->shared->ref == 1)
for (i = 0; i < b_trk->trk_ovfl_cnt; ++i)
WT_RET(__slvg_trk_free(session,
- &ss->ovfl[b_trk->trk_ovfl_slot[i]], 1));
- return (__slvg_trk_free(session, &ss->pages[b_slot], 1));
+ &ss->ovfl[b_trk->trk_ovfl_slot[i]], true));
+ return (__slvg_trk_free(session, &ss->pages[b_slot], true));
}
/*
@@ -1171,8 +1171,8 @@ __slvg_col_build_internal(
addr = NULL;
/* Allocate a column-store root (internal) page and fill it in. */
- WT_RET(
- __wt_page_alloc(session, WT_PAGE_COL_INT, 1, leaf_cnt, 1, &page));
+ WT_RET(__wt_page_alloc(
+ session, WT_PAGE_COL_INT, 1, leaf_cnt, true, &page));
WT_ERR(__slvg_modify_init(session, page));
WT_INTL_INDEX_GET(session, page, pindex);
@@ -1208,7 +1208,7 @@ __slvg_col_build_internal(
* additional pass to free the merge page's backing blocks.
*/
if (F_ISSET(trk, WT_TRACK_MERGE)) {
- ss->merge_free = 1;
+ ss->merge_free = true;
WT_ERR(__slvg_col_build_leaf(session, trk, ref));
} else
@@ -1216,7 +1216,7 @@ __slvg_col_build_internal(
++ref;
}
- __wt_root_ref_init(&ss->root_ref, page, 1);
+ __wt_root_ref_init(&ss->root_ref, page, true);
if (0) {
err: if (addr != NULL)
@@ -1342,7 +1342,7 @@ __slvg_col_ovfl_single(
ovfl = trk->ss->ovfl[trk->trk_ovfl_slot[i]];
if (unpack->size == ovfl->trk_addr_size &&
memcmp(unpack->data, ovfl->trk_addr, unpack->size) == 0)
- return (__slvg_ovfl_ref(session, ovfl, 0));
+ return (__slvg_ovfl_ref(session, ovfl, false));
}
WT_PANIC_RET(session,
@@ -1643,8 +1643,8 @@ delete_b: /*
if (b_trk->shared->ref == 1)
for (i = 0; i < b_trk->trk_ovfl_cnt; ++i)
WT_RET(__slvg_trk_free(session,
- &ss->ovfl[b_trk->trk_ovfl_slot[i]], 1));
- return (__slvg_trk_free(session, &ss->pages[b_slot], 1));
+ &ss->ovfl[b_trk->trk_ovfl_slot[i]], true));
+ return (__slvg_trk_free(session, &ss->pages[b_slot], true));
}
/*
@@ -1714,11 +1714,12 @@ __slvg_row_trk_update_start(
WT_ROW *rip;
WT_TRACK *trk;
uint32_t i;
- int cmp, found;
+ int cmp;
+ bool found;
btree = S2BT(session);
page = NULL;
- found = 0;
+ found = false;
trk = ss->pages[slot];
@@ -1752,10 +1753,10 @@ __slvg_row_trk_update_start(
*/
WT_ERR(__wt_scr_alloc(session, 0, &key));
WT_ROW_FOREACH(page, rip, i) {
- WT_ERR(__wt_row_leaf_key(session, page, rip, key, 0));
+ WT_ERR(__wt_row_leaf_key(session, page, rip, key, false));
WT_ERR(__wt_compare(session, btree->collator, key, stop, &cmp));
if (cmp > 0) {
- found = 1;
+ found = true;
break;
}
}
@@ -1816,8 +1817,8 @@ __slvg_row_build_internal(
addr = NULL;
/* Allocate a row-store root (internal) page and fill it in. */
- WT_RET(
- __wt_page_alloc(session, WT_PAGE_ROW_INT, 0, leaf_cnt, 1, &page));
+ WT_RET(__wt_page_alloc(
+ session, WT_PAGE_ROW_INT, 0, leaf_cnt, true, &page));
WT_ERR(__slvg_modify_init(session, page));
WT_INTL_INDEX_GET(session, page, pindex);
@@ -1853,7 +1854,7 @@ __slvg_row_build_internal(
* additional pass to free the merge page's backing blocks.
*/
if (F_ISSET(trk, WT_TRACK_MERGE)) {
- ss->merge_free = 1;
+ ss->merge_free = true;
WT_ERR(__slvg_row_build_leaf(session, trk, ref, ss));
} else {
@@ -1865,7 +1866,7 @@ __slvg_row_build_internal(
++ref;
}
- __wt_root_ref_init(&ss->root_ref, page, 0);
+ __wt_root_ref_init(&ss->root_ref, page, false);
if (0) {
err: if (addr != NULL)
@@ -1923,7 +1924,8 @@ __slvg_row_build_leaf(
skip_start = skip_stop = 0;
if (F_ISSET(trk, WT_TRACK_CHECK_START))
WT_ROW_FOREACH(page, rip, i) {
- WT_ERR(__wt_row_leaf_key(session, page, rip, key, 0));
+ WT_ERR(
+ __wt_row_leaf_key(session, page, rip, key, false));
/*
* >= is correct: see the comment above.
@@ -1946,7 +1948,8 @@ __slvg_row_build_leaf(
}
if (F_ISSET(trk, WT_TRACK_CHECK_STOP))
WT_ROW_FOREACH_REVERSE(page, rip, i) {
- WT_ERR(__wt_row_leaf_key(session, page, rip, key, 0));
+ WT_ERR(
+ __wt_row_leaf_key(session, page, rip, key, false));
/*
* < is correct: see the comment above.
@@ -1979,7 +1982,7 @@ __slvg_row_build_leaf(
* a copy from the page.
*/
rip = page->pg_row_d + skip_start;
- WT_ERR(__wt_row_leaf_key(session, page, rip, key, 0));
+ WT_ERR(__wt_row_leaf_key(session, page, rip, key, false));
WT_ERR(__wt_row_ikey_incr(
session, ref->home, 0, key->data, key->size, ref));
@@ -2058,7 +2061,7 @@ __slvg_row_ovfl_single(WT_SESSION_IMPL *session, WT_TRACK *trk, WT_CELL *cell)
ovfl = trk->ss->ovfl[trk->trk_ovfl_slot[i]];
if (unpack.size == ovfl->trk_addr_size &&
memcmp(unpack.data, ovfl->trk_addr, unpack.size) == 0)
- return (__slvg_ovfl_ref(session, ovfl, 1));
+ return (__slvg_ovfl_ref(session, ovfl, true));
}
WT_PANIC_RET(session,
@@ -2218,7 +2221,7 @@ __slvg_ovfl_reconcile(WT_SESSION_IMPL *session, WT_STUFF *ss)
while (j > 0)
F_CLR(ss->ovfl[slot[--j]], WT_TRACK_OVFL_REFD);
trk = NULL;
- WT_ERR(__slvg_trk_free(session, &ss->pages[i], 1));
+ WT_ERR(__slvg_trk_free(session, &ss->pages[i], true));
break;
}
@@ -2337,7 +2340,7 @@ __slvg_merge_block_free(WT_SESSION_IMPL *session, WT_STUFF *ss)
if ((trk = ss->pages[i]) == NULL)
continue;
if (F_ISSET(trk, WT_TRACK_MERGE))
- WT_RET(__slvg_trk_free(session, &ss->pages[i], 1));
+ WT_RET(__slvg_trk_free(session, &ss->pages[i], true));
}
/* Free any unused overflow records. */
@@ -2349,7 +2352,7 @@ __slvg_merge_block_free(WT_SESSION_IMPL *session, WT_STUFF *ss)
* Reference an overflow page, checking for multiple references.
*/
static int
-__slvg_ovfl_ref(WT_SESSION_IMPL *session, WT_TRACK *trk, int multi_panic)
+__slvg_ovfl_ref(WT_SESSION_IMPL *session, WT_TRACK *trk, bool multi_panic)
{
if (F_ISSET(trk, WT_TRACK_OVFL_REFD)) {
if (!multi_panic)
@@ -2408,7 +2411,7 @@ __slvg_ovfl_discard(WT_SESSION_IMPL *session, WT_STUFF *ss)
"%s unused overflow page",
__wt_addr_string(
session, trk->trk_addr, trk->trk_addr_size, ss->tmp1)));
- WT_RET(__slvg_trk_free(session, &ss->ovfl[i], 1));
+ WT_RET(__slvg_trk_free(session, &ss->ovfl[i], true));
}
return (0);
@@ -2426,13 +2429,13 @@ __slvg_cleanup(WT_SESSION_IMPL *session, WT_STUFF *ss)
/* Discard the leaf page array. */
for (i = 0; i < ss->pages_next; ++i)
if (ss->pages[i] != NULL)
- WT_RET(__slvg_trk_free(session, &ss->pages[i], 0));
+ WT_RET(__slvg_trk_free(session, &ss->pages[i], false));
__wt_free(session, ss->pages);
/* Discard the ovfl page array. */
for (i = 0; i < ss->ovfl_next; ++i)
if (ss->ovfl[i] != NULL)
- WT_RET(__slvg_trk_free(session, &ss->ovfl[i], 0));
+ WT_RET(__slvg_trk_free(session, &ss->ovfl[i], false));
__wt_free(session, ss->ovfl);
return (0);
@@ -2482,7 +2485,8 @@ __slvg_trk_free_block(WT_SESSION_IMPL *session, WT_TRACK *trk)
* Discard a WT_TRACK structure and (optionally) its underlying blocks.
*/
static int
-__slvg_trk_free(WT_SESSION_IMPL *session, WT_TRACK **trkp, int free_on_last_ref)
+__slvg_trk_free(
+ WT_SESSION_IMPL *session, WT_TRACK **trkp, bool free_on_last_ref)
{
WT_TRACK *trk;
diff --git a/src/third_party/wiredtiger/src/btree/bt_split.c b/src/third_party/wiredtiger/src/btree/bt_split.c
index 98102b76398..be7dc27c8b0 100644
--- a/src/third_party/wiredtiger/src/btree/bt_split.c
+++ b/src/third_party/wiredtiger/src/btree/bt_split.c
@@ -145,16 +145,16 @@ __wt_split_stash_discard_all(
*/
static int
__split_safe_free(WT_SESSION_IMPL *session,
- uint64_t split_gen, int exclusive, void *p, size_t s)
+ uint64_t split_gen, bool closing, void *p, size_t s)
{
/*
- * We have swapped something in a page: if we don't have exclusive
+ * We have swapped something in a page: if we don't have closing
* access, check whether there are other threads in the same tree.
*/
- if (!exclusive && __split_oldest_gen(session) > split_gen)
- exclusive = 1;
+ if (!closing && __split_oldest_gen(session) > split_gen)
+ closing = true;
- if (exclusive) {
+ if (closing) {
__wt_free(session, p);
return (0);
}
@@ -166,7 +166,7 @@ __split_safe_free(WT_SESSION_IMPL *session,
* __split_should_deepen --
* Return if we should deepen the tree.
*/
-static int
+static bool
__split_should_deepen(
WT_SESSION_IMPL *session, WT_REF *ref, uint32_t *childrenp)
{
@@ -186,7 +186,7 @@ __split_should_deepen(
* pressure on the cache).
*/
if (page->memory_footprint < btree->maxmempage)
- return (0);
+ return (false);
/*
* Ensure the page has enough entries to make it worth splitting and
@@ -195,7 +195,7 @@ __split_should_deepen(
*/
if (pindex->entries > btree->split_deepen_min_child) {
*childrenp = pindex->entries / btree->split_deepen_per_child;
- return (1);
+ return (true);
}
/*
@@ -209,10 +209,10 @@ __split_should_deepen(
(__wt_ref_is_root(ref) ||
page->memory_footprint >= S2C(session)->cache_size / 4)) {
*childrenp = pindex->entries / 10;
- return (1);
+ return (true);
}
- return (0);
+ return (false);
}
/*
@@ -331,7 +331,8 @@ __split_verify_intl_key_order(WT_SESSION_IMPL *session, WT_PAGE *page)
WT_ITEM *next, _next, *last, _last, *tmp;
WT_REF *ref;
uint64_t recno;
- int cmp, first;
+ int cmp;
+ bool first;
btree = S2BT(session);
@@ -349,12 +350,12 @@ __split_verify_intl_key_order(WT_SESSION_IMPL *session, WT_PAGE *page)
last = &_last;
WT_CLEAR(_last);
- first = 1;
+ first = true;
WT_INTL_FOREACH_BEGIN_SAFE(session, page, ref) {
__wt_ref_key(page, ref, &next->data, &next->size);
if (last->size == 0) {
if (first)
- first = 0;
+ first = false;
else {
WT_ASSERT(session, __wt_compare(
session, btree->collator, last,
@@ -386,12 +387,12 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent, uint32_t children)
size_t child_incr, parent_decr, parent_incr, size;
uint64_t split_gen;
uint32_t chunk, i, j, remain, slots;
- int panic;
+ bool panic;
void *p;
alloc_index = NULL;
parent_incr = parent_decr = 0;
- panic = 0;
+ panic = false;
pindex = WT_INTL_INDEX_GET_SAFE(parent);
@@ -445,7 +446,7 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent, uint32_t children)
i = 0; i < children; ++i) {
slots = i == children - 1 ? remain : chunk;
WT_ERR(__wt_page_alloc(
- session, parent->type, 0, slots, 0, &child));
+ session, parent->type, 0, slots, false, &child));
/*
* Initialize the parent page's child reference; we need a copy
@@ -521,7 +522,7 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent, uint32_t children)
WT_ASSERT(session, WT_INTL_INDEX_GET_SAFE(parent) == pindex);
WT_INTL_INDEX_SET(parent, alloc_index);
split_gen = __wt_atomic_addv64(&S2C(session)->split_gen, 1);
- panic = 1;
+ panic = true;
#ifdef HAVE_DIAGNOSTIC
__split_verify_intl_key_order(session, parent);
@@ -600,7 +601,7 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent, uint32_t children)
__wt_cache_page_inmem_decr(session, parent, parent_decr);
if (0) {
-err: __wt_free_ref_index(session, parent, alloc_index, 1);
+err: __wt_free_ref_index(session, parent, alloc_index, true);
/*
* If panic is set, we saw an error after opening up the tree
@@ -669,7 +670,7 @@ __split_multi_inmem(
/* Apply the modification. */
WT_ERR(__wt_col_modify(
- session, &cbt, recno, NULL, upd, 0));
+ session, &cbt, recno, NULL, upd, false));
break;
case WT_PAGE_ROW_LEAF:
/* Build a key. */
@@ -679,7 +680,7 @@ __split_multi_inmem(
orig->pg_row_upd[slot] = NULL;
WT_ERR(__wt_row_leaf_key(
- session, orig, skip->rip, key, 0));
+ session, orig, skip->rip, key, false));
} else {
upd = skip->ins->upd;
skip->ins->upd = NULL;
@@ -689,11 +690,11 @@ __split_multi_inmem(
}
/* Search the page. */
- WT_ERR(__wt_row_search(session, key, ref, &cbt, 1));
+ WT_ERR(__wt_row_search(session, key, ref, &cbt, true));
/* Apply the modification. */
- WT_ERR(
- __wt_row_modify(session, &cbt, key, NULL, upd, 0));
+ WT_ERR(__wt_row_modify(
+ session, &cbt, key, NULL, upd, false));
break;
WT_ILLEGAL_VALUE_ERR(session);
}
@@ -786,30 +787,22 @@ __wt_multi_to_ref(WT_SESSION_IMPL *session,
}
/*
- * __split_parent --
- * Resolve a multi-page split, inserting new information into the parent.
+ * __split_parent_lock --
+ * Lock the parent page.
*/
static int
-__split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
- WT_REF **ref_new, uint32_t new_entries, size_t parent_incr, int exclusive)
+__split_parent_lock(
+ WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE **parentp, bool *hazardp)
{
WT_DECL_RET;
- WT_IKEY *ikey;
WT_PAGE *parent;
- WT_PAGE_INDEX *alloc_index, *pindex;
- WT_REF **alloc_refp, *next_ref, *parent_ref;
- size_t parent_decr, size;
- uint64_t split_gen;
- uint32_t children, i, j;
- uint32_t deleted_entries, parent_entries, result_entries;
- int complete, hazard;
+ WT_REF *parent_ref;
parent = NULL; /* -Wconditional-uninitialized */
- alloc_index = pindex = NULL;
parent_ref = NULL;
- parent_decr = 0;
- parent_entries = 0;
- complete = hazard = 0;
+
+ *hazardp = false;
+ *parentp = NULL;
/*
* Get a page-level lock on the parent to single-thread splits into the
@@ -849,9 +842,63 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
*/
if (!__wt_ref_is_root(parent_ref = parent->pg_intl_parent_ref)) {
WT_ERR(__wt_page_in(session, parent_ref, WT_READ_NO_EVICT));
- hazard = 1;
+ *hazardp = true;
}
+ *parentp = parent;
+ return (0);
+
+err: F_CLR_ATOMIC(parent, WT_PAGE_SPLIT_LOCKED);
+ return (ret);
+}
+
+/*
+ * __split_parent_unlock --
+ * Unlock the parent page.
+ */
+static int
+__split_parent_unlock(WT_SESSION_IMPL *session, WT_PAGE *parent, bool hazard)
+{
+ WT_DECL_RET;
+
+ if (hazard)
+ ret = __wt_hazard_clear(session, parent);
+
+ F_CLR_ATOMIC(parent, WT_PAGE_SPLIT_LOCKED);
+ return (ret);
+}
+
+/*
+ * __split_parent --
+ * Resolve a multi-page split, inserting new information into the parent.
+ */
+static int
+__split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
+ WT_REF **ref_new, uint32_t new_entries, size_t parent_incr, bool closing)
+{
+ WT_DECL_RET;
+ WT_IKEY *ikey;
+ WT_PAGE *parent;
+ WT_PAGE_INDEX *alloc_index, *pindex;
+ WT_REF **alloc_refp, *next_ref, *parent_ref;
+ size_t parent_decr, size;
+ uint64_t split_gen;
+ uint32_t i, j;
+ uint32_t children, deleted_entries, parent_entries, result_entries;
+ bool complete;
+
+ parent = ref->home;
+ parent_ref = parent->pg_intl_parent_ref;
+
+ alloc_index = pindex = NULL;
+ parent_decr = 0;
+ parent_entries = 0;
+ complete = false;
+
+ /*
+ * We've locked the parent, which means it cannot split (which is the
+ * only reason to worry about split generation values).
+ */
pindex = WT_INTL_INDEX_GET_SAFE(parent);
parent_entries = pindex->entries;
@@ -938,7 +985,7 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
* split is OK and complete. For those reasons, we ignore errors past
* this point unless there's a panic.
*/
- complete = 1;
+ complete = true;
WT_ERR(__wt_verbose(session, WT_VERB_SPLIT,
"%s split into parent %" PRIu32 " -> %" PRIu32
@@ -1007,7 +1054,7 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
* Add it to the session discard list, to be freed when it's safe.
*/
size = sizeof(WT_PAGE_INDEX) + pindex->entries * sizeof(WT_REF *);
- WT_TRET(__split_safe_free(session, split_gen, exclusive, pindex, size));
+ WT_TRET(__split_safe_free(session, split_gen, closing, pindex, size));
parent_decr += size;
/*
@@ -1032,7 +1079,7 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
* Do the check here because we've just grown the parent page and
* are holding it locked.
*/
- if (ret == 0 && !exclusive &&
+ if (ret == 0 && !closing &&
__split_should_deepen(session, parent_ref, &children))
ret = __split_deepen(session, parent, children);
@@ -1042,12 +1089,8 @@ err: if (!complete)
if (next_ref->state == WT_REF_SPLIT)
next_ref->state = WT_REF_DELETED;
}
- F_CLR_ATOMIC(parent, WT_PAGE_SPLIT_LOCKED);
- if (hazard)
- WT_TRET(__wt_hazard_clear(session, parent));
-
- __wt_free_ref_index(session, NULL, alloc_index, 0);
+ __wt_free_ref_index(session, NULL, alloc_index, false);
/*
* A note on error handling: if we completed the split, return success,
@@ -1061,14 +1104,12 @@ err: if (!complete)
}
/*
- * __wt_split_insert --
- * Check for pages with append-only workloads and split their last insert
- * list into a separate page.
+ * __split_insert --
+ * Split a page's last insert list entries into a separate page.
*/
-int
-__wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref, int *splitp)
+static int
+__split_insert(WT_SESSION_IMPL *session, WT_REF *ref)
{
- WT_BTREE *btree;
WT_DECL_RET;
WT_DECL_ITEM(key);
WT_INSERT *ins, **insp, *moved_ins, *prev_ins;
@@ -1078,63 +1119,28 @@ __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref, int *splitp)
size_t page_decr, parent_incr, right_incr;
int i;
- *splitp = 0;
-
- btree = S2BT(session);
page = ref->page;
right = NULL;
page_decr = parent_incr = right_incr = 0;
/*
- * Check for pages with append-only workloads. A common application
- * pattern is to have multiple threads frantically appending to the
- * tree. We want to reconcile and evict this page, but we'd like to
- * do it without making the appending threads wait. If we're not
- * discarding the tree, check and see if it's worth doing a split to
- * let the threads continue before doing eviction.
- *
- * Ignore anything other than large, dirty row-store leaf pages.
+ * Assert splitting makes sense; specifically assert the page is dirty,
+ * we depend on that, otherwise the page might be evicted based on its
+ * last reconciliation which no longer matches reality after the split.
*
- * XXX KEITH
- * Need a better test for append-only workloads.
+ * Note this page has already been through an in-memory split.
*/
- if (page->type != WT_PAGE_ROW_LEAF ||
- page->memory_footprint < btree->maxmempage ||
- !__wt_page_is_modified(page))
- return (0);
+ WT_ASSERT(session, __wt_page_can_split(session, page));
+ WT_ASSERT(session, __wt_page_is_modified(page));
+ F_SET_ATOMIC(page, WT_PAGE_SPLIT_INSERT);
- /*
- * There is no point splitting if the list is small, no deep items is
- * our heuristic for that. (A 1/4 probability of adding a new skiplist
- * level means there will be a new 6th level for roughly each 4KB of
- * entries in the list. If we have at least two 6th level entries, the
- * list is at least large enough to work with.)
- *
- * The following code requires at least two items on the insert list,
- * this test serves the additional purpose of confirming that.
- */
-#define WT_MIN_SPLIT_SKIPLIST_DEPTH WT_MIN(6, WT_SKIP_MAXDEPTH - 1)
+ /* Find the last item in the insert list. */
ins_head = page->pg_row_entries == 0 ?
WT_ROW_INSERT_SMALLEST(page) :
WT_ROW_INSERT_SLOT(page, page->pg_row_entries - 1);
- if (ins_head == NULL ||
- ins_head->head[WT_MIN_SPLIT_SKIPLIST_DEPTH] == NULL ||
- ins_head->head[WT_MIN_SPLIT_SKIPLIST_DEPTH] ==
- ins_head->tail[WT_MIN_SPLIT_SKIPLIST_DEPTH])
- return (0);
-
- /* Find the last item in the insert list. */
moved_ins = WT_SKIP_LAST(ins_head);
/*
- * Only split a page once, otherwise workloads that update in the middle
- * of the page could continually split without benefit.
- */
- if (F_ISSET_ATOMIC(page, WT_PAGE_SPLIT_INSERT))
- return (0);
- F_SET_ATOMIC(page, WT_PAGE_SPLIT_INSERT);
-
- /*
* The first page in the split is the current page, but we still have
* to create a replacement WT_REF, the original WT_REF will be set to
* split status and eventually freed.
@@ -1170,7 +1176,7 @@ __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref, int *splitp)
key->size = WT_INSERT_KEY_SIZE(ins);
} else
WT_ERR(__wt_row_leaf_key(
- session, page, &page->pg_row_d[0], key, 1));
+ session, page, &page->pg_row_d[0], key, true));
WT_ERR(__wt_row_ikey(session, 0, key->data, key->size, child));
parent_incr += sizeof(WT_REF) + sizeof(WT_IKEY) + key->size;
__wt_scr_free(session, &key);
@@ -1178,7 +1184,7 @@ __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref, int *splitp)
/*
* The second page in the split is a new WT_REF/page pair.
*/
- WT_ERR(__wt_page_alloc(session, WT_PAGE_ROW_LEAF, 0, 0, 0, &right));
+ WT_ERR(__wt_page_alloc(session, WT_PAGE_ROW_LEAF, 0, 0, false, &right));
WT_ERR(__wt_calloc_one(session, &right->pg_row_ins));
WT_ERR(__wt_calloc_one(session, &right->pg_row_ins[0]));
right_incr += sizeof(WT_INSERT_HEAD);
@@ -1325,7 +1331,7 @@ __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref, int *splitp)
*/
page = NULL;
if ((ret = __split_parent(
- session, ref, split_ref, 2, parent_incr, 0)) != 0) {
+ session, ref, split_ref, 2, parent_incr, false)) != 0) {
/*
* Move the insert list element back to the original page list.
* For simplicity, the previous skip list pointers originally
@@ -1348,9 +1354,6 @@ __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref, int *splitp)
WT_ERR(ret);
}
- /* Let our caller know that we split. */
- *splitp = 1;
-
WT_STAT_FAST_CONN_INCR(session, cache_inmem_split);
WT_STAT_FAST_DATA_INCR(session, cache_inmem_split);
@@ -1371,8 +1374,25 @@ err: if (split_ref[0] != NULL) {
}
/*
+ * __wt_split_insert --
+ * Lock, then split.
+ */
+int
+__wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref)
+{
+ WT_DECL_RET;
+ WT_PAGE *parent;
+ bool hazard;
+
+ WT_RET(__split_parent_lock(session, ref, &parent, &hazard));
+ ret = __split_insert(session, ref);
+ WT_TRET(__split_parent_unlock(session, parent, hazard));
+ return (ret);
+}
+
+/*
* __wt_split_rewrite --
- * Resolve a failed reconciliation by replacing a page with a new version.
+ * Rewrite an in-memory page with a new version.
*/
int
__wt_split_rewrite(WT_SESSION_IMPL *session, WT_REF *ref)
@@ -1415,11 +1435,11 @@ __wt_split_rewrite(WT_SESSION_IMPL *session, WT_REF *ref)
}
/*
- * __wt_split_multi --
- * Resolve a page split.
+ * __split_multi --
+ * Split a page into multiple pages.
*/
-int
-__wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
+static int
+__split_multi(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
{
WT_DECL_RET;
WT_PAGE *page;
@@ -1445,7 +1465,7 @@ __wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
/* Split into the parent. */
WT_ERR(__split_parent(
- session, ref, ref_new, new_entries, parent_incr, exclusive));
+ session, ref, ref_new, new_entries, parent_incr, closing));
WT_STAT_FAST_CONN_INCR(session, cache_eviction_split);
WT_STAT_FAST_DATA_INCR(session, cache_eviction_split);
@@ -1479,7 +1499,24 @@ err: /*
* For now, leak the memory by not discarding the instantiated pages.
*/
for (i = 0; i < new_entries; ++i)
- __wt_free_ref(session, page, ref_new[i], 0);
+ __wt_free_ref(session, page, ref_new[i], false);
__wt_free(session, ref_new);
return (ret);
}
+
+/*
+ * __wt_split_multi --
+ * Lock, then split.
+ */
+int
+__wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, int closing)
+{
+ WT_DECL_RET;
+ WT_PAGE *parent;
+ bool hazard;
+
+ WT_RET(__split_parent_lock(session, ref, &parent, &hazard));
+ ret = __split_multi(session, ref, closing);
+ WT_TRET(__split_parent_unlock(session, parent, hazard));
+ return (ret);
+}
diff --git a/src/third_party/wiredtiger/src/btree/bt_stat.c b/src/third_party/wiredtiger/src/btree/bt_stat.c
index 6285edde217..6775636dd40 100644
--- a/src/third_party/wiredtiger/src/btree/bt_stat.c
+++ b/src/third_party/wiredtiger/src/btree/bt_stat.c
@@ -113,7 +113,7 @@ __stat_page_col_var(WT_PAGE *page, WT_DSRC_STATS *stats)
WT_UPDATE *upd;
uint64_t deleted_cnt, entry_cnt, ovfl_cnt;
uint32_t i;
- int orig_deleted;
+ bool orig_deleted;
unpack = &_unpack;
deleted_cnt = entry_cnt = ovfl_cnt = 0;
@@ -130,13 +130,13 @@ __stat_page_col_var(WT_PAGE *page, WT_DSRC_STATS *stats)
*/
WT_COL_FOREACH(page, cip, i) {
if ((cell = WT_COL_PTR(page, cip)) == NULL) {
- orig_deleted = 1;
+ orig_deleted = true;
++deleted_cnt;
} else {
- orig_deleted = 0;
+ orig_deleted = false;
__wt_cell_unpack(cell, unpack);
if (unpack->type == WT_CELL_ADDR_DEL)
- orig_deleted = 1;
+ orig_deleted = true;
else
entry_cnt += __wt_cell_rle(unpack);
if (unpack->ovfl)
diff --git a/src/third_party/wiredtiger/src/btree/bt_sync.c b/src/third_party/wiredtiger/src/btree/bt_sync.c
index 0650f26e5e9..939d8f808b1 100644
--- a/src/third_party/wiredtiger/src/btree/bt_sync.c
+++ b/src/third_party/wiredtiger/src/btree/bt_sync.c
@@ -25,7 +25,7 @@ __sync_file(WT_SESSION_IMPL *session, int syncop)
uint64_t internal_bytes, leaf_bytes;
uint64_t internal_pages, leaf_pages;
uint32_t flags;
- int evict_reset;
+ bool evict_reset;
btree = S2BT(session);
@@ -117,7 +117,7 @@ __sync_file(WT_SESSION_IMPL *session, int syncop)
*/
if (walk != NULL && walk->page != NULL &&
(mod = walk->page->modify) != NULL &&
- TXNID_LT(btree->rec_max_txn, mod->rec_max_txn))
+ WT_TXNID_LT(btree->rec_max_txn, mod->rec_max_txn))
btree->rec_max_txn = mod->rec_max_txn;
WT_ERR(__wt_tree_walk(session, &walk, NULL, flags));
@@ -149,9 +149,9 @@ __sync_file(WT_SESSION_IMPL *session, int syncop)
* is written.
*/
if (!WT_PAGE_IS_INTERNAL(page) &&
- F_ISSET(txn, TXN_HAS_SNAPSHOT) &&
- TXNID_LT(txn->snap_max, mod->first_dirty_txn) &&
- !F_ISSET(mod, WT_PM_REC_REWRITE)) {
+ F_ISSET(txn, WT_TXN_HAS_SNAPSHOT) &&
+ WT_TXNID_LT(txn->snap_max, mod->first_dirty_txn) &&
+ mod->rec_result != WT_PM_REC_REWRITE) {
__wt_page_modify_set(session, page);
continue;
}
@@ -232,7 +232,7 @@ err: /* On error, clear any left-over tree walk. */
* but don't wait for it.
*/
if (ret == 0 && syncop == WT_SYNC_WRITE_LEAVES)
- WT_RET(btree->bm->sync(btree->bm, session, 1));
+ WT_RET(btree->bm->sync(btree->bm, session, true));
return (ret);
}
diff --git a/src/third_party/wiredtiger/src/btree/bt_vrfy.c b/src/third_party/wiredtiger/src/btree/bt_vrfy.c
index 93d1ddad8c6..841d28c0806 100644
--- a/src/third_party/wiredtiger/src/btree/bt_vrfy.c
+++ b/src/third_party/wiredtiger/src/btree/bt_vrfy.c
@@ -23,10 +23,10 @@ typedef struct {
#define WT_VRFY_DUMP(vs) \
((vs)->dump_address || \
(vs)->dump_blocks || (vs)->dump_pages || (vs)->dump_shape)
- int dump_address; /* Configure: dump special */
- int dump_blocks;
- int dump_pages;
- int dump_shape;
+ bool dump_address; /* Configure: dump special */
+ bool dump_blocks;
+ bool dump_pages;
+ bool dump_shape;
u_int depth, depth_internal[100], depth_leaf[100];
@@ -38,7 +38,7 @@ static void __verify_checkpoint_reset(WT_VSTUFF *);
static int __verify_overflow(
WT_SESSION_IMPL *, const uint8_t *, size_t, WT_VSTUFF *);
static int __verify_overflow_cell(
- WT_SESSION_IMPL *, WT_REF *, int *, WT_VSTUFF *);
+ WT_SESSION_IMPL *, WT_REF *, bool *, WT_VSTUFF *);
static int __verify_row_int_key_order(
WT_SESSION_IMPL *, WT_PAGE *, WT_REF *, uint32_t, WT_VSTUFF *);
static int __verify_row_leaf_key_order(
@@ -79,14 +79,15 @@ __verify_config(WT_SESSION_IMPL *session, const char *cfg[], WT_VSTUFF *vs)
* Debugging: optionally dump specific blocks from the file.
*/
static int
-__verify_config_offsets(WT_SESSION_IMPL *session, const char *cfg[], int *quitp)
+__verify_config_offsets(
+ WT_SESSION_IMPL *session, const char *cfg[], bool *quitp)
{
WT_CONFIG list;
WT_CONFIG_ITEM cval, k, v;
WT_DECL_RET;
u_long offset;
- *quitp = 0;
+ *quitp = false;
WT_RET(__wt_config_gets(session, cfg, "dump_offsets", &cval));
WT_RET(__wt_config_subinit(session, &list, &cval));
@@ -96,7 +97,7 @@ __verify_config_offsets(WT_SESSION_IMPL *session, const char *cfg[], int *quitp)
* what the user wanted, all of this stuff is just hooked into
* verify because that's where we "dump blocks" for debugging.)
*/
- *quitp = 1;
+ *quitp = true;
if (v.len != 0 || sscanf(k.str, "%lu", &offset) != 1)
WT_RET_MSG(session, EINVAL,
"unexpected dump offset format");
@@ -149,12 +150,12 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[])
WT_VSTUFF *vs, _vstuff;
size_t root_addr_size;
uint8_t root_addr[WT_BTREE_MAX_ADDR_COOKIE];
- int bm_start, quit;
+ bool bm_start, quit;
btree = S2BT(session);
bm = btree->bm;
ckptbase = NULL;
- bm_start = 0;
+ bm_start = false;
WT_CLEAR(_vstuff);
vs = &_vstuff;
@@ -177,7 +178,7 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[])
/* Inform the underlying block manager we're verifying. */
WT_ERR(bm->verify_start(bm, session, ckptbase, cfg));
- bm_start = 1;
+ bm_start = true;
/* Loop through the file's checkpoints, verifying each one. */
WT_CKPT_FOREACH(ckptbase, ckpt) {
@@ -198,7 +199,7 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[])
/* Load the checkpoint. */
WT_ERR(bm->checkpoint_load(bm, session,
ckpt->raw.data, ckpt->raw.size,
- root_addr, &root_addr_size, 1));
+ root_addr, &root_addr_size, true));
/*
* Ignore trees with no root page.
@@ -289,7 +290,7 @@ __verify_tree(WT_SESSION_IMPL *session, WT_REF *ref, WT_VSTUFF *vs)
WT_REF *child_ref;
uint64_t recno;
uint32_t entry, i;
- int found;
+ bool found;
bm = S2BT(session)->bm;
page = ref->page;
@@ -643,7 +644,7 @@ __verify_row_leaf_key_order(
*/
static int
__verify_overflow_cell(
- WT_SESSION_IMPL *session, WT_REF *ref, int *found, WT_VSTUFF *vs)
+ WT_SESSION_IMPL *session, WT_REF *ref, bool *found, WT_VSTUFF *vs)
{
WT_BTREE *btree;
WT_CELL *cell;
@@ -654,7 +655,7 @@ __verify_overflow_cell(
btree = S2BT(session);
unpack = &_unpack;
- *found = 0;
+ *found = false;
/*
* If a tree is empty (just created), it won't have a disk image;
@@ -671,7 +672,7 @@ __verify_overflow_cell(
switch (unpack->type) {
case WT_CELL_KEY_OVFL:
case WT_CELL_VALUE_OVFL:
- *found = 1;
+ *found = true;
WT_ERR(__verify_overflow(
session, unpack->data, unpack->size, vs));
break;
diff --git a/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c b/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c
index dbaf18c69f2..5d9d7b2d6c4 100644
--- a/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c
+++ b/src/third_party/wiredtiger/src/btree/bt_vrfy_dsk.c
@@ -42,8 +42,8 @@ static int __verify_dsk_row(
* Verify a single block as read from disk.
*/
int
-__wt_verify_dsk_image(WT_SESSION_IMPL *session,
- const char *addr, const WT_PAGE_HEADER *dsk, size_t size, int empty_page_ok)
+__wt_verify_dsk_image(WT_SESSION_IMPL *session, const char *addr,
+ const WT_PAGE_HEADER *dsk, size_t size, bool empty_page_ok)
{
const uint8_t *p, *end;
u_int i;
@@ -173,7 +173,8 @@ __wt_verify_dsk_image(WT_SESSION_IMPL *session,
int
__wt_verify_dsk(WT_SESSION_IMPL *session, const char *addr, WT_ITEM *buf)
{
- return (__wt_verify_dsk_image(session, addr, buf->data, buf->size, 0));
+ return (
+ __wt_verify_dsk_image(session, addr, buf->data, buf->size, false));
}
/*
@@ -534,7 +535,7 @@ __verify_dsk_col_var(
WT_CELL_UNPACK *unpack, _unpack;
size_t last_size;
uint32_t cell_num, cell_type, i;
- int last_deleted;
+ bool last_deleted;
const uint8_t *last_data;
uint8_t *end;
@@ -545,7 +546,7 @@ __verify_dsk_col_var(
last_data = NULL;
last_size = 0;
- last_deleted = 0;
+ last_deleted = false;
cell_num = 0;
WT_CELL_FOREACH(btree, dsk, cell, unpack, i) {
@@ -572,7 +573,7 @@ __verify_dsk_col_var(
* a chance for RLE encoding. We don't have to care about data
* encoding or anything else, a byte comparison is enough.
*/
- if (last_deleted == 1) {
+ if (last_deleted) {
if (cell_type == WT_CELL_DEL)
goto match_err;
} else
@@ -588,15 +589,15 @@ match_err: WT_RET_VRFY(session,
switch (cell_type) {
case WT_CELL_DEL:
- last_deleted = 1;
+ last_deleted = true;
last_data = NULL;
break;
case WT_CELL_VALUE_OVFL:
- last_deleted = 0;
+ last_deleted = false;
last_data = NULL;
break;
case WT_CELL_VALUE:
- last_deleted = 0;
+ last_deleted = false;
last_data = unpack->data;
last_size = unpack->size;
break;
diff --git a/src/third_party/wiredtiger/src/btree/bt_walk.c b/src/third_party/wiredtiger/src/btree/bt_walk.c
index 2705f371fb5..6e1d182ed0b 100644
--- a/src/third_party/wiredtiger/src/btree/bt_walk.c
+++ b/src/third_party/wiredtiger/src/btree/bt_walk.c
@@ -81,11 +81,11 @@ __wt_tree_walk(WT_SESSION_IMPL *session,
WT_PAGE *page;
WT_PAGE_INDEX *pindex;
WT_REF *couple, *couple_orig, *ref;
- int empty_internal, prev, skip;
+ bool empty_internal, prev, skip;
uint32_t slot;
btree = S2BT(session);
- empty_internal = 0;
+ empty_internal = false;
/*
* Tree walks are special: they look inside page structures that splits
@@ -178,7 +178,7 @@ ascend: /*
*/
if (empty_internal) {
__wt_page_evict_soon(ref->page);
- empty_internal = 0;
+ empty_internal = false;
}
/* Optionally skip internal pages. */
@@ -241,7 +241,7 @@ ascend: /*
* page isn't empty.
*/
if (ref->state != WT_REF_DELETED)
- empty_internal = 0;
+ empty_internal = false;
if (LF_ISSET(WT_READ_CACHE)) {
/*
@@ -358,7 +358,7 @@ descend: couple = ref;
if (WT_PAGE_IS_INTERNAL(page)) {
WT_INTL_INDEX_GET(session, page, pindex);
slot = prev ? pindex->entries - 1 : 0;
- empty_internal = 1;
+ empty_internal = true;
} else {
*refp = ref;
goto done;
diff --git a/src/third_party/wiredtiger/src/btree/col_modify.c b/src/third_party/wiredtiger/src/btree/col_modify.c
index 01db31057fc..23cebde6973 100644
--- a/src/third_party/wiredtiger/src/btree/col_modify.c
+++ b/src/third_party/wiredtiger/src/btree/col_modify.c
@@ -17,7 +17,7 @@ static int __col_insert_alloc(
*/
int
__wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
- uint64_t recno, WT_ITEM *value, WT_UPDATE *upd, int is_remove)
+ uint64_t recno, WT_ITEM *value, WT_UPDATE *upd, bool is_remove)
{
WT_BTREE *btree;
WT_DECL_RET;
@@ -28,12 +28,12 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
WT_UPDATE *old_upd;
size_t ins_size, upd_size;
u_int i, skipdepth;
- int append, logged;
+ bool append, logged;
btree = cbt->btree;
ins = NULL;
page = cbt->ref->page;
- append = logged = 0;
+ append = logged = false;
/* This code expects a remove to have a NULL value. */
if (is_remove) {
@@ -54,7 +54,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
if (recno == 0 ||
recno > (btree->type == BTREE_COL_VAR ?
__col_var_last_recno(page) : __col_fix_last_recno(page)))
- append = 1;
+ append = true;
}
/* If we don't yet have a modify structure, we'll need one. */
@@ -85,7 +85,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
/* Allocate a WT_UPDATE structure and transaction ID. */
WT_ERR(__wt_update_alloc(session, value, &upd, &upd_size));
WT_ERR(__wt_txn_modify(session, upd));
- logged = 1;
+ logged = true;
/* Avoid a data copy in WT_CURSOR.update. */
cbt->modify_update = upd;
@@ -138,7 +138,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
WT_ERR(
__wt_update_alloc(session, value, &upd, &upd_size));
WT_ERR(__wt_txn_modify(session, upd));
- logged = 1;
+ logged = true;
/* Avoid a data copy in WT_CURSOR.update. */
cbt->modify_update = upd;
diff --git a/src/third_party/wiredtiger/src/btree/row_key.c b/src/third_party/wiredtiger/src/btree/row_key.c
index 4affa7fa62a..6d24708e59c 100644
--- a/src/third_party/wiredtiger/src/btree/row_key.c
+++ b/src/third_party/wiredtiger/src/btree/row_key.c
@@ -61,7 +61,7 @@ __wt_row_leaf_keys(WT_SESSION_IMPL *session, WT_PAGE *page)
for (rip = page->pg_row_d, i = 0; i < page->pg_row_entries; ++rip, ++i)
if (__bit_test(tmp->mem, i))
WT_ERR(__wt_row_leaf_key_work(
- session, page, rip, key, 1));
+ session, page, rip, key, true));
F_SET_ATOMIC(page, WT_PAGE_BUILD_KEYS);
@@ -112,7 +112,7 @@ int
__wt_row_leaf_key_copy(
WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip, WT_ITEM *key)
{
- WT_RET(__wt_row_leaf_key(session, page, rip, key, 0));
+ WT_RET(__wt_row_leaf_key(session, page, rip, key, false));
/* The return buffer may only hold a reference to a key, copy it. */
if (!WT_DATA_IN_ITEM(key))
@@ -128,7 +128,7 @@ __wt_row_leaf_key_copy(
*/
int
__wt_row_leaf_key_work(WT_SESSION_IMPL *session,
- WT_PAGE *page, WT_ROW *rip_arg, WT_ITEM *keyb, int instantiate)
+ WT_PAGE *page, WT_ROW *rip_arg, WT_ITEM *keyb, bool instantiate)
{
enum { FORWARD, BACKWARD } direction;
WT_BTREE *btree;
diff --git a/src/third_party/wiredtiger/src/btree/row_modify.c b/src/third_party/wiredtiger/src/btree/row_modify.c
index 6a9ad1c78b9..25ea19ee5d2 100644
--- a/src/third_party/wiredtiger/src/btree/row_modify.c
+++ b/src/third_party/wiredtiger/src/btree/row_modify.c
@@ -47,7 +47,7 @@ __wt_page_modify_alloc(WT_SESSION_IMPL *session, WT_PAGE *page)
*/
int
__wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
- WT_ITEM *key, WT_ITEM *value, WT_UPDATE *upd_arg, int is_remove)
+ WT_ITEM *key, WT_ITEM *value, WT_UPDATE *upd_arg, bool is_remove)
{
WT_DECL_RET;
WT_INSERT *ins;
@@ -57,12 +57,12 @@ __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
size_t ins_size, upd_size;
uint32_t ins_slot;
u_int i, skipdepth;
- int logged;
+ bool logged;
ins = NULL;
page = cbt->ref->page;
upd = upd_arg;
- logged = 0;
+ logged = false;
/* This code expects a remove to have a NULL value. */
if (is_remove)
@@ -100,7 +100,7 @@ __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
WT_ERR(
__wt_update_alloc(session, value, &upd, &upd_size));
WT_ERR(__wt_txn_modify(session, upd));
- logged = 1;
+ logged = true;
/* Avoid WT_CURSOR.update data copy. */
cbt->modify_update = upd;
@@ -170,7 +170,7 @@ __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
WT_ERR(
__wt_update_alloc(session, value, &upd, &upd_size));
WT_ERR(__wt_txn_modify(session, upd));
- logged = 1;
+ logged = true;
/* Avoid WT_CURSOR.update data copy. */
cbt->modify_update = upd;
diff --git a/src/third_party/wiredtiger/src/btree/row_srch.c b/src/third_party/wiredtiger/src/btree/row_srch.c
index 6a8ca5f401c..9ec90d72a3b 100644
--- a/src/third_party/wiredtiger/src/btree/row_srch.c
+++ b/src/third_party/wiredtiger/src/btree/row_srch.c
@@ -15,7 +15,7 @@
*/
static inline int
__wt_search_insert_append(WT_SESSION_IMPL *session,
- WT_CURSOR_BTREE *cbt, WT_ITEM *srch_key, int *donep)
+ WT_CURSOR_BTREE *cbt, WT_ITEM *srch_key, bool *donep)
{
WT_BTREE *btree;
WT_COLLATOR *collator;
@@ -137,7 +137,7 @@ __wt_search_insert(
*/
int
__wt_row_search(WT_SESSION_IMPL *session,
- WT_ITEM *srch_key, WT_REF *leaf, WT_CURSOR_BTREE *cbt, int insert)
+ WT_ITEM *srch_key, WT_REF *leaf, WT_CURSOR_BTREE *cbt, bool insert)
{
WT_BTREE *btree;
WT_COLLATOR *collator;
@@ -149,7 +149,8 @@ __wt_row_search(WT_SESSION_IMPL *session,
WT_ROW *rip;
size_t match, skiphigh, skiplow;
uint32_t base, indx, limit;
- int append_check, cmp, depth, descend_right, done;
+ int cmp, depth;
+ bool append_check, descend_right, done;
btree = S2BT(session);
collator = btree->collator;
@@ -176,7 +177,7 @@ __wt_row_search(WT_SESSION_IMPL *session,
* the cursor's append history.
*/
append_check = insert && cbt->append_tree;
- descend_right = 1;
+ descend_right = true;
/*
* In the service of eviction splits, we're only searching a single leaf
@@ -217,7 +218,7 @@ restart: page = current->page;
goto descend;
/* A failed append check turns off append checks. */
- append_check = 0;
+ append_check = false;
}
/*
@@ -286,7 +287,7 @@ restart: page = current->page;
* right-side descent.
*/
if (pindex->entries != base - 1)
- descend_right = 0;
+ descend_right = false;
descend: /*
* Swap the current page for the child page. If the page splits
@@ -369,7 +370,8 @@ leaf_only:
for (; limit != 0; limit >>= 1) {
indx = base + (limit >> 1);
rip = page->pg_row_d + indx;
- WT_ERR(__wt_row_leaf_key(session, page, rip, item, 1));
+ WT_ERR(
+ __wt_row_leaf_key(session, page, rip, item, true));
match = WT_MIN(skiplow, skiphigh);
cmp = __wt_lex_compare_skip(srch_key, item, &match);
@@ -386,7 +388,8 @@ leaf_only:
for (; limit != 0; limit >>= 1) {
indx = base + (limit >> 1);
rip = page->pg_row_d + indx;
- WT_ERR(__wt_row_leaf_key(session, page, rip, item, 1));
+ WT_ERR(
+ __wt_row_leaf_key(session, page, rip, item, true));
WT_ERR(__wt_compare(
session, collator, srch_key, item, &cmp));
@@ -529,7 +532,7 @@ restart:
__wt_random(&session->rnd) % page->pg_row_entries : 0;
return (__wt_row_leaf_key(session,
- page, page->pg_row_d + cbt->slot, &cbt->search_key, 0));
+ page, page->pg_row_d + cbt->slot, &cbt->search_key, false));
}
/*
diff --git a/src/third_party/wiredtiger/src/config/config.c b/src/third_party/wiredtiger/src/config/config.c
index fbb5a528ec7..92f917915e1 100644
--- a/src/third_party/wiredtiger/src/config/config.c
+++ b/src/third_party/wiredtiger/src/config/config.c
@@ -580,30 +580,30 @@ __wt_config_next(WT_CONFIG *conf, WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value)
*/
static int
__config_getraw(
- WT_CONFIG *cparser, WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value, int top)
+ WT_CONFIG *cparser, WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value, bool top)
{
WT_CONFIG sparser;
WT_CONFIG_ITEM k, v, subk;
WT_DECL_RET;
- int found;
+ bool found;
- found = 0;
+ found = false;
while ((ret = __config_next(cparser, &k, &v)) == 0) {
if (k.type != WT_CONFIG_ITEM_STRING &&
k.type != WT_CONFIG_ITEM_ID)
continue;
if (k.len == key->len && strncmp(key->str, k.str, k.len) == 0) {
*value = v;
- found = 1;
+ found = true;
} else if (k.len < key->len && key->str[k.len] == '.' &&
strncmp(key->str, k.str, k.len) == 0) {
subk.str = key->str + k.len + 1;
subk.len = (key->len - k.len) - 1;
WT_RET(__wt_config_initn(
cparser->session, &sparser, v.str, v.len));
- if ((ret =
- __config_getraw(&sparser, &subk, value, 0)) == 0)
- found = 1;
+ if ((ret = __config_getraw(
+ &sparser, &subk, value, false)) == 0)
+ found = true;
WT_RET_NOTFOUND_OK(ret);
}
}
@@ -629,7 +629,7 @@ __wt_config_get(WT_SESSION_IMPL *session,
for (found = 0; *cfg != NULL; cfg++) {
WT_RET(__wt_config_init(session, &cparser, *cfg));
- if ((ret = __config_getraw(&cparser, key, value, 1)) == 0)
+ if ((ret = __config_getraw(&cparser, key, value, true)) == 0)
found = 1;
else if (ret != WT_NOTFOUND)
return (ret);
@@ -679,7 +679,7 @@ __wt_config_getone(WT_SESSION_IMPL *session,
WT_CONFIG cparser;
WT_RET(__wt_config_init(session, &cparser, config));
- return (__config_getraw(&cparser, key, value, 1));
+ return (__config_getraw(&cparser, key, value, true));
}
/*
@@ -695,7 +695,7 @@ __wt_config_getones(WT_SESSION_IMPL *session,
{ key, strlen(key), 0, WT_CONFIG_ITEM_STRING };
WT_RET(__wt_config_init(session, &cparser, config));
- return (__config_getraw(&cparser, &key_item, value, 1));
+ return (__config_getraw(&cparser, &key_item, value, true));
}
/*
@@ -755,7 +755,7 @@ __wt_config_subgetraw(WT_SESSION_IMPL *session,
WT_CONFIG cparser;
WT_RET(__wt_config_initn(session, &cparser, cfg->str, cfg->len));
- return (__config_getraw(&cparser, key, value, 1));
+ return (__config_getraw(&cparser, key, value, true));
}
/*
diff --git a/src/third_party/wiredtiger/src/config/config_check.c b/src/third_party/wiredtiger/src/config/config_check.c
index 391209104c7..20ecc9f5db3 100644
--- a/src/third_party/wiredtiger/src/config/config_check.c
+++ b/src/third_party/wiredtiger/src/config/config_check.c
@@ -245,7 +245,8 @@ config_check(WT_SESSION_IMPL *session,
WT_CONFIG parser, cparser, sparser;
WT_CONFIG_ITEM k, v, ck, cv, dummy;
WT_DECL_RET;
- int badtype, found, i;
+ int i;
+ bool badtype, found;
/*
* The config_len parameter is optional, and allows passing in strings
@@ -272,27 +273,26 @@ config_check(WT_SESSION_IMPL *session,
(int)k.len, k.str);
if (strcmp(checks[i].type, "boolean") == 0) {
- badtype = (v.type != WT_CONFIG_ITEM_BOOL &&
+ badtype = v.type != WT_CONFIG_ITEM_BOOL &&
(v.type != WT_CONFIG_ITEM_NUM ||
- (v.val != 0 && v.val != 1)));
+ (v.val != 0 && v.val != 1));
} else if (strcmp(checks[i].type, "category") == 0) {
/* Deal with categories of the form: XXX=(XXX=blah). */
ret = config_check(session,
checks[i].subconfigs,
k.str + strlen(checks[i].name) + 1, v.len);
if (ret != EINVAL)
- badtype = 0;
+ badtype = false;
else
- badtype = 1;
+ badtype = true;
} else if (strcmp(checks[i].type, "format") == 0) {
- badtype = 0;
+ badtype = false;
} else if (strcmp(checks[i].type, "int") == 0) {
- badtype = (v.type != WT_CONFIG_ITEM_NUM);
+ badtype = v.type != WT_CONFIG_ITEM_NUM;
} else if (strcmp(checks[i].type, "list") == 0) {
- badtype = (v.len > 0 &&
- v.type != WT_CONFIG_ITEM_STRUCT);
+ badtype = v.len > 0 && v.type != WT_CONFIG_ITEM_STRUCT;
} else if (strcmp(checks[i].type, "string") == 0) {
- badtype = 0;
+ badtype = false;
} else
WT_RET_MSG(session, EINVAL,
"unknown configuration type: '%s'",
@@ -338,18 +338,18 @@ config_check(WT_SESSION_IMPL *session,
*/
WT_RET(__wt_config_subinit(session,
&sparser, &v));
- found = 1;
+ found = true;
while (found &&
(ret = __wt_config_next(&sparser,
&v, &dummy)) == 0) {
ret = __wt_config_subgetraw(
session, &cv, &v, &dummy);
- found = (ret == 0);
+ found = ret == 0;
}
} else {
ret = __wt_config_subgetraw(session,
&cv, &v, &dummy);
- found = (ret == 0);
+ found = ret == 0;
}
if (ret != 0 && ret != WT_NOTFOUND)
diff --git a/src/third_party/wiredtiger/src/config/config_collapse.c b/src/third_party/wiredtiger/src/config/config_collapse.c
index 23cb03c9b3a..448bf69152b 100644
--- a/src/third_party/wiredtiger/src/config/config_collapse.c
+++ b/src/third_party/wiredtiger/src/config/config_collapse.c
@@ -90,7 +90,7 @@ err: __wt_scr_free(session, &tmp);
* the qsort stable.
*/
typedef struct {
- char *k, *v; /* key, value */
+ char *k, *v; /* key, value */
size_t gen; /* generation */
} WT_CONFIG_MERGE_ENTRY;
diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c
index dacbb0539a9..4c7f1d2d442 100644
--- a/src/third_party/wiredtiger/src/conn/conn_api.c
+++ b/src/third_party/wiredtiger/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,180 @@ 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, true, &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, false, &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.
*/
@@ -814,7 +815,7 @@ err: /*
*/
for (s = conn->sessions, i = 0; i < conn->session_cnt; ++s, ++i)
if (s->active && !F_ISSET(s, WT_SESSION_INTERNAL) &&
- F_ISSET(&s->txn, TXN_RUNNING)) {
+ F_ISSET(&s->txn, WT_TXN_RUNNING)) {
wt_session = &s->iface;
WT_TRET(wt_session->rollback_transaction(
wt_session, NULL));
@@ -876,7 +877,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));
@@ -914,7 +915,6 @@ __conn_open_session(WT_CONNECTION *wt_conn,
WT_UNUSED(cfg);
WT_ERR(__wt_open_session(conn, event_handler, config, &session_ret));
-
*wt_sessionp = &session_ret->iface;
err: API_END_RET_NOTFOUND_MAP(session, ret);
@@ -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,14 +1257,15 @@ __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
* is holding it, we're done. The file may be zero-length, and that's
* OK, the underlying call supports locking past the end-of-file.
*/
- if (__wt_bytelock(conn->lock_fh, (wt_off_t)0, 1) != 0)
+ if (__wt_bytelock(conn->lock_fh, (wt_off_t)0, true) != 0)
WT_ERR_MSG(session, EBUSY,
"WiredTiger database is already being managed by another "
"process");
@@ -1285,18 +1286,18 @@ __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
* described above). Immediately release the lock, it's just a test.
*/
- if (__wt_bytelock(fh, (wt_off_t)0, 1) != 0) {
+ if (__wt_bytelock(fh, (wt_off_t)0, true) != 0) {
WT_ERR_MSG(session, EBUSY,
"WiredTiger database is already being managed by another "
"process");
}
- WT_ERR(__wt_bytelock(fh, (wt_off_t)0, 0));
+ WT_ERR(__wt_bytelock(fh, (wt_off_t)0, false));
/*
* If the size of the file is zero, we created it, fill it in. If the
@@ -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));
/*
@@ -1747,7 +1748,7 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
}
WT_ERR(__wt_config_gets(session, cfg, "mmap", &cval));
- conn->mmap = cval.val == 0 ? 0 : 1;
+ conn->mmap = cval.val != 0;
WT_ERR(__conn_statistics_config(session, cfg));
WT_ERR(__wt_lsm_manager_config(session, cfg));
diff --git a/src/third_party/wiredtiger/src/conn/conn_cache.c b/src/third_party/wiredtiger/src/conn/conn_cache.c
index 8de8cd3f8bc..3abfc0dfa85 100644
--- a/src/third_party/wiredtiger/src/conn/conn_cache.c
+++ b/src/third_party/wiredtiger/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,11 +73,11 @@ __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;
- int now_shared, was_shared;
+ bool now_shared, was_shared;
conn = S2C(session);
@@ -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
@@ -145,9 +145,9 @@ __wt_cache_create(WT_SESSION_IMPL *session, const char *cfg[])
"eviction target must be lower than the eviction trigger");
WT_ERR(__wt_cond_alloc(session,
- "cache eviction server", 0, &cache->evict_cond));
+ "cache eviction server", false, &cache->evict_cond));
WT_ERR(__wt_cond_alloc(session,
- "eviction waiters", 0, &cache->evict_waiter_cond));
+ "eviction waiters", false, &cache->evict_waiter_cond));
WT_ERR(__wt_spin_init(session, &cache->evict_lock, "cache eviction"));
WT_ERR(__wt_spin_init(session, &cache->evict_walk_lock, "cache walk"));
diff --git a/src/third_party/wiredtiger/src/conn/conn_cache_pool.c b/src/third_party/wiredtiger/src/conn/conn_cache_pool.c
index 488864ce351..8febdff1fbc 100644
--- a/src/third_party/wiredtiger/src/conn/conn_cache_pool.c
+++ b/src/third_party/wiredtiger/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,14 +85,14 @@ __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);
WT_ERR(__wt_spin_init(
session, &cp->cache_pool_lock, "cache shared pool"));
WT_ERR(__wt_cond_alloc(session,
- "cache pool server", 0, &cp->cache_pool_cond));
+ "cache pool server", false, &cp->cache_pool_cond));
__wt_process.cache_pool = cp;
WT_ERR(__wt_verbose(session,
@@ -228,7 +229,7 @@ __wt_conn_cache_pool_open(WT_SESSION_IMPL *session)
* it in the main thread to avoid shutdown races
*/
if ((ret = __wt_open_internal_session(
- conn, "cache-pool", 0, 0, &cache->cp_session)) != 0)
+ conn, "cache-pool", false, false, &cache->cp_session)) != 0)
WT_RET_MSG(NULL, ret,
"Failed to create session for cache pool");
@@ -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,11 +393,11 @@ __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;
+ adjusted = false;
highest = 0;
__wt_spin_lock(NULL, &cp->cache_pool_lock);
@@ -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/third_party/wiredtiger/src/conn/conn_ckpt.c b/src/third_party/wiredtiger/src/conn/conn_ckpt.c
index 74f27d8bd18..7fc790d5efa 100644
--- a/src/third_party/wiredtiger/src/conn/conn_ckpt.c
+++ b/src/third_party/wiredtiger/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
@@ -131,7 +131,7 @@ __ckpt_server_start(WT_CONNECTION_IMPL *conn)
F_SET(conn, WT_CONN_SERVER_CHECKPOINT);
/* The checkpoint server gets its own session. */
WT_RET(__wt_open_internal_session(
- conn, "checkpoint-server", 1, 1, &conn->ckpt_session));
+ conn, "checkpoint-server", true, true, &conn->ckpt_session));
session = conn->ckpt_session;
/*
@@ -140,15 +140,15 @@ __ckpt_server_start(WT_CONNECTION_IMPL *conn)
*/
F_SET(session, WT_SESSION_CAN_WAIT);
- WT_RET(
- __wt_cond_alloc(session, "checkpoint server", 0, &conn->ckpt_cond));
+ WT_RET(__wt_cond_alloc(
+ session, "checkpoint server", false, &conn->ckpt_cond));
/*
* Start the thread.
*/
WT_RET(__wt_thread_create(
session, &conn->ckpt_tid, __ckpt_server, session));
- conn->ckpt_tid_set = 1;
+ conn->ckpt_tid_set = true;
return (0);
}
@@ -161,10 +161,10 @@ 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;
+ start = false;
/* If there is already a server running, shut it down. */
if (conn->ckpt_session != NULL)
@@ -194,7 +194,7 @@ __wt_checkpoint_server_destroy(WT_SESSION_IMPL *session)
if (conn->ckpt_tid_set) {
WT_TRET(__wt_cond_signal(session, conn->ckpt_cond));
WT_TRET(__wt_thread_join(session, conn->ckpt_tid));
- conn->ckpt_tid_set = 0;
+ conn->ckpt_tid_set = false;
}
WT_TRET(__wt_cond_destroy(session, &conn->ckpt_cond));
@@ -211,7 +211,7 @@ __wt_checkpoint_server_destroy(WT_SESSION_IMPL *session)
* get confused.
*/
conn->ckpt_session = NULL;
- conn->ckpt_tid_set = 0;
+ conn->ckpt_tid_set = false;
conn->ckpt_cond = NULL;
conn->ckpt_config = NULL;
conn->ckpt_usecs = 0;
diff --git a/src/third_party/wiredtiger/src/conn/conn_dhandle.c b/src/third_party/wiredtiger/src/conn/conn_dhandle.c
index 54cc1308537..fed0012b211 100644
--- a/src/third_party/wiredtiger/src/conn/conn_dhandle.c
+++ b/src/third_party/wiredtiger/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,14 +441,14 @@ __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);
WT_RET(__conn_btree_config_set(session));
/* Set any special flags on the handle. */
- F_SET(btree, LF_ISSET(WT_BTREE_SPECIAL_FLAGS));
+ F_SET(btree, LF_MASK(WT_BTREE_SPECIAL_FLAGS));
do {
WT_ERR(__wt_btree_open(session, cfg));
@@ -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);
}
@@ -536,7 +536,7 @@ __conn_btree_apply_internal(WT_SESSION_IMPL *session, WT_DATA_HANDLE *dhandle,
WT_SAVE_DHANDLE(session,
ret = func(session, cfg));
if (WT_META_TRACKING(session))
- WT_TRET(__wt_meta_track_handle_lock(session, 0));
+ WT_TRET(__wt_meta_track_handle_lock(session, false));
else
WT_TRET(__wt_session_release_btree(session));
} else if (ret == EBUSY)
@@ -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;
@@ -715,7 +715,7 @@ __wt_conn_dhandle_close_all(
dhandle->name, dhandle->checkpoint,
NULL, WT_DHANDLE_EXCLUSIVE | WT_DHANDLE_LOCK_ONLY));
if (WT_META_TRACKING(session))
- WT_ERR(__wt_meta_track_handle_lock(session, 0));
+ WT_ERR(__wt_meta_track_handle_lock(session, false));
/*
* We have an exclusive lock, which means there are no cursors
@@ -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/third_party/wiredtiger/src/conn/conn_handle.c b/src/third_party/wiredtiger/src/conn/conn_handle.c
index a9b52e8a6fe..8ef8fa5c7db 100644
--- a/src/third_party/wiredtiger/src/conn/conn_handle.c
+++ b/src/third_party/wiredtiger/src/conn/conn_handle.c
@@ -68,7 +68,7 @@ __wt_connection_init(WT_CONNECTION_IMPL *conn)
WT_RET(__wt_spin_init(
session, &conn->lsm_manager.switch_lock, "LSM switch queue lock"));
WT_RET(__wt_cond_alloc(
- session, "LSM worker cond", 0, &conn->lsm_manager.work_cond));
+ session, "LSM worker cond", false, &conn->lsm_manager.work_cond));
/*
* Generation numbers.
diff --git a/src/third_party/wiredtiger/src/conn/conn_log.c b/src/third_party/wiredtiger/src/conn/conn_log.c
index 1e5e322016c..5218969c85f 100644
--- a/src/third_party/wiredtiger/src/conn/conn_log.c
+++ b/src/third_party/wiredtiger/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));
@@ -107,7 +107,8 @@ __log_archive_once(WT_SESSION_IMPL *session, uint32_t backup_file)
WT_DECL_RET;
WT_LOG *log;
uint32_t lognum, min_lognum;
- u_int i, locked, logcount;
+ u_int i, logcount;
+ bool locked;
char **logfiles;
conn = S2C(session);
@@ -140,19 +141,18 @@ __log_archive_once(WT_SESSION_IMPL *session, uint32_t backup_file)
* if we are the backup.
*/
__wt_spin_lock(session, &conn->hot_backup_lock);
- locked = 1;
- if (conn->hot_backup == 0 || backup_file != 0) {
+ locked = true;
+ if (!conn->hot_backup || backup_file != 0) {
for (i = 0; i < logcount; i++) {
WT_ERR(__wt_log_extract_lognum(
session, logfiles[i], &lognum));
- if (lognum < min_lognum) {
+ if (lognum < min_lognum)
WT_ERR(__wt_log_remove(
session, WT_LOG_FILENAME, lognum));
- }
}
}
__wt_spin_unlock(session, &conn->hot_backup_lock);
- locked = 0;
+ locked = false;
__wt_log_files_free(session, logfiles, logcount);
logfiles = NULL;
logcount = 0;
@@ -218,7 +218,7 @@ __log_prealloc_once(WT_SESSION_IMPL *session)
*/
for (i = reccount; i < (u_int)conn->log_prealloc; i++) {
WT_ERR(__wt_log_allocfile(
- session, ++log->prep_fileid, WT_LOG_PREPNAME, 1));
+ session, ++log->prep_fileid, WT_LOG_PREPNAME, true));
WT_STAT_FAST_CONN_INCR(session, log_prealloc_files);
}
@@ -241,7 +241,8 @@ __wt_log_truncate_files(
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
WT_LOG *log;
- uint32_t backup_file, locked;
+ uint32_t backup_file;
+ bool locked;
WT_UNUSED(cfg);
conn = S2C(session);
@@ -259,10 +260,10 @@ __wt_log_truncate_files(
"log_truncate_files: Archive once up to %" PRIu32,
backup_file));
WT_RET(__wt_writelock(session, log->log_archive_lock));
- locked = 1;
+ locked = true;
WT_ERR(__log_archive_once(session, backup_file));
WT_ERR(__wt_writeunlock(session, log->log_archive_lock));
- locked = 0;
+ locked = false;
err:
if (locked)
WT_RET(__wt_writeunlock(session, log->log_archive_lock));
@@ -282,12 +283,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
@@ -315,13 +316,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. */
@@ -467,12 +468,23 @@ __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;
+
+ /*
+ * The log server thread does a variety of work. It forces out any
+ * buffered log writes. It pre-allocates log files and it performs
+ * log archiving. The reason the wrlsn thread does not force out
+ * the buffered writes is because we want to process and move the
+ * write_lsn forward as quickly as possible. The same reason applies
+ * to why the log file server thread does not force out the writes.
+ * That thread does fsync calls which can take a long time and we
+ * don't want log records sitting in the buffer over the time it
+ * takes to sync out an earlier file.
+ */
while (F_ISSET(conn, WT_CONN_LOG_SERVER_RUN)) {
/*
* Perform log pre-allocation.
@@ -486,11 +498,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 "
@@ -517,7 +529,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);
@@ -557,8 +569,10 @@ __wt_logmgr_create(WT_SESSION_IMPL *session, const char *cfg[])
WT_INIT_LSN(&log->write_lsn);
WT_INIT_LSN(&log->write_start_lsn);
log->fileid = 0;
- WT_RET(__wt_cond_alloc(session, "log sync", 0, &log->log_sync_cond));
- WT_RET(__wt_cond_alloc(session, "log write", 0, &log->log_write_cond));
+ WT_RET(__wt_cond_alloc(
+ session, "log sync", false, &log->log_sync_cond));
+ WT_RET(__wt_cond_alloc(
+ session, "log write", false, &log->log_write_cond));
WT_RET(__wt_log_open(session));
WT_RET(__wt_log_slot_init(session));
@@ -585,28 +599,28 @@ __wt_logmgr_open(WT_SESSION_IMPL *session)
* If logging is enabled, this thread runs.
*/
WT_RET(__wt_open_internal_session(
- conn, "log-close-server", 0, 0, &conn->log_file_session));
+ conn, "log-close-server", false, false, &conn->log_file_session));
WT_RET(__wt_cond_alloc(conn->log_file_session,
- "log close server", 0, &conn->log_file_cond));
+ "log close server", false, &conn->log_file_cond));
/*
* Start the log file close thread.
*/
WT_RET(__wt_thread_create(conn->log_file_session,
&conn->log_file_tid, __log_file_server, conn->log_file_session));
- conn->log_file_tid_set = 1;
+ conn->log_file_tid_set = true;
/*
* Start the log write LSN thread. It is not configurable.
* If logging is enabled, this thread runs.
*/
WT_RET(__wt_open_internal_session(
- conn, "log-wrlsn-server", 0, 0, &conn->log_wrlsn_session));
+ conn, "log-wrlsn-server", false, false, &conn->log_wrlsn_session));
WT_RET(__wt_cond_alloc(conn->log_wrlsn_session,
- "log write lsn server", 0, &conn->log_wrlsn_cond));
+ "log write lsn server", false, &conn->log_wrlsn_cond));
WT_RET(__wt_thread_create(conn->log_wrlsn_session,
&conn->log_wrlsn_tid, __log_wrlsn_server, conn->log_wrlsn_session));
- conn->log_wrlsn_tid_set = 1;
+ conn->log_wrlsn_tid_set = true;
/* If no log thread services are configured, we're done. */
if (!FLD_ISSET(conn->log_flags,
@@ -621,21 +635,21 @@ __wt_logmgr_open(WT_SESSION_IMPL *session)
*/
if (conn->log_session != NULL) {
WT_ASSERT(session, conn->log_cond != NULL);
- WT_ASSERT(session, conn->log_tid_set != 0);
+ WT_ASSERT(session, conn->log_tid_set == true);
WT_RET(__wt_cond_signal(session, conn->log_cond));
} else {
/* The log server gets its own session. */
WT_RET(__wt_open_internal_session(
- conn, "log-server", 0, 0, &conn->log_session));
+ conn, "log-server", false, false, &conn->log_session));
WT_RET(__wt_cond_alloc(conn->log_session,
- "log server", 0, &conn->log_cond));
+ "log server", false, &conn->log_cond));
/*
* Start the thread.
*/
WT_RET(__wt_thread_create(conn->log_session,
&conn->log_tid, __log_server, conn->log_session));
- conn->log_tid_set = 1;
+ conn->log_tid_set = true;
}
return (0);
@@ -666,13 +680,13 @@ __wt_logmgr_destroy(WT_SESSION_IMPL *session)
if (conn->log_tid_set) {
WT_TRET(__wt_cond_signal(session, conn->log_cond));
WT_TRET(__wt_thread_join(session, conn->log_tid));
- conn->log_tid_set = 0;
+ conn->log_tid_set = false;
}
WT_TRET(__wt_cond_destroy(session, &conn->log_cond));
if (conn->log_file_tid_set) {
WT_TRET(__wt_cond_signal(session, conn->log_file_cond));
WT_TRET(__wt_thread_join(session, conn->log_file_tid));
- conn->log_file_tid_set = 0;
+ conn->log_file_tid_set = false;
}
WT_TRET(__wt_cond_destroy(session, &conn->log_file_cond));
if (conn->log_file_session != NULL) {
@@ -683,7 +697,7 @@ __wt_logmgr_destroy(WT_SESSION_IMPL *session)
if (conn->log_wrlsn_tid_set) {
WT_TRET(__wt_cond_signal(session, conn->log_wrlsn_cond));
WT_TRET(__wt_thread_join(session, conn->log_wrlsn_tid));
- conn->log_wrlsn_tid_set = 0;
+ conn->log_wrlsn_tid_set = false;
}
WT_TRET(__wt_cond_destroy(session, &conn->log_wrlsn_cond));
if (conn->log_wrlsn_session != NULL) {
diff --git a/src/third_party/wiredtiger/src/conn/conn_open.c b/src/third_party/wiredtiger/src/conn/conn_open.c
index a140a06628d..c86a6e039eb 100644
--- a/src/third_party/wiredtiger/src/conn/conn_open.c
+++ b/src/third_party/wiredtiger/src/conn/conn_open.c
@@ -36,7 +36,8 @@ __wt_connection_open(WT_CONNECTION_IMPL *conn, const char *cfg[])
* threads because those may allocate and use session resources that
* need to get cleaned up on close.
*/
- WT_RET(__wt_open_internal_session(conn, "connection", 1, 0, &session));
+ WT_RET(__wt_open_internal_session(
+ conn, "connection", true, false, &session));
/*
* The connection's default session is originally a static structure,
@@ -92,7 +93,7 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn)
* transaction ID will catch up with the current ID.
*/
for (;;) {
- __wt_txn_update_oldest(session, 1);
+ __wt_txn_update_oldest(session, true);
if (txn_global->oldest_id == txn_global->current)
break;
__wt_yield();
@@ -114,7 +115,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));
@@ -130,7 +131,7 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn)
*/
if (FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED))
WT_TRET(__wt_txn_checkpoint_log(
- session, 1, WT_TXN_LOG_CKPT_STOP, NULL));
+ session, true, WT_TXN_LOG_CKPT_STOP, NULL));
F_CLR(conn, WT_CONN_LOG_SERVER_RUN);
WT_TRET(__wt_logmgr_destroy(session));
diff --git a/src/third_party/wiredtiger/src/conn/conn_stat.c b/src/third_party/wiredtiger/src/conn/conn_stat.c
index 07ebfacface..425d824e756 100644
--- a/src/third_party/wiredtiger/src/conn/conn_stat.c
+++ b/src/third_party/wiredtiger/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,23 +248,23 @@ __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;
for (p = S2C(session)->stat_sources; *p != NULL; ++p)
if (WT_PREFIX_MATCH(lsm_tree->name, *p)) {
- WT_ERR(__wt_lsm_tree_get(
- session, lsm_tree->name, 0, &list[cnt++]));
+ WT_ERR(__wt_lsm_tree_get(session,
+ lsm_tree->name, false, &list[cnt++]));
break;
}
}
__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);
}
@@ -442,11 +443,11 @@ __statlog_start(WT_CONNECTION_IMPL *conn)
F_SET(conn, WT_CONN_SERVER_STATISTICS);
/* The statistics log server gets its own session. */
WT_RET(__wt_open_internal_session(
- conn, "statlog-server", 1, 1, &conn->stat_session));
+ conn, "statlog-server", true, true, &conn->stat_session));
session = conn->stat_session;
WT_RET(__wt_cond_alloc(
- session, "statistics log server", 0, &conn->stat_cond));
+ session, "statistics log server", false, &conn->stat_cond));
/*
* Start the thread.
@@ -460,7 +461,7 @@ __statlog_start(WT_CONNECTION_IMPL *conn)
*/
WT_RET(__wt_thread_create(
session, &conn->stat_tid, __statlog_server, session));
- conn->stat_tid_set = 1;
+ conn->stat_tid_set = true;
return (0);
}
@@ -473,10 +474,10 @@ int
__wt_statlog_create(WT_SESSION_IMPL *session, const char *cfg[])
{
WT_CONNECTION_IMPL *conn;
- int start;
+ bool start;
conn = S2C(session);
- start = 0;
+ start = false;
/*
* Stop any server that is already running. This means that each time
@@ -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;
@@ -510,7 +511,7 @@ __wt_statlog_destroy(WT_SESSION_IMPL *session, int is_close)
if (conn->stat_tid_set) {
WT_TRET(__wt_cond_signal(session, conn->stat_cond));
WT_TRET(__wt_thread_join(session, conn->stat_tid));
- conn->stat_tid_set = 0;
+ conn->stat_tid_set = false;
}
/* Log a set of statistics on shutdown if configured. */
@@ -531,7 +532,7 @@ __wt_statlog_destroy(WT_SESSION_IMPL *session, int is_close)
/* Clear connection settings so reconfigure is reliable. */
conn->stat_session = NULL;
- conn->stat_tid_set = 0;
+ conn->stat_tid_set = false;
conn->stat_format = NULL;
WT_TRET(__wt_fclose(session, &conn->stat_fp, WT_FHANDLE_APPEND));
conn->stat_path = NULL;
diff --git a/src/third_party/wiredtiger/src/conn/conn_sweep.c b/src/third_party/wiredtiger/src/conn/conn_sweep.c
index 061d70221c7..8854f5e0592 100644
--- a/src/third_party/wiredtiger/src/conn/conn_sweep.c
+++ b/src/third_party/wiredtiger/src/conn/conn_sweep.c
@@ -64,11 +64,11 @@ __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;
- evict_reset = 0;
+ evict_reset = false;
/*
* Acquire an exclusive lock on the handle and mark it dead.
@@ -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);
@@ -354,7 +354,7 @@ __wt_sweep_create(WT_SESSION_IMPL *session)
F_SET(conn, WT_CONN_SERVER_SWEEP);
WT_RET(__wt_open_internal_session(
- conn, "sweep-server", 1, 1, &conn->sweep_session));
+ conn, "sweep-server", true, true, &conn->sweep_session));
session = conn->sweep_session;
/*
@@ -364,7 +364,7 @@ __wt_sweep_create(WT_SESSION_IMPL *session)
F_SET(session, WT_SESSION_CAN_WAIT);
WT_RET(__wt_cond_alloc(
- session, "handle sweep server", 0, &conn->sweep_cond));
+ session, "handle sweep server", false, &conn->sweep_cond));
WT_RET(__wt_thread_create(
session, &conn->sweep_tid, __sweep_server, session));
diff --git a/src/third_party/wiredtiger/src/cursor/cur_backup.c b/src/third_party/wiredtiger/src/cursor/cur_backup.c
index 5b47c2c1a73..a4528923935 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_backup.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_backup.c
@@ -10,7 +10,7 @@
static int __backup_all(WT_SESSION_IMPL *, WT_CURSOR_BACKUP *);
static int __backup_cleanup_handles(WT_SESSION_IMPL *, WT_CURSOR_BACKUP *);
-static int __backup_file_create(WT_SESSION_IMPL *, WT_CURSOR_BACKUP *, int);
+static int __backup_file_create(WT_SESSION_IMPL *, WT_CURSOR_BACKUP *, bool);
static int __backup_list_all_append(WT_SESSION_IMPL *, const char *[]);
static int __backup_list_append(
WT_SESSION_IMPL *, WT_CURSOR_BACKUP *, const char *);
@@ -18,7 +18,7 @@ static int __backup_start(
WT_SESSION_IMPL *, WT_CURSOR_BACKUP *, const char *[]);
static int __backup_stop(WT_SESSION_IMPL *);
static int __backup_uri(
- WT_SESSION_IMPL *, WT_CURSOR_BACKUP *, const char *[], int *, int *);
+ WT_SESSION_IMPL *, WT_CURSOR_BACKUP *, const char *[], bool *, bool *);
/*
* __curbackup_next --
@@ -158,7 +158,7 @@ err: __wt_free(session, cb);
* Append log files needed for backup.
*/
static int
-__backup_log_append(WT_SESSION_IMPL *session, WT_CURSOR_BACKUP *cb, int active)
+__backup_log_append(WT_SESSION_IMPL *session, WT_CURSOR_BACKUP *cb, bool active)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
@@ -191,7 +191,7 @@ __backup_start(
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
- int exist, log_only, target_list;
+ bool exist, log_only, target_list;
conn = S2C(session);
@@ -218,11 +218,11 @@ __backup_start(
* checkpoint.
*/
__wt_spin_lock(session, &conn->hot_backup_lock);
- conn->hot_backup = 1;
+ conn->hot_backup = true;
__wt_spin_unlock(session, &conn->hot_backup_lock);
/* Create the hot backup file. */
- WT_ERR(__backup_file_create(session, cb, 0));
+ WT_ERR(__backup_file_create(session, cb, false));
/* Add log files if logging is enabled. */
@@ -234,11 +234,11 @@ __backup_start(
* copying data files to avoid rolling the metadata forward across
* a checkpoint that completes during the backup.
*/
- target_list = 0;
+ target_list = false;
WT_ERR(__backup_uri(session, cb, cfg, &target_list, &log_only));
if (!target_list) {
- WT_ERR(__backup_log_append(session, cb, 1));
+ WT_ERR(__backup_log_append(session, cb, true));
WT_ERR(__backup_all(session, cb));
}
@@ -319,7 +319,7 @@ __backup_stop(WT_SESSION_IMPL *session)
/* Checkpoint deletion can proceed, as can the next hot backup. */
__wt_spin_lock(session, &conn->hot_backup_lock);
- conn->hot_backup = 0;
+ conn->hot_backup = false;
__wt_spin_unlock(session, &conn->hot_backup_lock);
return (ret);
@@ -376,7 +376,7 @@ __backup_all(WT_SESSION_IMPL *session, WT_CURSOR_BACKUP *cb)
WT_ERR_NOTFOUND_OK(ret);
/* Build a list of the file objects that need to be copied. */
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_meta_btree_apply(
session, __backup_list_all_append, NULL));
@@ -391,17 +391,16 @@ err: if (cursor != NULL)
*/
static int
__backup_uri(WT_SESSION_IMPL *session,
- WT_CURSOR_BACKUP *cb, const char *cfg[], int *foundp, int *log_only)
+ WT_CURSOR_BACKUP *cb, const char *cfg[], bool *foundp, bool *log_only)
{
WT_CONFIG targetconf;
WT_CONFIG_ITEM cval, k, v;
WT_DECL_ITEM(tmp);
WT_DECL_RET;
- int target_list;
+ bool target_list;
const char *uri;
- *foundp = 0;
- *log_only = 0;
+ *foundp = *log_only = false;
/*
* If we find a non-empty target configuration string, we have a job,
@@ -409,11 +408,12 @@ __backup_uri(WT_SESSION_IMPL *session,
*/
WT_RET(__wt_config_gets(session, cfg, "target", &cval));
WT_RET(__wt_config_subinit(session, &targetconf, &cval));
- for (cb->list_next = 0, target_list = 0;
- (ret = __wt_config_next(&targetconf, &k, &v)) == 0; ++target_list) {
+ for (cb->list_next = 0, target_list = false;
+ (ret = __wt_config_next(&targetconf, &k, &v)) == 0;
+ target_list = true) {
/* If it is our first time through, allocate. */
- if (target_list == 0) {
- *foundp = 1;
+ if (!target_list) {
+ *foundp = true;
WT_ERR(__wt_scr_alloc(session, 512, &tmp));
}
@@ -430,12 +430,8 @@ __backup_uri(WT_SESSION_IMPL *session,
* Set log_only only if it is our only URI target.
*/
if (WT_PREFIX_MATCH(uri, "log:")) {
- if (target_list == 0)
- *log_only = 1;
- else
- *log_only = 0;
- WT_ERR(__wt_backup_list_uri_append(
- session, uri, NULL));
+ *log_only = !target_list;
+ WT_ERR(__wt_backup_list_uri_append(session, uri, NULL));
} else
WT_ERR(__wt_schema_worker(session,
uri, NULL, __wt_backup_list_uri_append, cfg, 0));
@@ -452,7 +448,7 @@ err: __wt_scr_free(session, &tmp);
*/
static int
__backup_file_create(
- WT_SESSION_IMPL *session, WT_CURSOR_BACKUP *cb, int incremental)
+ WT_SESSION_IMPL *session, WT_CURSOR_BACKUP *cb, bool incremental)
{
return (__wt_fopen(session,
incremental ? WT_INCREMENTAL_BACKUP : WT_METADATA_BACKUP,
@@ -480,7 +476,7 @@ __wt_backup_file_remove(WT_SESSION_IMPL *session)
*/
int
__wt_backup_list_uri_append(
- WT_SESSION_IMPL *session, const char *name, int *skip)
+ WT_SESSION_IMPL *session, const char *name, bool *skip)
{
WT_CURSOR_BACKUP *cb;
char *value;
@@ -489,7 +485,7 @@ __wt_backup_list_uri_append(
WT_UNUSED(skip);
if (WT_PREFIX_MATCH(name, "log:")) {
- WT_RET(__backup_log_append(session, cb, 0));
+ WT_RET(__backup_log_append(session, cb, false));
return (0);
}
@@ -538,8 +534,8 @@ __backup_list_append(
WT_CURSOR_BACKUP_ENTRY *p;
WT_DATA_HANDLE *old_dhandle;
WT_DECL_RET;
+ bool need_handle;
const char *name;
- int need_handle;
/* Leave a NULL at the end to mark the end of the list. */
WT_RET(__wt_realloc_def(session, &cb->list_allocated,
@@ -548,10 +544,10 @@ __backup_list_append(
p[0].name = p[1].name = NULL;
p[0].handle = p[1].handle = NULL;
- need_handle = 0;
+ need_handle = false;
name = uri;
if (WT_PREFIX_MATCH(uri, "file:")) {
- need_handle = 1;
+ need_handle = true;
name += strlen("file:");
}
diff --git a/src/third_party/wiredtiger/src/cursor/cur_bulk.c b/src/third_party/wiredtiger/src/cursor/cur_bulk.c
index df7048d4b82..b996b934464 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_bulk.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_bulk.c
@@ -50,7 +50,7 @@ __curbulk_insert_var(WT_CURSOR *cursor)
WT_CURSOR_BULK *cbulk;
WT_DECL_RET;
WT_SESSION_IMPL *session;
- int duplicate;
+ bool duplicate;
cbulk = (WT_CURSOR_BULK *)cursor;
btree = cbulk->cbt.btree;
@@ -71,13 +71,13 @@ __curbulk_insert_var(WT_CURSOR *cursor)
* Instead of a "first time" variable, I'm using the RLE count, because
* it is only zero before the first row is inserted.
*/
- duplicate = 0;
+ duplicate = false;
if (cbulk->rle != 0) {
if (cbulk->last.size == cursor->value.size &&
memcmp(cbulk->last.data, cursor->value.data,
cursor->value.size) == 0) {
++cbulk->rle;
- duplicate = 1;
+ duplicate = true;
} else
WT_ERR(__wt_bulk_insert_var(session, cbulk));
}
@@ -225,7 +225,7 @@ err: API_END_RET(session, ret);
*/
int
__wt_curbulk_init(WT_SESSION_IMPL *session,
- WT_CURSOR_BULK *cbulk, int bitmap, int skip_sort_check)
+ WT_CURSOR_BULK *cbulk, bool bitmap, bool skip_sort_check)
{
WT_CURSOR *c;
WT_CURSOR_BTREE *cbt;
diff --git a/src/third_party/wiredtiger/src/cursor/cur_dump.c b/src/third_party/wiredtiger/src/cursor/cur_dump.c
index 00281054d22..1600553c36b 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_dump.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_dump.c
@@ -15,7 +15,7 @@
*/
static int
__raw_to_dump(
- WT_SESSION_IMPL *session, WT_ITEM *from, WT_ITEM *to, int hexonly)
+ WT_SESSION_IMPL *session, WT_ITEM *from, WT_ITEM *to, bool hexonly)
{
if (hexonly)
WT_RET(__wt_raw_to_hex(session, from->data, from->size, to));
@@ -33,7 +33,7 @@ __raw_to_dump(
*/
static int
__dump_to_raw(
- WT_SESSION_IMPL *session, const char *src_arg, WT_ITEM *item, int hexonly)
+ WT_SESSION_IMPL *session, const char *src_arg, WT_ITEM *item, bool hexonly)
{
if (hexonly)
WT_RET(__wt_hex_to_raw(session, src_arg, item));
@@ -85,8 +85,8 @@ __curdump_get_key(WT_CURSOR *cursor, ...)
else
fmt = cursor->key_format;
}
- ret = __wt_json_alloc_unpack(session, buffer, size, fmt,
- json, 1, ap);
+ ret = __wt_json_alloc_unpack(
+ session, buffer, size, fmt, json, true, ap);
} else {
if (WT_CURSOR_RECNO(cursor) &&
!F_ISSET(cursor, WT_CURSTD_RAW)) {
@@ -98,7 +98,7 @@ __curdump_get_key(WT_CURSOR *cursor, ...)
WT_ERR(child->get_key(child, &item));
WT_ERR(__raw_to_dump(session, &item, &cursor->key,
- F_ISSET(cursor, WT_CURSTD_DUMP_HEX) ? 1 : 0));
+ F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
}
if (F_ISSET(cursor, WT_CURSTD_RAW)) {
@@ -175,11 +175,11 @@ __curdump_set_key(WT_CURSOR *cursor, ...)
} else {
if (F_ISSET(cursor, WT_CURSTD_DUMP_JSON))
WT_ERR(__wt_json_to_item(session, p, cursor->key_format,
- (WT_CURSOR_JSON *)cursor->json_private, 1,
+ (WT_CURSOR_JSON *)cursor->json_private, true,
&cursor->key));
else
WT_ERR(__dump_to_raw(session, p, &cursor->key,
- F_ISSET(cursor, WT_CURSTD_DUMP_HEX) ? 1 : 0));
+ F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
child->set_key(child, &cursor->key);
}
@@ -219,13 +219,13 @@ __curdump_get_value(WT_CURSOR *cursor, ...)
WT_ERR(__wt_cursor_get_raw_value(child, &item));
fmt = F_ISSET(cursor, WT_CURSTD_RAW) ?
"u" : cursor->value_format;
- ret = __wt_json_alloc_unpack(session, item.data,
- item.size, fmt, json, 0, ap);
+ ret = __wt_json_alloc_unpack(
+ session, item.data, item.size, fmt, json, false, ap);
} else {
WT_ERR(child->get_value(child, &item));
WT_ERR(__raw_to_dump(session, &item, &cursor->value,
- F_ISSET(cursor, WT_CURSTD_DUMP_HEX) ? 1 : 0));
+ F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
if (F_ISSET(cursor, WT_CURSTD_RAW)) {
itemp = va_arg(ap, WT_ITEM *);
@@ -266,10 +266,11 @@ __curdump_set_value(WT_CURSOR *cursor, ...)
if (F_ISSET(cursor, WT_CURSTD_DUMP_JSON))
WT_ERR(__wt_json_to_item(session, p, cursor->value_format,
- (WT_CURSOR_JSON *)cursor->json_private, 0, &cursor->value));
+ (WT_CURSOR_JSON *)cursor->json_private, false,
+ &cursor->value));
else
WT_ERR(__dump_to_raw(session, p, &cursor->value,
- F_ISSET(cursor, WT_CURSTD_DUMP_HEX) ? 1 : 0));
+ F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
child->set_value(child, &cursor->value);
@@ -384,7 +385,7 @@ __wt_curdump_create(WT_CURSOR *child, WT_CURSOR *owner, WT_CURSOR **cursorp)
cdump->child = child;
/* Copy the dump flags from the child cursor. */
- F_SET(cursor, F_ISSET(child,
+ F_SET(cursor, F_MASK(child,
WT_CURSTD_DUMP_HEX | WT_CURSTD_DUMP_JSON | WT_CURSTD_DUMP_PRINT));
if (F_ISSET(cursor, WT_CURSTD_DUMP_JSON)) {
WT_ERR(__wt_calloc_one(session, &json));
diff --git a/src/third_party/wiredtiger/src/cursor/cur_file.c b/src/third_party/wiredtiger/src/cursor/cur_file.c
index 10ff18df0e0..d78bda1a159 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_file.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_file.c
@@ -110,7 +110,7 @@ __curfile_next(WT_CURSOR *cursor)
CURSOR_API_CALL(cursor, session, next, cbt->btree);
F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET);
- if ((ret = __wt_btcur_next(cbt, 0)) == 0)
+ if ((ret = __wt_btcur_next(cbt, false)) == 0)
F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT);
err: API_END_RET(session, ret);
@@ -153,7 +153,7 @@ __curfile_prev(WT_CURSOR *cursor)
CURSOR_API_CALL(cursor, session, prev, cbt->btree);
F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET);
- if ((ret = __wt_btcur_prev(cbt, 0)) == 0)
+ if ((ret = __wt_btcur_prev(cbt, false)) == 0)
F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT);
err: API_END_RET(session, ret);
@@ -388,7 +388,7 @@ err: API_END_RET(session, ret);
*/
int
__wt_curfile_create(WT_SESSION_IMPL *session,
- WT_CURSOR *owner, const char *cfg[], int bulk, int bitmap,
+ WT_CURSOR *owner, const char *cfg[], bool bulk, bool bitmap,
WT_CURSOR **cursorp)
{
WT_CURSOR_STATIC_INIT(iface,
@@ -481,19 +481,20 @@ __wt_curfile_open(WT_SESSION_IMPL *session, const char *uri,
{
WT_CONFIG_ITEM cval;
WT_DECL_RET;
- int bitmap, bulk;
uint32_t flags;
+ bool bitmap, bulk;
+ bitmap = bulk = false;
flags = 0;
WT_RET(__wt_config_gets_def(session, cfg, "bulk", 0, &cval));
if (cval.type == WT_CONFIG_ITEM_BOOL ||
(cval.type == WT_CONFIG_ITEM_NUM &&
(cval.val == 0 || cval.val == 1))) {
- bitmap = 0;
- bulk = (cval.val != 0);
+ bitmap = false;
+ bulk = cval.val != 0;
} else if (WT_STRING_MATCH("bitmap", cval.str, cval.len))
- bitmap = bulk = 1;
+ bitmap = bulk = true;
else
WT_RET_MSG(session, EINVAL,
"Value for 'bulk' must be a boolean or 'bitmap'");
diff --git a/src/third_party/wiredtiger/src/cursor/cur_index.c b/src/third_party/wiredtiger/src/cursor/cur_index.c
index 7b234eab280..83a9064c1e5 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_index.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_index.c
@@ -414,7 +414,7 @@ __wt_curindex_open(WT_SESSION_IMPL *session,
++idxname;
if ((ret = __wt_schema_get_table(session,
- tablename, namesize, 0, &table)) != 0) {
+ tablename, namesize, false, &table)) != 0) {
if (ret == WT_NOTFOUND)
WT_RET_MSG(session, EINVAL,
"Cannot open cursor '%s' on unknown table", uri);
@@ -459,13 +459,13 @@ __wt_curindex_open(WT_SESSION_IMPL *session,
if (columns != NULL) {
WT_ERR(__wt_scr_alloc(session, 0, &tmp));
WT_ERR(__wt_struct_reformat(session, table,
- columns, strlen(columns), NULL, 0, tmp));
+ columns, strlen(columns), NULL, false, tmp));
WT_ERR(__wt_strndup(
session, tmp->data, tmp->size, &cursor->value_format));
WT_ERR(__wt_buf_init(session, tmp, 0));
WT_ERR(__wt_struct_plan(session, table,
- columns, strlen(columns), 0, tmp));
+ columns, strlen(columns), false, tmp));
WT_ERR(__wt_strndup(
session, tmp->data, tmp->size, &cindex->value_plan));
}
diff --git a/src/third_party/wiredtiger/src/cursor/cur_json.c b/src/third_party/wiredtiger/src/cursor/cur_json.c
index 67daf377f88..d61b9618991 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_json.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_json.c
@@ -11,16 +11,16 @@
static size_t __json_unpack_put(WT_SESSION_IMPL *, void *, u_char *, size_t,
WT_CONFIG_ITEM *);
static inline int __json_struct_size(WT_SESSION_IMPL *, const void *, size_t,
- const char *, WT_CONFIG_ITEM *, int, size_t *);
+ const char *, WT_CONFIG_ITEM *, bool, size_t *);
static inline int __json_struct_unpackv(WT_SESSION_IMPL *, const void *, size_t,
- const char *, WT_CONFIG_ITEM *, u_char *, size_t, int, va_list);
+ const char *, WT_CONFIG_ITEM *, u_char *, size_t, bool, va_list);
static int json_string_arg(WT_SESSION_IMPL *, const char **, WT_ITEM *);
static int json_int_arg(WT_SESSION_IMPL *, const char **, int64_t *);
static int json_uint_arg(WT_SESSION_IMPL *, const char **, uint64_t *);
static int __json_pack_struct(WT_SESSION_IMPL *, void *, size_t, const char *,
const char *);
static int __json_pack_size(WT_SESSION_IMPL *, const char *, WT_CONFIG_ITEM *,
- int, const char *, size_t *);
+ bool, const char *, size_t *);
#define WT_PACK_JSON_GET(session, pv, jstr) do { \
switch (pv.type) { \
@@ -90,7 +90,8 @@ __json_unpack_put(WT_SESSION_IMPL *session, void *voidpv,
if (pv->type == 's' || pv->havesize) {
end = p + pv->size;
for (; p < end; p++) {
- n = __wt_json_unpack_char(*p, buf, bufsz, 0);
+ n = __wt_json_unpack_char(
+ *p, buf, bufsz, false);
if (n > bufsz)
bufsz = 0;
else {
@@ -101,7 +102,8 @@ __json_unpack_put(WT_SESSION_IMPL *session, void *voidpv,
}
} else
for (; *p; p++) {
- n = __wt_json_unpack_char(*p, buf, bufsz, 0);
+ n = __wt_json_unpack_char(
+ *p, buf, bufsz, false);
if (n > bufsz)
bufsz = 0;
else {
@@ -123,7 +125,7 @@ __json_unpack_put(WT_SESSION_IMPL *session, void *voidpv,
bufsz--;
}
for (; p < end; p++) {
- n = __wt_json_unpack_char(*p, buf, bufsz, 1);
+ n = __wt_json_unpack_char(*p, buf, bufsz, true);
if (n > bufsz)
bufsz = 0;
else {
@@ -163,7 +165,7 @@ __json_unpack_put(WT_SESSION_IMPL *session, void *voidpv,
*/
static inline int
__json_struct_size(WT_SESSION_IMPL *session, const void *buffer,
- size_t size, const char *fmt, WT_CONFIG_ITEM *names, int iskey,
+ size_t size, const char *fmt, WT_CONFIG_ITEM *names, bool iskey,
size_t *presult)
{
WT_CONFIG_ITEM name;
@@ -171,21 +173,21 @@ __json_struct_size(WT_SESSION_IMPL *session, const void *buffer,
WT_DECL_RET;
WT_PACK pack;
WT_PACK_NAME packname;
- const uint8_t *p, *end;
size_t result;
- int needcr;
+ bool needcr;
+ const uint8_t *p, *end;
p = buffer;
end = p + size;
result = 0;
- needcr = 0;
+ needcr = false;
WT_RET(__pack_name_init(session, names, iskey, &packname));
WT_RET(__pack_init(session, &pack, fmt));
while ((ret = __pack_next(&pack, &pv)) == 0) {
if (needcr)
result += 2;
- needcr = 1;
+ needcr = true;
WT_RET(__unpack_read(session, &pv, &p, (size_t)(end - p)));
WT_RET(__pack_name_next(&packname, &name));
result += __json_unpack_put(session, &pv, NULL, 0, &name);
@@ -207,20 +209,20 @@ __json_struct_size(WT_SESSION_IMPL *session, const void *buffer,
static inline int
__json_struct_unpackv(WT_SESSION_IMPL *session,
const void *buffer, size_t size, const char *fmt, WT_CONFIG_ITEM *names,
- u_char *jbuf, size_t jbufsize, int iskey, va_list ap)
+ u_char *jbuf, size_t jbufsize, bool iskey, va_list ap)
{
WT_CONFIG_ITEM name;
WT_DECL_PACK_VALUE(pv);
WT_DECL_RET;
WT_PACK pack;
WT_PACK_NAME packname;
- int needcr;
size_t jsize;
+ bool needcr;
const uint8_t *p, *end;
p = buffer;
end = p + size;
- needcr = 0;
+ needcr = false;
/* Unpacking a cursor marked as json implies a single arg. */
*va_arg(ap, const char **) = (char *)jbuf;
@@ -234,7 +236,7 @@ __json_struct_unpackv(WT_SESSION_IMPL *session,
jbuf += 2;
jbufsize -= 2;
}
- needcr = 1;
+ needcr = true;
WT_RET(__unpack_read(session, &pv, &p, (size_t)(end - p)));
WT_RET(__pack_name_next(&packname, &name));
jsize = __json_unpack_put(session,
@@ -261,7 +263,7 @@ __json_struct_unpackv(WT_SESSION_IMPL *session,
int
__wt_json_alloc_unpack(WT_SESSION_IMPL *session, const void *buffer,
size_t size, const char *fmt, WT_CURSOR_JSON *json,
- int iskey, va_list ap)
+ bool iskey, va_list ap)
{
WT_CONFIG_ITEM *names;
WT_DECL_RET;
@@ -308,7 +310,7 @@ __wt_json_close(WT_SESSION_IMPL *session, WT_CURSOR *cursor)
* Can be called with null buf for sizing.
*/
size_t
-__wt_json_unpack_char(char ch, u_char *buf, size_t bufsz, int force_unicode)
+__wt_json_unpack_char(char ch, u_char *buf, size_t bufsz, bool force_unicode)
{
char abbrev;
u_char h;
@@ -456,9 +458,10 @@ __wt_json_token(WT_SESSION *wt_session, const char *src, int *toktype,
const char **tokstart, size_t *toklen)
{
WT_SESSION_IMPL *session;
- char ch;
+ int result;
+ bool backslash, isalph, isfloat;
const char *bad;
- int backslash, isalph, isfloat, result;
+ char ch;
result = -1;
session = (WT_SESSION_IMPL *)wt_session;
@@ -475,7 +478,7 @@ __wt_json_token(WT_SESSION *wt_session, const char *src, int *toktype,
/* JSON is specified in RFC 4627. */
switch (*src) {
case '"':
- backslash = 0;
+ backslash = false;
src++;
while ((ch = *src) != '\0') {
if (!backslash) {
@@ -485,7 +488,7 @@ __wt_json_token(WT_SESSION *wt_session, const char *src, int *toktype,
break;
}
if (ch == '\\')
- backslash = 1;
+ backslash = true;
} else {
/* We validate Unicode on this pass. */
if (ch == 'u') {
@@ -501,7 +504,7 @@ __wt_json_token(WT_SESSION *wt_session, const char *src, int *toktype,
}
src += 5;
}
- backslash = 0;
+ backslash = false;
}
src++;
}
@@ -519,20 +522,20 @@ __wt_json_token(WT_SESSION *wt_session, const char *src, int *toktype,
case '7':
case '8':
case '9':
- isfloat = 0;
+ isfloat = false;
if (*src == '-')
src++;
while ((ch = *src) != '\0' && isdigit(ch))
src++;
if (*src == '.') {
- isfloat = 1;
+ isfloat = true;
src++;
while ((ch = *src) != '\0' &&
isdigit(ch))
src++;
}
if (*src == 'e' || *src == 'E') {
- isfloat = 1;
+ isfloat = true;
src++;
if (*src == '+' || *src == '-')
src++;
@@ -610,9 +613,9 @@ __wt_json_tokname(int toktype)
static int
json_string_arg(WT_SESSION_IMPL *session, const char **jstr, WT_ITEM *item)
{
- const char *tokstart;
- int tok;
WT_DECL_RET;
+ int tok;
+ const char *tokstart;
WT_RET(__wt_json_token((WT_SESSION *)session, *jstr, &tok, &tokstart,
&item->size));
@@ -640,8 +643,8 @@ json_int_arg(WT_SESSION_IMPL *session, const char **jstr, int64_t *ip)
{
char *end;
const char *tokstart;
- int tok;
size_t toksize;
+ int tok;
WT_RET(__wt_json_token((WT_SESSION *)session, *jstr, &tok, &tokstart,
&toksize));
@@ -668,10 +671,10 @@ json_int_arg(WT_SESSION_IMPL *session, const char **jstr, int64_t *ip)
static int
json_uint_arg(WT_SESSION_IMPL *session, const char **jstr, uint64_t *up)
{
- char *end;
- const char *tokstart;
- int tok;
size_t toksize;
+ int tok;
+ const char *tokstart;
+ char *end;
WT_RET(__wt_json_token((WT_SESSION *)session, *jstr, &tok, &tokstart,
&toksize));
@@ -718,14 +721,14 @@ __json_pack_struct(WT_SESSION_IMPL *session, void *buffer, size_t size,
WT_DECL_PACK_VALUE(pv);
WT_DECL_RET;
WT_PACK pack;
- const char *tokstart;
- int multi;
size_t toksize;
+ bool multi;
uint8_t *p, *end;
+ const char *tokstart;
p = buffer;
end = p + size;
- multi = 0;
+ multi = false;
if (fmt[0] != '\0' && fmt[1] == '\0') {
JSON_EXPECT_TOKEN_GET(session, jstr, 's', tokstart, toksize);
@@ -745,7 +748,7 @@ __json_pack_struct(WT_SESSION_IMPL *session, void *buffer, size_t size,
JSON_EXPECT_TOKEN(session, jstr, ':');
WT_PACK_JSON_GET(session, pv, jstr);
WT_RET(__pack_write(session, &pv, &p, (size_t)(end - p)));
- multi = 1;
+ multi = true;
}
/* Be paranoid - __pack_write should never overflow. */
@@ -767,18 +770,18 @@ __json_pack_struct(WT_SESSION_IMPL *session, void *buffer, size_t size,
static int
__json_pack_size(
WT_SESSION_IMPL *session, const char *fmt, WT_CONFIG_ITEM *names,
- int iskey, const char *jstr, size_t *sizep)
+ bool iskey, const char *jstr, size_t *sizep)
{
WT_CONFIG_ITEM name;
WT_DECL_PACK_VALUE(pv);
WT_PACK pack;
WT_PACK_NAME packname;
- const char *tokstart;
- int multi;
size_t toksize, total;
+ bool multi;
+ const char *tokstart;
WT_RET(__pack_name_init(session, names, iskey, &packname));
- multi = 0;
+ multi = false;
WT_RET(__pack_init(session, &pack, fmt));
for (total = 0; __pack_next(&pack, &pv) == 0;) {
if (multi)
@@ -794,7 +797,7 @@ __json_pack_size(
JSON_EXPECT_TOKEN(session, jstr, ':');
WT_PACK_JSON_GET(session, pv, jstr);
total += __pack_size(session, &pv);
- multi = 1;
+ multi = true;
}
/* check end of string */
JSON_EXPECT_TOKEN(session, jstr, 0);
@@ -810,7 +813,7 @@ __json_pack_size(
*/
int
__wt_json_to_item(WT_SESSION_IMPL *session, const char *jstr,
- const char *format, WT_CURSOR_JSON *json, int iskey, WT_ITEM *item)
+ const char *format, WT_CURSOR_JSON *json, bool iskey, WT_ITEM *item)
{
size_t sz;
sz = 0; /* Initialize because GCC 4.1 is paranoid */
diff --git a/src/third_party/wiredtiger/src/cursor/cur_stat.c b/src/third_party/wiredtiger/src/cursor/cur_stat.c
index 82568401319..2b054906bef 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_stat.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_stat.c
@@ -202,12 +202,12 @@ __curstat_next(WT_CURSOR *cursor)
if (cst->notinitialized) {
WT_ERR(__wt_curstat_init(
session, cursor->internal_uri, cst->cfg, cst));
- cst->notinitialized = 0;
+ cst->notinitialized = false;
}
/* Move to the next item. */
if (cst->notpositioned) {
- cst->notpositioned = 0;
+ cst->notpositioned = false;
cst->key = WT_STAT_KEY_MIN(cst);
} else if (cst->key < WT_STAT_KEY_MAX(cst))
++cst->key;
@@ -240,12 +240,12 @@ __curstat_prev(WT_CURSOR *cursor)
if (cst->notinitialized) {
WT_ERR(__wt_curstat_init(
session, cursor->internal_uri, cst->cfg, cst));
- cst->notinitialized = 0;
+ cst->notinitialized = false;
}
/* Move to the previous item. */
if (cst->notpositioned) {
- cst->notpositioned = 0;
+ cst->notpositioned = false;
cst->key = WT_STAT_KEY_MAX(cst);
} else if (cst->key > WT_STAT_KEY_MIN(cst))
--cst->key;
@@ -275,7 +275,7 @@ __curstat_reset(WT_CURSOR *cursor)
cst = (WT_CURSOR_STAT *)cursor;
CURSOR_API_CALL(cursor, session, reset, NULL);
- cst->notinitialized = cst->notpositioned = 1;
+ cst->notinitialized = cst->notpositioned = true;
F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET);
err: API_END_RET(session, ret);
@@ -302,7 +302,7 @@ __curstat_search(WT_CURSOR *cursor)
if (cst->notinitialized) {
WT_ERR(__wt_curstat_init(
session, cursor->internal_uri, cst->cfg, cst));
- cst->notinitialized = 0;
+ cst->notinitialized = false;
}
if (cst->key < WT_STAT_KEY_MIN(cst) || cst->key > WT_STAT_KEY_MAX(cst))
@@ -580,10 +580,10 @@ __wt_curstat_open(WT_SESSION_IMPL *session,
* the open returns.
*/
WT_ERR(__wt_curstat_init(session, uri, cst->cfg, cst));
- cst->notinitialized = 0;
+ cst->notinitialized = false;
/* The cursor isn't yet positioned. */
- cst->notpositioned = 1;
+ cst->notpositioned = true;
/* __wt_cursor_init is last so we don't have to clean up on error. */
WT_ERR(__wt_cursor_init(cursor, uri, NULL, cfg, cursorp));
diff --git a/src/third_party/wiredtiger/src/cursor/cur_std.c b/src/third_party/wiredtiger/src/cursor/cur_std.c
index 858c6af6853..dfc9fc09a26 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_std.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_std.c
@@ -63,7 +63,7 @@ __wt_cursor_set_notsup(WT_CURSOR *cursor)
* Standard error message for key/values not set.
*/
int
-__wt_cursor_kv_not_set(WT_CURSOR *cursor, int key)
+__wt_cursor_kv_not_set(WT_CURSOR *cursor, bool key)
{
WT_SESSION_IMPL *session;
@@ -113,9 +113,9 @@ int
__wt_cursor_get_raw_key(WT_CURSOR *cursor, WT_ITEM *key)
{
WT_DECL_RET;
- int raw_set;
+ bool raw_set;
- raw_set = F_ISSET(cursor, WT_CURSTD_RAW) ? 1 : 0;
+ raw_set = F_ISSET(cursor, WT_CURSTD_RAW);
if (!raw_set)
F_SET(cursor, WT_CURSTD_RAW);
ret = cursor->get_key(cursor, key);
@@ -132,9 +132,9 @@ __wt_cursor_get_raw_key(WT_CURSOR *cursor, WT_ITEM *key)
void
__wt_cursor_set_raw_key(WT_CURSOR *cursor, WT_ITEM *key)
{
- int raw_set;
+ bool raw_set;
- raw_set = F_ISSET(cursor, WT_CURSTD_RAW) ? 1 : 0;
+ raw_set = F_ISSET(cursor, WT_CURSTD_RAW);
if (!raw_set)
F_SET(cursor, WT_CURSTD_RAW);
cursor->set_key(cursor, key);
@@ -151,9 +151,9 @@ int
__wt_cursor_get_raw_value(WT_CURSOR *cursor, WT_ITEM *value)
{
WT_DECL_RET;
- int raw_set;
+ bool raw_set;
- raw_set = F_ISSET(cursor, WT_CURSTD_RAW) ? 1 : 0;
+ raw_set = F_ISSET(cursor, WT_CURSTD_RAW);
if (!raw_set)
F_SET(cursor, WT_CURSTD_RAW);
ret = cursor->get_value(cursor, value);
@@ -170,9 +170,9 @@ __wt_cursor_get_raw_value(WT_CURSOR *cursor, WT_ITEM *value)
void
__wt_cursor_set_raw_value(WT_CURSOR *cursor, WT_ITEM *value)
{
- int raw_set;
+ bool raw_set;
- raw_set = F_ISSET(cursor, WT_CURSTD_RAW) ? 1 : 0;
+ raw_set = F_ISSET(cursor, WT_CURSTD_RAW);
if (!raw_set)
F_SET(cursor, WT_CURSTD_RAW);
cursor->set_value(cursor, value);
@@ -195,7 +195,7 @@ __wt_cursor_get_keyv(WT_CURSOR *cursor, uint32_t flags, va_list ap)
CURSOR_API_CALL(cursor, session, get_key, NULL);
if (!F_ISSET(cursor, WT_CURSTD_KEY_EXT | WT_CURSTD_KEY_INT))
- WT_ERR(__wt_cursor_kv_not_set(cursor, 1));
+ WT_ERR(__wt_cursor_kv_not_set(cursor, true));
if (WT_CURSOR_RECNO(cursor)) {
if (LF_ISSET(WT_CURSTD_RAW)) {
@@ -344,7 +344,7 @@ __wt_cursor_get_valuev(WT_CURSOR *cursor, va_list ap)
CURSOR_API_CALL(cursor, session, get_value, NULL);
if (!F_ISSET(cursor, WT_CURSTD_VALUE_EXT | WT_CURSTD_VALUE_INT))
- WT_ERR(__wt_cursor_kv_not_set(cursor, 0));
+ WT_ERR(__wt_cursor_kv_not_set(cursor, false));
/* Fast path some common cases. */
fmt = cursor->value_format;
diff --git a/src/third_party/wiredtiger/src/cursor/cur_table.c b/src/third_party/wiredtiger/src/cursor/cur_table.c
index a046b2b1ed9..80a211cffa8 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_table.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_table.c
@@ -504,7 +504,7 @@ __curtable_insert(WT_CURSOR *cursor)
cp = ctable->cg_cursors;
primary = *cp++;
- flag_orig = F_ISSET(primary, WT_CURSTD_OVERWRITE);
+ flag_orig = F_MASK(primary, WT_CURSTD_OVERWRITE);
if (ctable->table->nindices > 0)
F_CLR(primary, WT_CURSTD_OVERWRITE);
ret = primary->insert(primary);
@@ -528,7 +528,7 @@ __curtable_insert(WT_CURSOR *cursor)
WT_ERR((*cp)->insert(*cp));
}
- WT_ERR(__apply_idx(ctable, offsetof(WT_CURSOR, insert), 0));
+ WT_ERR(__apply_idx(ctable, offsetof(WT_CURSOR, insert), false));
err: CURSOR_UPDATE_API_END(session, ret);
return (ret);
@@ -567,7 +567,7 @@ __curtable_update(WT_CURSOR *cursor)
/* Remove only if the key exists. */
if (ret == 0) {
WT_ERR(__apply_idx(ctable,
- offsetof(WT_CURSOR, remove), 1));
+ offsetof(WT_CURSOR, remove), true));
WT_ERR(__wt_schema_project_slice(session,
ctable->cg_cursors, ctable->plan, 0,
cursor->value_format, value_copy));
@@ -579,7 +579,7 @@ __curtable_update(WT_CURSOR *cursor)
WT_ERR(ret);
if (ctable->table->nindices > 0)
- WT_ERR(__apply_idx(ctable, offsetof(WT_CURSOR, insert), 1));
+ WT_ERR(__apply_idx(ctable, offsetof(WT_CURSOR, insert), true));
err: CURSOR_UPDATE_API_END(session, ret);
__wt_scr_free(session, &value_copy);
@@ -605,7 +605,7 @@ __curtable_remove(WT_CURSOR *cursor)
if (ctable->table->nindices > 0) {
APPLY_CG(ctable, search);
WT_ERR(ret);
- WT_ERR(__apply_idx(ctable, offsetof(WT_CURSOR, remove), 0));
+ WT_ERR(__apply_idx(ctable, offsetof(WT_CURSOR, remove), false));
}
APPLY_CG(ctable, remove);
@@ -656,7 +656,7 @@ __wt_table_range_truncate(WT_CURSOR_TABLE *start, WT_CURSOR_TABLE *stop)
APPLY_CG(stop, search);
WT_ERR(ret);
WT_ERR(__apply_idx(
- stop, offsetof(WT_CURSOR, remove), 0));
+ stop, offsetof(WT_CURSOR, remove), false));
} while ((ret = wt_stop->prev(wt_stop)) == 0);
WT_ERR_NOTFOUND_OK(ret);
@@ -671,7 +671,7 @@ __wt_table_range_truncate(WT_CURSOR_TABLE *start, WT_CURSOR_TABLE *stop)
APPLY_CG(start, search);
WT_ERR(ret);
WT_ERR(__apply_idx(
- start, offsetof(WT_CURSOR, remove), 0));
+ start, offsetof(WT_CURSOR, remove), false));
if (stop != NULL)
WT_ERR(wt_start->compare(
wt_start, wt_stop,
@@ -764,7 +764,7 @@ __curtable_open_colgroups(WT_CURSOR_TABLE *ctable, const char *cfg_arg[])
cfg_arg[0], cfg_arg[1], "dump=\"\",readonly=0", NULL, NULL
};
u_int i;
- int complete;
+ bool complete;
session = (WT_SESSION_IMPL *)ctable->iface.session;
table = ctable->table;
@@ -872,7 +872,7 @@ __wt_curtable_open(WT_SESSION_IMPL *session,
size = strlen(tablename);
else
size = WT_PTRDIFF(columns, tablename);
- WT_RET(__wt_schema_get_table(session, tablename, size, 0, &table));
+ WT_RET(__wt_schema_get_table(session, tablename, size, false, &table));
if (table->is_simple) {
/* Just return a cursor on the underlying data source. */
@@ -899,13 +899,13 @@ __wt_curtable_open(WT_SESSION_IMPL *session,
WT_ERR(__wt_scr_alloc(session, 0, &tmp));
if (columns != NULL) {
WT_ERR(__wt_struct_reformat(session, table,
- columns, strlen(columns), NULL, 1, tmp));
+ columns, strlen(columns), NULL, true, tmp));
WT_ERR(__wt_strndup(
session, tmp->data, tmp->size, &cursor->value_format));
WT_ERR(__wt_buf_init(session, tmp, 0));
WT_ERR(__wt_struct_plan(session, table,
- columns, strlen(columns), 0, tmp));
+ columns, strlen(columns), false, tmp));
WT_ERR(__wt_strndup(
session, tmp->data, tmp->size, &ctable->plan));
}
diff --git a/src/third_party/wiredtiger/src/evict/evict_file.c b/src/third_party/wiredtiger/src/evict/evict_file.c
index 795833d3b25..c5e04806062 100644
--- a/src/third_party/wiredtiger/src/evict/evict_file.c
+++ b/src/third_party/wiredtiger/src/evict/evict_file.c
@@ -18,7 +18,7 @@ __wt_evict_file(WT_SESSION_IMPL *session, int syncop)
WT_DECL_RET;
WT_PAGE *page;
WT_REF *next_ref, *ref;
- int evict_reset;
+ bool evict_reset;
/*
* We need exclusive access to the file -- disable ordinary eviction
@@ -27,7 +27,7 @@ __wt_evict_file(WT_SESSION_IMPL *session, int syncop)
WT_RET(__wt_evict_file_exclusive_on(session, &evict_reset));
/* Make sure the oldest transaction ID is up-to-date. */
- __wt_txn_update_oldest(session, 1);
+ __wt_txn_update_oldest(session, true);
/* Walk the tree, discarding pages. */
next_ref = NULL;
@@ -80,7 +80,7 @@ __wt_evict_file(WT_SESSION_IMPL *session, int syncop)
break;
case WT_SYNC_DISCARD:
WT_ASSERT(session,
- __wt_page_can_evict(session, page, 0));
+ __wt_page_can_evict(session, page, 0, NULL));
__wt_evict_page_clean_update(session, ref);
break;
case WT_SYNC_DISCARD_FORCE:
diff --git a/src/third_party/wiredtiger/src/evict/evict_lru.c b/src/third_party/wiredtiger/src/evict/evict_lru.c
index f077f168a26..eec7c3d2f0d 100644
--- a/src/third_party/wiredtiger/src/evict/evict_lru.c
+++ b/src/third_party/wiredtiger/src/evict/evict_lru.c
@@ -8,15 +8,15 @@
#include "wt_internal.h"
-static int __evict_clear_all_walks(WT_SESSION_IMPL *);
-static int __evict_clear_walks(WT_SESSION_IMPL *);
-static int __evict_has_work(WT_SESSION_IMPL *, uint32_t *);
-static int WT_CDECL __evict_lru_cmp(const void *, const void *);
-static int __evict_lru_pages(WT_SESSION_IMPL *, int);
-static int __evict_lru_walk(WT_SESSION_IMPL *, uint32_t);
-static int __evict_pass(WT_SESSION_IMPL *);
-static int __evict_walk(WT_SESSION_IMPL *, uint32_t);
-static int __evict_walk_file(WT_SESSION_IMPL *, u_int *, uint32_t);
+static int __evict_clear_all_walks(WT_SESSION_IMPL *);
+static int __evict_clear_walks(WT_SESSION_IMPL *);
+static int __evict_has_work(WT_SESSION_IMPL *, uint32_t *);
+static int WT_CDECL __evict_lru_cmp(const void *, const void *);
+static int __evict_lru_pages(WT_SESSION_IMPL *, bool);
+static int __evict_lru_walk(WT_SESSION_IMPL *, uint32_t);
+static int __evict_pass(WT_SESSION_IMPL *);
+static int __evict_walk(WT_SESSION_IMPL *, uint32_t);
+static int __evict_walk_file(WT_SESSION_IMPL *, u_int *, uint32_t);
static WT_THREAD_RET __evict_worker(void *);
static int __evict_server_work(WT_SESSION_IMPL *);
@@ -248,7 +248,7 @@ __evict_workers_resize(WT_SESSION_IMPL *session)
for (i = conn->evict_workers_alloc; i < conn->evict_workers_max; i++) {
WT_ERR(__wt_open_internal_session(conn,
- "eviction-worker", 0, 0, &workers[i].session));
+ "eviction-worker", true, false, &workers[i].session));
workers[i].id = i;
F_SET(workers[i].session, WT_SESSION_CAN_WAIT);
@@ -280,7 +280,7 @@ __wt_evict_create(WT_SESSION_IMPL *session)
/* We need a session handle because we're reading/writing pages. */
WT_RET(__wt_open_internal_session(
- conn, "eviction-server", 0, 0, &conn->evict_session));
+ conn, "eviction-server", true, false, &conn->evict_session));
session = conn->evict_session;
/*
@@ -304,7 +304,7 @@ __wt_evict_create(WT_SESSION_IMPL *session)
*/
WT_RET(__wt_thread_create(
session, &conn->evict_tid, __evict_server, session));
- conn->evict_tid_set = 1;
+ conn->evict_tid_set = true;
return (0);
}
@@ -340,7 +340,7 @@ __wt_evict_destroy(WT_SESSION_IMPL *session)
if (conn->evict_tid_set) {
WT_TRET(__wt_evict_server_wake(session));
WT_TRET(__wt_thread_join(session, conn->evict_tid));
- conn->evict_tid_set = 0;
+ conn->evict_tid_set = false;
}
WT_TRET(__wt_verbose(
@@ -390,7 +390,7 @@ __evict_worker(void *arg)
while (F_ISSET(conn, WT_CONN_EVICTION_RUN) &&
F_ISSET(worker, WT_EVICT_WORKER_RUN)) {
/* Don't spin in a busy loop if there is no work to do */
- if ((ret = __evict_lru_pages(session, 0)) == WT_NOTFOUND)
+ if ((ret = __evict_lru_pages(session, false)) == WT_NOTFOUND)
WT_ERR(__wt_cond_wait(
session, cache->evict_waiter_cond, 10000));
else
@@ -422,9 +422,6 @@ __evict_has_work(WT_SESSION_IMPL *session, uint32_t *flagsp)
flags = 0;
*flagsp = 0;
- if (!F_ISSET(conn, WT_CONN_EVICTION_RUN))
- return (0);
-
/*
* Figure out whether the cache usage exceeds either the eviction
* target or the dirty target.
@@ -508,7 +505,7 @@ __evict_pass(WT_SESSION_IMPL *session)
* of whether the cache is full, to prevent the oldest ID
* falling too far behind.
*/
- __wt_txn_update_oldest(session, 1);
+ __wt_txn_update_oldest(session, true);
WT_RET(__evict_has_work(session, &flags));
if (flags == 0)
@@ -709,8 +706,8 @@ __wt_evict_page(WT_SESSION_IMPL *session, WT_REF *ref)
* Sanity check: if a transaction has updates, its updates should not
* be visible to eviction.
*/
- WT_ASSERT(session,
- !F_ISSET(txn, TXN_HAS_ID) || !__wt_txn_visible(session, txn->id));
+ WT_ASSERT(session, !F_ISSET(txn, WT_TXN_HAS_ID) ||
+ !__wt_txn_visible(session, txn->id));
ret = __wt_evict(session, ref, 0);
txn->isolation = saved_iso;
@@ -724,7 +721,7 @@ __wt_evict_page(WT_SESSION_IMPL *session, WT_REF *ref)
* blocks queued for eviction.
*/
int
-__wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, int *evict_resetp)
+__wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, bool *evict_resetp)
{
WT_BTREE *btree;
WT_CACHE *cache;
@@ -738,10 +735,10 @@ __wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, int *evict_resetp)
* If the file isn't evictable, there's no work to do.
*/
if (F_ISSET(btree, WT_BTREE_NO_EVICTION)) {
- *evict_resetp = 0;
+ *evict_resetp = false;
return (0);
}
- *evict_resetp = 1;
+ *evict_resetp = true;
/*
* Hold the walk lock to set the "no eviction" flag: no new pages from
@@ -798,7 +795,7 @@ __wt_evict_file_exclusive_off(WT_SESSION_IMPL *session)
* Get pages from the LRU queue to evict.
*/
static int
-__evict_lru_pages(WT_SESSION_IMPL *session, int is_server)
+__evict_lru_pages(WT_SESSION_IMPL *session, bool is_server)
{
WT_DECL_RET;
@@ -928,7 +925,7 @@ __evict_server_work(WT_SESSION_IMPL *session)
cache->evict_current != NULL)
__wt_yield();
} else
- WT_RET_NOTFOUND_OK(__evict_lru_pages(session, 1));
+ WT_RET_NOTFOUND_OK(__evict_lru_pages(session, true));
return (0);
}
@@ -946,13 +943,13 @@ __evict_walk(WT_SESSION_IMPL *session, uint32_t flags)
WT_DATA_HANDLE *dhandle;
WT_DECL_RET;
u_int max_entries, prev_slot, retries, slot, start_slot, spins;
- int incr, dhandle_locked;
+ bool dhandle_locked, incr;
WT_DECL_SPINLOCK_ID(id);
conn = S2C(session);
cache = S2C(session)->cache;
dhandle = NULL;
- incr = dhandle_locked = 0;
+ dhandle_locked = incr = false;
retries = 0;
if (cache->evict_current == NULL)
@@ -991,7 +988,7 @@ retry: while (slot < max_entries && ret == 0) {
}
if (ret != 0)
break;
- dhandle_locked = 1;
+ dhandle_locked = true;
}
if (dhandle == NULL) {
@@ -1009,7 +1006,7 @@ retry: while (slot < max_entries && ret == 0) {
WT_ASSERT(session, dhandle->session_inuse > 0);
(void)__wt_atomic_subi32(
&dhandle->session_inuse, 1);
- incr = 0;
+ incr = false;
}
dhandle = TAILQ_NEXT(dhandle, q);
}
@@ -1053,9 +1050,9 @@ retry: while (slot < max_entries && ret == 0) {
prev_slot = slot;
(void)__wt_atomic_addi32(&dhandle->session_inuse, 1);
- incr = 1;
+ incr = true;
__wt_spin_unlock(session, &conn->dhandle_lock);
- dhandle_locked = 0;
+ dhandle_locked = false;
__wt_spin_lock(session, &cache->evict_walk_lock);
@@ -1088,12 +1085,12 @@ retry: while (slot < max_entries && ret == 0) {
WT_ASSERT(session, dhandle->session_inuse > 0);
(void)__wt_atomic_subi32(&dhandle->session_inuse, 1);
- incr = 0;
+ incr = false;
}
if (dhandle_locked) {
__wt_spin_unlock(session, &conn->dhandle_lock);
- dhandle_locked = 0;
+ dhandle_locked = false;
}
/*
@@ -1157,14 +1154,16 @@ __evict_walk_file(WT_SESSION_IMPL *session, u_int *slotp, uint32_t flags)
WT_REF *ref;
uint64_t pages_walked;
uint32_t walk_flags;
- int enough, internal_pages, modified, restarts;
+ int internal_pages, restarts;
+ bool enough, modified;
btree = S2BT(session);
cache = S2C(session)->cache;
start = cache->evict + *slotp;
end = WT_MIN(start + WT_EVICT_WALK_PER_FILE,
cache->evict + cache->evict_slots);
- enough = internal_pages = restarts = 0;
+ internal_pages = restarts = 0;
+ enough = false;
walk_flags = WT_READ_CACHE | WT_READ_NO_EVICT |
WT_READ_NO_GEN | WT_READ_NO_WAIT;
@@ -1188,7 +1187,7 @@ __evict_walk_file(WT_SESSION_IMPL *session, u_int *slotp, uint32_t flags)
evict < end && !enough && (ret == 0 || ret == WT_NOTFOUND);
ret = __wt_tree_walk(
session, &btree->evict_ref, &pages_walked, walk_flags)) {
- enough = (pages_walked > WT_EVICT_MAX_PER_FILE);
+ enough = pages_walked > WT_EVICT_MAX_PER_FILE;
if ((ref = btree->evict_ref) == NULL) {
if (++restarts == 2 || enough)
break;
@@ -1239,7 +1238,7 @@ __evict_walk_file(WT_SESSION_IMPL *session, u_int *slotp, uint32_t flags)
page->read_gen = __wt_cache_read_gen_new(session);
fast: /* If the page can't be evicted, give up. */
- if (!__wt_page_can_evict(session, page, 1))
+ if (!__wt_page_can_evict(session, page, true, NULL))
continue;
/*
@@ -1312,7 +1311,7 @@ fast: /* If the page can't be evicted, give up. */
*/
static int
__evict_get_ref(
- WT_SESSION_IMPL *session, int is_server, WT_BTREE **btreep, WT_REF **refp)
+ WT_SESSION_IMPL *session, bool is_server, WT_BTREE **btreep, WT_REF **refp)
{
WT_CACHE *cache;
WT_EVICT_ENTRY *evict;
@@ -1395,7 +1394,7 @@ __evict_get_ref(
* Called by both eviction and application threads to evict a page.
*/
int
-__wt_evict_lru_page(WT_SESSION_IMPL *session, int is_server)
+__wt_evict_lru_page(WT_SESSION_IMPL *session, bool is_server)
{
WT_BTREE *btree;
WT_CACHE *cache;
@@ -1470,7 +1469,8 @@ __wt_cache_wait(WT_SESSION_IMPL *session, int full)
WT_DECL_RET;
WT_TXN_GLOBAL *txn_global;
WT_TXN_STATE *txn_state;
- int busy, count;
+ int count;
+ bool busy;
cache = S2C(session)->cache;
@@ -1530,10 +1530,13 @@ __wt_cache_wait(WT_SESSION_IMPL *session, int full)
/* Check if things have changed so that we are busy. */
if (!busy && txn_state->snap_min != WT_TXN_NONE &&
- txn_global->current != txn_global->oldest_id)
- busy = count = 1;
+ txn_global->current != txn_global->oldest_id) {
+ busy = true;
+ count = 1;
+ }
}
}
+
#ifdef HAVE_DIAGNOSTIC
/*
* __wt_cache_dump --
diff --git a/src/third_party/wiredtiger/src/evict/evict_page.c b/src/third_party/wiredtiger/src/evict/evict_page.c
index fe08916b24c..f4693511e11 100644
--- a/src/third_party/wiredtiger/src/evict/evict_page.c
+++ b/src/third_party/wiredtiger/src/evict/evict_page.c
@@ -8,8 +8,8 @@
#include "wt_internal.h"
-static int __evict_page_dirty_update(WT_SESSION_IMPL *, WT_REF *, int);
-static int __evict_review(WT_SESSION_IMPL *, WT_REF *, int, int *);
+static int __evict_page_dirty_update(WT_SESSION_IMPL *, WT_REF *, bool);
+static int __evict_review(WT_SESSION_IMPL *, WT_REF *, bool, bool *);
/*
* __evict_exclusive_clear --
@@ -49,13 +49,13 @@ __evict_exclusive(WT_SESSION_IMPL *session, WT_REF *ref)
* Evict a page.
*/
int
-__wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
+__wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
WT_PAGE *page;
WT_PAGE_MODIFY *mod;
- int forced_eviction, inmem_split;
+ bool forced_eviction, inmem_split;
conn = S2C(session);
@@ -63,8 +63,8 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
WT_ASSERT(session, !WT_SESSION_IS_CHECKPOINT(session));
page = ref->page;
- forced_eviction = (page->read_gen == WT_READGEN_OLDEST);
- inmem_split = 0;
+ forced_eviction = page->read_gen == WT_READGEN_OLDEST;
+ inmem_split = false;
WT_RET(__wt_verbose(session, WT_VERB_EVICT,
"page %p (%s)", page, __wt_page_type_string(page->type)));
@@ -76,7 +76,7 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
* to make this check for clean pages, too: while unlikely eviction
* would choose an internal page with children, it's not disallowed.
*/
- WT_ERR(__evict_review(session, ref, exclusive, &inmem_split));
+ WT_ERR(__evict_review(session, ref, closing, &inmem_split));
/*
* If there was an in-memory split, the tree has been left in the state
@@ -92,7 +92,7 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
mod = page->modify;
/* Count evictions of internal pages during normal operation. */
- if (!exclusive && WT_PAGE_IS_INTERNAL(page)) {
+ if (!closing && WT_PAGE_IS_INTERNAL(page)) {
WT_STAT_FAST_CONN_INCR(session, cache_eviction_internal);
WT_STAT_FAST_DATA_INCR(session, cache_eviction_internal);
}
@@ -106,7 +106,7 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
conn->cache->evict_max_page_size = page->memory_footprint;
/* Update the reference and discard the page. */
- if (mod == NULL || !F_ISSET(mod, WT_PM_REC_MASK)) {
+ if (mod == NULL || mod->rec_result == 0) {
if (__wt_ref_is_root(ref))
__wt_ref_out(session, ref);
else
@@ -119,14 +119,14 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
__wt_ref_out(session, ref);
else
WT_ERR(
- __evict_page_dirty_update(session, ref, exclusive));
+ __evict_page_dirty_update(session, ref, closing));
WT_STAT_FAST_CONN_INCR(session, cache_eviction_dirty);
WT_STAT_FAST_DATA_INCR(session, cache_eviction_dirty);
}
if (0) {
-err: if (!exclusive)
+err: if (!closing)
__evict_exclusive_clear(session, ref);
WT_STAT_FAST_CONN_INCR(session, cache_eviction_fail);
@@ -164,7 +164,7 @@ __wt_evict_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref)
* Update a dirty page's reference on eviction.
*/
static int
-__evict_page_dirty_update(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
+__evict_page_dirty_update(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
{
WT_ADDR *addr;
WT_PAGE *parent;
@@ -173,7 +173,7 @@ __evict_page_dirty_update(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
parent = ref->home;
mod = ref->page->modify;
- switch (F_ISSET(mod, WT_PM_REC_MASK)) {
+ switch (mod->rec_result) {
case WT_PM_REC_EMPTY: /* Page is empty */
if (ref->addr != NULL && __wt_off_page(parent, ref->addr)) {
__wt_free(session, ((WT_ADDR *)ref->addr)->addr);
@@ -201,7 +201,7 @@ __evict_page_dirty_update(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
* A real split where we reconciled a page and it turned into a
* lot of pages.
*/
- WT_RET(__wt_split_multi(session, ref, exclusive));
+ WT_RET(__wt_split_multi(session, ref, closing));
break;
case WT_PM_REC_REPLACE: /* 1-for-1 page swap */
if (ref->addr != NULL && __wt_off_page(parent, ref->addr)) {
@@ -273,7 +273,7 @@ __evict_child_check(WT_SESSION_IMPL *session, WT_REF *parent)
*/
static int
__evict_review(
- WT_SESSION_IMPL *session, WT_REF *ref, int exclusive, int *inmem_splitp)
+ WT_SESSION_IMPL *session, WT_REF *ref, bool closing, bool *inmem_splitp)
{
WT_DECL_RET;
WT_PAGE *page;
@@ -284,7 +284,7 @@ __evict_review(
* Get exclusive access to the page if our caller doesn't have the tree
* locked down.
*/
- if (!exclusive) {
+ if (!closing) {
WT_RET(__evict_exclusive(session, ref));
/*
@@ -314,23 +314,32 @@ __evict_review(
}
/* Check if the page can be evicted. */
- if (!exclusive && !__wt_page_can_evict(session, page, 0))
- return (EBUSY);
+ if (!closing) {
+ /*
+ * Update the oldest ID to avoid wasted effort should it have
+ * fallen behind current.
+ */
+ if (__wt_page_is_modified(page))
+ __wt_txn_update_oldest(session, true);
- /*
- * Check for an append-only workload needing an in-memory split.
- *
- * We can't do this earlier because in-memory splits require exclusive
- * access, and we can't split if a checkpoint is in progress because
- * the checkpoint could be walking the parent page.
- *
- * If an in-memory split completes, the page stays in memory and the
- * tree is left in the desired state: avoid the usual cleanup.
- */
- if (!exclusive) {
- WT_RET(__wt_split_insert(session, ref, inmem_splitp));
+ if (!__wt_page_can_evict(session, page, false, inmem_splitp))
+ return (EBUSY);
+
+ /*
+ * Check for an append-only workload needing an in-memory
+ * split.
+ *
+ * We can't do this earlier because in-memory splits require
+ * exclusive access, and we can't split if a checkpoint is in
+ * progress because the checkpoint could be walking the parent
+ * page.
+ *
+ * If an in-memory split completes, the page stays in memory
+ * and the tree is left in the desired state: avoid the usual
+ * cleanup.
+ */
if (*inmem_splitp)
- return (0);
+ return (__wt_split_insert(session, ref));
}
/*
@@ -354,7 +363,7 @@ __evict_review(
*/
reconcile_flags = WT_EVICTING;
if (__wt_page_is_modified(page)) {
- if (exclusive)
+ if (closing)
FLD_SET(reconcile_flags, WT_SKIP_UPDATE_ERR);
else if (!WT_PAGE_IS_INTERNAL(page) &&
page->read_gen == WT_READGEN_OLDEST)
@@ -369,7 +378,7 @@ __evict_review(
* If the page was ever modified, make sure all of the updates
* on the page are old enough they can be discarded from cache.
*/
- if (!exclusive && mod != NULL &&
+ if (!closing && mod != NULL &&
!__wt_txn_visible_all(session, mod->rec_max_txn) &&
!FLD_ISSET(reconcile_flags, WT_SKIP_UPDATE_RESTORE))
return (EBUSY);
diff --git a/src/third_party/wiredtiger/src/include/api.h b/src/third_party/wiredtiger/src/include/api.h
index 70068e32b9b..4514f5a42fa 100644
--- a/src/third_party/wiredtiger/src/include/api.h
+++ b/src/third_party/wiredtiger/src/include/api.h
@@ -33,37 +33,37 @@
if ((s) != NULL) { \
(s)->dhandle = __olddh; \
(s)->name = __oldname; \
- if (F_ISSET(&(s)->txn, TXN_RUNNING) && \
+ if (F_ISSET(&(s)->txn, WT_TXN_RUNNING) && \
(ret) != 0 && \
(ret) != WT_NOTFOUND && \
(ret) != WT_DUPLICATE_KEY) \
- F_SET(&(s)->txn, TXN_ERROR); \
+ F_SET(&(s)->txn, WT_TXN_ERROR); \
} \
} while (0)
/* An API call wrapped in a transaction if necessary. */
#define TXN_API_CALL(s, h, n, cur, bt, config, cfg) do { \
- int __autotxn = 0; \
+ bool __autotxn = false; \
API_CALL(s, h, n, bt, cur, config, cfg); \
- __autotxn = !F_ISSET(&(s)->txn, TXN_AUTOCOMMIT | TXN_RUNNING); \
+ __autotxn = !F_ISSET(&(s)->txn, WT_TXN_AUTOCOMMIT | WT_TXN_RUNNING);\
if (__autotxn) \
- F_SET(&(s)->txn, TXN_AUTOCOMMIT)
+ F_SET(&(s)->txn, WT_TXN_AUTOCOMMIT)
/* An API call wrapped in a transaction if necessary. */
#define TXN_API_CALL_NOCONF(s, h, n, cur, bt) do { \
- int __autotxn = 0; \
+ bool __autotxn = false; \
API_CALL_NOCONF(s, h, n, cur, bt); \
- __autotxn = !F_ISSET(&(s)->txn, TXN_AUTOCOMMIT | TXN_RUNNING); \
+ __autotxn = !F_ISSET(&(s)->txn, WT_TXN_AUTOCOMMIT | WT_TXN_RUNNING);\
if (__autotxn) \
- F_SET(&(s)->txn, TXN_AUTOCOMMIT)
+ F_SET(&(s)->txn, WT_TXN_AUTOCOMMIT)
/* End a transactional API call, optional retry on deadlock. */
#define TXN_API_END_RETRY(s, ret, retry) \
API_END(s, ret); \
if (__autotxn) { \
- if (F_ISSET(&(s)->txn, TXN_AUTOCOMMIT)) \
- F_CLR(&(s)->txn, TXN_AUTOCOMMIT); \
- else if (ret == 0 && !F_ISSET(&(s)->txn, TXN_ERROR)) \
+ if (F_ISSET(&(s)->txn, WT_TXN_AUTOCOMMIT)) \
+ F_CLR(&(s)->txn, WT_TXN_AUTOCOMMIT); \
+ else if (ret == 0 && !F_ISSET(&(s)->txn, WT_TXN_ERROR)) \
ret = __wt_txn_commit((s), NULL); \
else { \
WT_TRET(__wt_txn_rollback((s), NULL)); \
diff --git a/src/third_party/wiredtiger/src/include/bitstring.i b/src/third_party/wiredtiger/src/include/bitstring.i
index c548c12761d..5449ffe6209 100644
--- a/src/third_party/wiredtiger/src/include/bitstring.i
+++ b/src/third_party/wiredtiger/src/include/bitstring.i
@@ -84,10 +84,10 @@ __bit_alloc(WT_SESSION_IMPL *session, uint64_t nbits, void *retp)
* __bit_test --
* Test one bit in name.
*/
-static inline int
+static inline bool
__bit_test(uint8_t *bitf, uint64_t bit)
{
- return (bitf[__bit_byte(bit)] & __bit_mask(bit) ? 1 : 0);
+ return ((bitf[__bit_byte(bit)] & __bit_mask(bit)) != 0);
}
/*
diff --git a/src/third_party/wiredtiger/src/include/block.h b/src/third_party/wiredtiger/src/include/block.h
index 8dd8e12a5c1..3fe433afe47 100644
--- a/src/third_party/wiredtiger/src/include/block.h
+++ b/src/third_party/wiredtiger/src/include/block.h
@@ -54,7 +54,7 @@ struct __wt_extlist {
wt_off_t offset; /* Written extent offset */
uint32_t cksum, size; /* Written extent cksum, size */
- int track_size; /* Maintain per-size skiplist */
+ bool track_size; /* Maintain per-size skiplist */
WT_EXT *last; /* Cached last element */
@@ -160,16 +160,16 @@ struct __wt_bm {
int (*addr_valid)(WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t);
u_int (*block_header)(WT_BM *);
int (*checkpoint)
- (WT_BM *, WT_SESSION_IMPL *, WT_ITEM *, WT_CKPT *, int);
+ (WT_BM *, WT_SESSION_IMPL *, WT_ITEM *, WT_CKPT *, bool);
int (*checkpoint_load)(WT_BM *, WT_SESSION_IMPL *,
- const uint8_t *, size_t, uint8_t *, size_t *, int);
+ const uint8_t *, size_t, uint8_t *, size_t *, bool);
int (*checkpoint_resolve)(WT_BM *, WT_SESSION_IMPL *);
int (*checkpoint_unload)(WT_BM *, WT_SESSION_IMPL *);
int (*close)(WT_BM *, WT_SESSION_IMPL *);
int (*compact_end)(WT_BM *, WT_SESSION_IMPL *);
int (*compact_page_skip)
- (WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t, int *);
- int (*compact_skip)(WT_BM *, WT_SESSION_IMPL *, int *);
+ (WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t, bool *);
+ int (*compact_skip)(WT_BM *, WT_SESSION_IMPL *, bool *);
int (*compact_start)(WT_BM *, WT_SESSION_IMPL *);
int (*free)(WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t);
int (*preload)(WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t);
@@ -177,18 +177,18 @@ struct __wt_bm {
(WT_BM *, WT_SESSION_IMPL *, WT_ITEM *, const uint8_t *, size_t);
int (*salvage_end)(WT_BM *, WT_SESSION_IMPL *);
int (*salvage_next)
- (WT_BM *, WT_SESSION_IMPL *, uint8_t *, size_t *, int *);
+ (WT_BM *, WT_SESSION_IMPL *, uint8_t *, size_t *, bool *);
int (*salvage_start)(WT_BM *, WT_SESSION_IMPL *);
int (*salvage_valid)
- (WT_BM *, WT_SESSION_IMPL *, uint8_t *, size_t, int);
+ (WT_BM *, WT_SESSION_IMPL *, uint8_t *, size_t, bool);
int (*stat)(WT_BM *, WT_SESSION_IMPL *, WT_DSRC_STATS *stats);
- int (*sync)(WT_BM *, WT_SESSION_IMPL *, int);
+ int (*sync)(WT_BM *, WT_SESSION_IMPL *, bool);
int (*verify_addr)(WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t);
int (*verify_end)(WT_BM *, WT_SESSION_IMPL *);
int (*verify_start)
(WT_BM *, WT_SESSION_IMPL *, WT_CKPT *, const char *[]);
int (*write) (WT_BM *,
- WT_SESSION_IMPL *, WT_ITEM *, uint8_t *, size_t *, int);
+ WT_SESSION_IMPL *, WT_ITEM *, uint8_t *, size_t *, bool);
int (*write_size)(WT_BM *, WT_SESSION_IMPL *, size_t *);
WT_BLOCK *block; /* Underlying file */
@@ -201,7 +201,7 @@ struct __wt_bm {
* There's only a single block manager handle that can be written, all
* others are checkpoints.
*/
- int is_live; /* The live system */
+ bool is_live; /* The live system */
};
/*
@@ -237,7 +237,7 @@ struct __wt_block {
*/
WT_SPINLOCK live_lock; /* Live checkpoint lock */
WT_BLOCK_CKPT live; /* Live checkpoint */
- int ckpt_inprogress;/* Live checkpoint in progress */
+ bool ckpt_inprogress;/* Live checkpoint in progress */
/* Compaction support */
int compact_pct_tenths; /* Percent to compact */
@@ -246,8 +246,8 @@ struct __wt_block {
wt_off_t slvg_off; /* Salvage file offset */
/* Verification support */
- int verify; /* If performing verification */
- int verify_strict; /* Fail hard on any error */
+ bool verify; /* If performing verification */
+ bool verify_strict; /* Fail hard on any error */
wt_off_t verify_size; /* Checkpoint's file size */
WT_EXTLIST verify_alloc; /* Verification allocation list */
uint64_t frags; /* Maximum frags in the file */
diff --git a/src/third_party/wiredtiger/src/include/btmem.h b/src/third_party/wiredtiger/src/include/btmem.h
index 2933add6201..9910cad0ae7 100644
--- a/src/third_party/wiredtiger/src/include/btmem.h
+++ b/src/third_party/wiredtiger/src/include/btmem.h
@@ -358,14 +358,11 @@ struct __wt_page_modify {
__wt_spin_unlock((s), &S2C(s)->page_lock[(p)->modify->page_lock])
uint8_t page_lock; /* Page's spinlock */
-#define WT_PM_REC_EMPTY 0x01 /* Reconciliation: no replacement */
-#define WT_PM_REC_MULTIBLOCK 0x02 /* Reconciliation: multiple blocks */
-#define WT_PM_REC_REPLACE 0x04 /* Reconciliation: single block */
-#define WT_PM_REC_REWRITE 0x08 /* Reconciliation: rewrite in place */
-#define WT_PM_REC_MASK \
- (WT_PM_REC_EMPTY | WT_PM_REC_MULTIBLOCK | \
- WT_PM_REC_REPLACE | WT_PM_REC_REWRITE)
- uint8_t flags; /* Page flags */
+#define WT_PM_REC_EMPTY 1 /* Reconciliation: no replacement */
+#define WT_PM_REC_MULTIBLOCK 2 /* Reconciliation: multiple blocks */
+#define WT_PM_REC_REPLACE 3 /* Reconciliation: single block */
+#define WT_PM_REC_REWRITE 4 /* Reconciliation: rewrite in place */
+ uint8_t rec_result; /* Reconciliation state */
};
/*
diff --git a/src/third_party/wiredtiger/src/include/btree.h b/src/third_party/wiredtiger/src/include/btree.h
index 264ebdefc39..25b528e092e 100644
--- a/src/third_party/wiredtiger/src/include/btree.h
+++ b/src/third_party/wiredtiger/src/include/btree.h
@@ -102,9 +102,9 @@ struct __wt_btree {
* Reconciliation...
*/
u_int dictionary; /* Dictionary slots */
- int internal_key_truncate; /* Internal key truncate */
+ bool internal_key_truncate; /* Internal key truncate */
int maximum_depth; /* Maximum tree depth */
- int prefix_compression; /* Prefix compression */
+ bool prefix_compression; /* Prefix compression */
u_int prefix_compression_min; /* Prefix compression min */
#define WT_SPLIT_DEEPEN_MIN_CHILD_DEF 10000
u_int split_deepen_min_child; /* Minimum entries to deepen tree */
@@ -118,7 +118,7 @@ struct __wt_btree {
WT_REF root; /* Root page reference */
int modified; /* If the tree ever modified */
- int bulk_load_ok; /* Bulk-load is a possibility */
+ bool bulk_load_ok; /* Bulk-load is a possibility */
WT_BM *bm; /* Block manager reference */
u_int block_header; /* WT_PAGE_HEADER_BYTE_SIZE */
@@ -166,5 +166,5 @@ struct __wt_salvage_cookie {
uint64_t skip; /* Initial items to skip */
uint64_t take; /* Items to take */
- int done; /* Ignore the rest */
+ bool done; /* Ignore the rest */
};
diff --git a/src/third_party/wiredtiger/src/include/btree.i b/src/third_party/wiredtiger/src/include/btree.i
index 5db6ff1f002..dad695f8628 100644
--- a/src/third_party/wiredtiger/src/include/btree.i
+++ b/src/third_party/wiredtiger/src/include/btree.i
@@ -10,31 +10,31 @@
* __wt_ref_is_root --
* Return if the page reference is for the root page.
*/
-static inline int
+static inline bool
__wt_ref_is_root(WT_REF *ref)
{
- return (ref->home == NULL ? 1 : 0);
+ return (ref->home == NULL);
}
/*
* __wt_page_is_empty --
* Return if the page is empty.
*/
-static inline int
+static inline bool
__wt_page_is_empty(WT_PAGE *page)
{
return (page->modify != NULL &&
- F_ISSET(page->modify, WT_PM_REC_MASK) == WT_PM_REC_EMPTY ? 1 : 0);
+ page->modify->rec_result == WT_PM_REC_EMPTY);
}
/*
* __wt_page_is_modified --
* Return if the page is dirty.
*/
-static inline int
+static inline bool
__wt_page_is_modified(WT_PAGE *page)
{
- return (page->modify != NULL && page->modify->write_gen != 0 ? 1 : 0);
+ return (page->modify != NULL && page->modify->write_gen != 0);
}
/*
@@ -77,12 +77,12 @@ __wt_cache_decr_check_size(
(void)__wt_atomic_addsize(vp, v);
{
- static int first = 1;
+ static bool first = true;
if (!first)
return;
__wt_errx(session, "%s underflow: decrementing %" WT_SIZET_FMT, fld, v);
- first = 0;
+ first = false;
}
#else
WT_UNUSED(fld);
@@ -105,12 +105,12 @@ __wt_cache_decr_check_uint64(
(void)__wt_atomic_add64(vp, v);
{
- static int first = 1;
+ static bool first = true;
if (!first)
return;
__wt_errx(session, "%s underflow: decrementing %" WT_SIZET_FMT, fld, v);
- first = 0;
+ first = false;
}
#else
WT_UNUSED(fld);
@@ -350,7 +350,7 @@ __wt_page_only_modify_set(WT_SESSION_IMPL *session, WT_PAGE *page)
* The page can never end up with changes older than the oldest
* running transaction.
*/
- if (F_ISSET(&session->txn, TXN_HAS_SNAPSHOT))
+ if (F_ISSET(&session->txn, WT_TXN_HAS_SNAPSHOT))
page->modify->disk_snap_min = session->txn.snap_min;
/*
@@ -367,7 +367,7 @@ __wt_page_only_modify_set(WT_SESSION_IMPL *session, WT_PAGE *page)
}
/* Check if this is the largest transaction ID to update the page. */
- if (TXNID_LT(page->modify->update_txn, session->txn.id))
+ if (WT_TXNID_LT(page->modify->update_txn, session->txn.id))
page->modify->update_txn = session->txn.id;
}
@@ -404,7 +404,7 @@ __wt_page_modify_set(WT_SESSION_IMPL *session, WT_PAGE *page)
*/
static inline int
__wt_page_parent_modify_set(
- WT_SESSION_IMPL *session, WT_REF *ref, int page_only)
+ WT_SESSION_IMPL *session, WT_REF *ref, bool page_only)
{
WT_PAGE *parent;
@@ -432,7 +432,7 @@ __wt_page_parent_modify_set(
* __wt_off_page --
* Return if a pointer references off-page data.
*/
-static inline int
+static inline bool
__wt_off_page(WT_PAGE *page, const void *p)
{
/*
@@ -543,7 +543,7 @@ __wt_ref_key_clear(WT_REF *ref)
* had without unpacking a cell, and information about the cell, if the key
* isn't cheaply available.
*/
-static inline int
+static inline bool
__wt_row_leaf_key_info(WT_PAGE *page, void *copy,
WT_IKEY **ikeyp, WT_CELL **cellp, void *datap, size_t *sizep)
{
@@ -634,7 +634,7 @@ __wt_row_leaf_key_info(WT_PAGE *page, void *copy,
if (cellp != NULL)
*cellp =
WT_PAGE_REF_OFFSET(page, WT_CELL_DECODE_OFFSET(v));
- return (0);
+ return (false);
case WT_K_FLAG:
/* Encoded key: no instantiated key, no cell. */
if (cellp != NULL)
@@ -645,9 +645,9 @@ __wt_row_leaf_key_info(WT_PAGE *page, void *copy,
*(void **)datap =
WT_PAGE_REF_OFFSET(page, WT_K_DECODE_KEY_OFFSET(v));
*sizep = WT_K_DECODE_KEY_LEN(v);
- return (1);
+ return (true);
}
- return (0);
+ return (false);
case WT_KV_FLAG:
/* Encoded key/value pair: no instantiated key, no cell. */
if (cellp != NULL)
@@ -658,9 +658,9 @@ __wt_row_leaf_key_info(WT_PAGE *page, void *copy,
*(void **)datap = WT_PAGE_REF_OFFSET(
page, WT_KV_DECODE_KEY_OFFSET(v));
*sizep = WT_KV_DECODE_KEY_LEN(v);
- return (1);
+ return (true);
}
- return (0);
+ return (false);
}
@@ -673,9 +673,9 @@ __wt_row_leaf_key_info(WT_PAGE *page, void *copy,
if (datap != NULL) {
*(void **)datap = WT_IKEY_DATA(ikey);
*sizep = ikey->size;
- return (1);
+ return (true);
}
- return (0);
+ return (false);
}
/*
@@ -760,7 +760,7 @@ __wt_row_leaf_value_set(WT_PAGE *page, WT_ROW *rip, WT_CELL_UNPACK *unpack)
*/
static inline int
__wt_row_leaf_key(WT_SESSION_IMPL *session,
- WT_PAGE *page, WT_ROW *rip, WT_ITEM *key, int instantiate)
+ WT_PAGE *page, WT_ROW *rip, WT_ITEM *key, bool instantiate)
{
void *copy;
@@ -807,7 +807,7 @@ __wt_cursor_row_leaf_key(WT_CURSOR_BTREE *cbt, WT_ITEM *key)
session = (WT_SESSION_IMPL *)cbt->iface.session;
page = cbt->ref->page;
rip = &page->u.row.d[cbt->slot];
- WT_RET(__wt_row_leaf_key(session, page, rip, key, 0));
+ WT_RET(__wt_row_leaf_key(session, page, rip, key, false));
} else {
key->data = WT_INSERT_KEY(cbt->ins);
key->size = WT_INSERT_KEY_SIZE(cbt->ins);
@@ -863,7 +863,7 @@ __wt_row_leaf_value_cell(WT_PAGE *page, WT_ROW *rip, WT_CELL_UNPACK *kpack)
* __wt_row_leaf_value --
* Return the value for a row-store leaf page encoded key/value pair.
*/
-static inline int
+static inline bool
__wt_row_leaf_value(WT_PAGE *page, WT_ROW *rip, WT_ITEM *value)
{
uintptr_t v;
@@ -879,9 +879,9 @@ __wt_row_leaf_value(WT_PAGE *page, WT_ROW *rip, WT_ITEM *value)
value->data =
WT_PAGE_REF_OFFSET(page, WT_KV_DECODE_VALUE_OFFSET(v));
value->size = WT_KV_DECODE_VALUE_LEN(v);
- return (1);
+ return (true);
}
- return (0);
+ return (false);
}
/*
@@ -937,21 +937,97 @@ __wt_ref_info(WT_SESSION_IMPL *session,
}
/*
+ * __wt_page_can_split --
+ * Check whether a page can be split in memory.
+ */
+static inline bool
+__wt_page_can_split(WT_SESSION_IMPL *session, WT_PAGE *page)
+{
+ WT_BTREE *btree;
+ WT_INSERT_HEAD *ins_head;
+ WT_INSERT *ins;
+ int i;
+
+ btree = S2BT(session);
+
+ /*
+ * Only split a page once, otherwise workloads that update in the middle
+ * of the page could continually split without benefit.
+ */
+ if (F_ISSET_ATOMIC(page, WT_PAGE_SPLIT_INSERT))
+ return (false);
+
+ /*
+ * Check for pages with append-only workloads. A common application
+ * pattern is to have multiple threads frantically appending to the
+ * tree. We want to reconcile and evict this page, but we'd like to
+ * do it without making the appending threads wait. See if it's worth
+ * doing a split to let the threads continue before doing eviction.
+ *
+ * Ignore anything other than large, dirty row-store leaf pages. The
+ * split code only supports row-store pages, and we depend on the page
+ * being dirty for correctness (the page must be reconciled again
+ * before being evicted after the split, information from a previous
+ * reconciliation will be wrong, so we can't evict immediately).
+ */
+ if (page->type != WT_PAGE_ROW_LEAF ||
+ page->memory_footprint < btree->maxmempage ||
+ !__wt_page_is_modified(page))
+ return (false);
+
+ /*
+ * There is no point splitting if the list is small, no deep items is
+ * our heuristic for that. A 1/4 probability of adding a new skiplist
+ * level, with level-0 always created, means there will be a 5th level
+ * entry for roughly every 1024 entries in the list. If there are at
+ * least 4 5th level entries (4K items), the list is large enough.
+ */
+#define WT_MIN_SPLIT_SKIPLIST_DEPTH WT_MIN(5, WT_SKIP_MAXDEPTH - 1)
+ ins_head = page->pg_row_entries == 0 ?
+ WT_ROW_INSERT_SMALLEST(page) :
+ WT_ROW_INSERT_SLOT(page, page->pg_row_entries - 1);
+ if (ins_head == NULL)
+ return (false);
+ for (i = 0, ins = ins_head->head[WT_MIN_SPLIT_SKIPLIST_DEPTH];
+ ins != NULL; ins = ins->next[WT_MIN_SPLIT_SKIPLIST_DEPTH])
+ if (++i == 4)
+ return (true);
+ return (false);
+}
+
+/*
* __wt_page_can_evict --
* Check whether a page can be evicted.
*/
-static inline int
-__wt_page_can_evict(WT_SESSION_IMPL *session, WT_PAGE *page, int check_splits)
+static inline bool
+__wt_page_can_evict(WT_SESSION_IMPL *session,
+ WT_PAGE *page, bool check_splits, bool *inmem_splitp)
{
WT_BTREE *btree;
WT_PAGE_MODIFY *mod;
+ WT_TXN_GLOBAL *txn_global;
+
+ if (inmem_splitp != NULL)
+ *inmem_splitp = false;
btree = S2BT(session);
mod = page->modify;
/* Pages that have never been modified can always be evicted. */
if (mod == NULL)
- return (1);
+ return (true);
+
+ /*
+ * Check for in-memory splits before other eviction tests. If the page
+ * should split in-memory, return success immediately and skip more
+ * detailed eviction tests. We don't need further tests since the page
+ * won't be written or discarded from the cache.
+ */
+ if (__wt_page_can_split(session, page)) {
+ if (inmem_splitp != NULL)
+ *inmem_splitp = true;
+ return (true);
+ }
/*
* If the tree was deepened, there's a requirement that newly created
@@ -964,7 +1040,7 @@ __wt_page_can_evict(WT_SESSION_IMPL *session, WT_PAGE *page, int check_splits)
*/
if (check_splits && WT_PAGE_IS_INTERNAL(page) &&
!__wt_txn_visible_all(session, mod->mod_split_txn))
- return (0);
+ return (false);
/*
* If the file is being checkpointed, we can't evict dirty pages:
@@ -974,44 +1050,23 @@ __wt_page_can_evict(WT_SESSION_IMPL *session, WT_PAGE *page, int check_splits)
*/
if (btree->checkpointing &&
(__wt_page_is_modified(page) ||
- F_ISSET(mod, WT_PM_REC_MULTIBLOCK))) {
+ mod->rec_result == WT_PM_REC_MULTIBLOCK)) {
WT_STAT_FAST_CONN_INCR(session, cache_eviction_checkpoint);
WT_STAT_FAST_DATA_INCR(session, cache_eviction_checkpoint);
- return (0);
+ return (false);
}
/*
- * If we aren't (potentially) doing eviction that can restore updates
- * and the updates on this page are too recent, give up.
- *
- * Don't rely on new updates being skipped by the transaction used
- * for transaction reads: (1) there are paths that dirty pages for
- * artificial reasons; (2) internal pages aren't transactional; and
- * (3) if an update was skipped during the checkpoint (leaving the page
- * dirty), then rolled back, we could still successfully overwrite a
- * page and corrupt the checkpoint.
- *
- * Further, we can't race with the checkpoint's reconciliation of
- * an internal page as we evict a clean child from the page's subtree.
- * This works in the usual way: eviction locks the page and then checks
- * for existing hazard pointers, the checkpoint thread reconciling an
- * internal page acquires hazard pointers on child pages it reads, and
- * is blocked by the exclusive lock.
- */
- if (page->read_gen != WT_READGEN_OLDEST &&
- !__wt_txn_visible_all(session, __wt_page_is_modified(page) ?
- mod->update_txn : mod->rec_max_txn))
- return (0);
-
- /*
* If the page was recently split in-memory, don't force it out: we
* hope an eviction thread will find it first.
*/
- if (check_splits &&
- !__wt_txn_visible_all(session, mod->inmem_split_txn))
- return (0);
+ if (check_splits) {
+ txn_global = &S2C(session)->txn_global;
+ if (WT_TXNID_LE(txn_global->oldest_id, mod->inmem_split_txn))
+ return (false);
+ }
- return (1);
+ return (true);
}
/*
@@ -1024,7 +1079,7 @@ __wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref)
WT_BTREE *btree;
WT_DECL_RET;
WT_PAGE *page;
- int locked, too_big;
+ bool locked, too_big;
btree = S2BT(session);
page = ref->page;
@@ -1035,7 +1090,8 @@ __wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref)
* reference without first locking the page, it could be evicted in
* between.
*/
- locked = __wt_atomic_casv32(&ref->state, WT_REF_MEM, WT_REF_LOCKED);
+ locked = __wt_atomic_casv32(
+ &ref->state, WT_REF_MEM, WT_REF_LOCKED) ? true : false;
if ((ret = __wt_hazard_clear(session, page)) != 0 || !locked) {
if (locked)
ref->state = WT_REF_MEM;
@@ -1097,7 +1153,7 @@ __wt_page_release(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags)
if (page->read_gen != WT_READGEN_OLDEST ||
LF_ISSET(WT_READ_NO_EVICT) ||
F_ISSET(btree, WT_BTREE_NO_EVICTION) ||
- !__wt_page_can_evict(session, page, 1))
+ !__wt_page_can_evict(session, page, true, NULL))
return (__wt_hazard_clear(session, page));
WT_RET_BUSY_OK(__wt_page_release_evict(session, ref));
@@ -1118,7 +1174,7 @@ __wt_page_swap_func(WT_SESSION_IMPL *session, WT_REF *held,
)
{
WT_DECL_RET;
- int acquired;
+ bool acquired;
/*
* In rare cases when walking the tree, we try to swap to the same
@@ -1211,13 +1267,13 @@ __wt_skip_choose_depth(WT_SESSION_IMPL *session)
}
/*
- * __wt_btree_lsm_size --
- * Check if the size of an in-memory tree with a single leaf page is over
+ * __wt_btree_lsm_over_size --
+ * Return if the size of an in-memory tree with a single leaf page is over
* a specified maximum. If called on anything other than a simple tree with a
* single leaf page, returns true so the calling code will switch to a new tree.
*/
-static inline int
-__wt_btree_lsm_size(WT_SESSION_IMPL *session, uint64_t maxsize)
+static inline bool
+__wt_btree_lsm_over_size(WT_SESSION_IMPL *session, uint64_t maxsize)
{
WT_BTREE *btree;
WT_PAGE *child, *root;
@@ -1229,20 +1285,20 @@ __wt_btree_lsm_size(WT_SESSION_IMPL *session, uint64_t maxsize)
/* Check for a non-existent tree. */
if (root == NULL)
- return (0);
+ return (false);
/* A tree that can be evicted always requires a switch. */
if (!F_ISSET(btree, WT_BTREE_NO_EVICTION))
- return (1);
+ return (true);
/* Check for a tree with a single leaf page. */
pindex = WT_INTL_INDEX_GET_SAFE(root);
if (pindex->entries != 1) /* > 1 child page, switch */
- return (1);
+ return (true);
first = pindex->index[0];
if (first->state != WT_REF_MEM) /* no child page, ignore */
- return (0);
+ return (false);
/*
* We're reaching down into the page without a hazard pointer, but
@@ -1251,7 +1307,7 @@ __wt_btree_lsm_size(WT_SESSION_IMPL *session, uint64_t maxsize)
*/
child = first->page;
if (child->type != WT_PAGE_ROW_LEAF) /* not a single leaf page */
- return (1);
+ return (true);
return (child->memory_footprint > maxsize);
}
diff --git a/src/third_party/wiredtiger/src/include/cache.i b/src/third_party/wiredtiger/src/include/cache.i
index d84069c43fb..f63a07de44e 100644
--- a/src/third_party/wiredtiger/src/include/cache.i
+++ b/src/third_party/wiredtiger/src/include/cache.i
@@ -161,7 +161,7 @@ __wt_session_can_wait(WT_SESSION_IMPL *session)
* highjack the thread for eviction.
*/
if (F_ISSET(session,
- WT_SESSION_NO_CACHE_CHECK | WT_SESSION_SCHEMA_LOCKED))
+ WT_SESSION_NO_CACHE_CHECK | WT_SESSION_LOCKED_SCHEMA))
return (0);
return (1);
@@ -169,7 +169,7 @@ __wt_session_can_wait(WT_SESSION_IMPL *session)
/*
* __wt_cache_full_check --
- * Wait for there to be space in the cache before a read or update.
+ * Evict pages if the cache crosses its boundaries.
*/
static inline int
__wt_cache_full_check(WT_SESSION_IMPL *session)
@@ -183,7 +183,7 @@ __wt_cache_full_check(WT_SESSION_IMPL *session)
* block eviction), we don't want to highjack the thread for eviction.
*/
if (F_ISSET(session, WT_SESSION_NO_CACHE_CHECK |
- WT_SESSION_SCHEMA_LOCKED | WT_SESSION_HANDLE_LIST_LOCKED))
+ WT_SESSION_LOCKED_SCHEMA | WT_SESSION_LOCKED_HANDLE_LIST))
return (0);
/*
diff --git a/src/third_party/wiredtiger/src/include/cell.i b/src/third_party/wiredtiger/src/include/cell.i
index 880e4e2402f..763a8229d85 100644
--- a/src/third_party/wiredtiger/src/include/cell.i
+++ b/src/third_party/wiredtiger/src/include/cell.i
@@ -230,11 +230,12 @@ __wt_cell_pack_data(WT_CELL *cell, uint64_t rle, size_t size)
*/
static inline int
__wt_cell_pack_data_match(
- WT_CELL *page_cell, WT_CELL *val_cell, const uint8_t *val_data, int *matchp)
+ WT_CELL *page_cell, WT_CELL *val_cell, const uint8_t *val_data,
+ bool *matchp)
{
const uint8_t *a, *b;
uint64_t av, bv;
- int rle;
+ bool rle;
*matchp = 0; /* Default to no-match */
@@ -252,7 +253,7 @@ __wt_cell_pack_data_match(
av = a[0] >> WT_CELL_SHORT_SHIFT;
++a;
} else if (WT_CELL_TYPE(a[0]) == WT_CELL_VALUE) {
- rle = a[0] & WT_CELL_64V ? 1 : 0; /* Skip any RLE */
+ rle = (a[0] & WT_CELL_64V) != 0; /* Skip any RLE */
++a;
if (rle)
WT_RET(__wt_vunpack_uint(&a, 0, &av));
@@ -264,7 +265,7 @@ __wt_cell_pack_data_match(
bv = b[0] >> WT_CELL_SHORT_SHIFT;
++b;
} else if (WT_CELL_TYPE(b[0]) == WT_CELL_VALUE) {
- rle = b[0] & WT_CELL_64V ? 1 : 0; /* Skip any RLE */
+ rle = (b[0] & WT_CELL_64V) != 0; /* Skip any RLE */
++b;
if (rle)
WT_RET(__wt_vunpack_uint(&b, 0, &bv));
@@ -273,7 +274,7 @@ __wt_cell_pack_data_match(
return (0);
if (av == bv)
- *matchp = memcmp(a, val_data, av) == 0 ? 1 : 0;
+ *matchp = memcmp(a, val_data, av) == 0;
return (0);
}
diff --git a/src/third_party/wiredtiger/src/include/connection.h b/src/third_party/wiredtiger/src/include/connection.h
index ef813b18849..6870fcb1640 100644
--- a/src/third_party/wiredtiger/src/include/connection.h
+++ b/src/third_party/wiredtiger/src/include/connection.h
@@ -234,11 +234,11 @@ struct __wt_connection_impl {
WT_TXN_GLOBAL txn_global; /* Global transaction state */
WT_SPINLOCK hot_backup_lock; /* Hot backup serialization */
- int hot_backup;
+ bool hot_backup;
WT_SESSION_IMPL *ckpt_session; /* Checkpoint thread session */
wt_thread_t ckpt_tid; /* Checkpoint thread */
- int ckpt_tid_set; /* Checkpoint thread set */
+ bool ckpt_tid_set; /* Checkpoint thread set */
WT_CONDVAR *ckpt_cond; /* Checkpoint wait mutex */
const char *ckpt_config; /* Checkpoint configuration */
#define WT_CKPT_LOGSIZE(conn) ((conn)->ckpt_logsize != 0)
@@ -290,7 +290,7 @@ struct __wt_connection_impl {
WT_SESSION_IMPL *evict_session; /* Eviction server sessions */
wt_thread_t evict_tid; /* Eviction server thread ID */
- int evict_tid_set; /* Eviction server thread ID set */
+ bool evict_tid_set; /* Eviction server thread ID set */
uint32_t evict_workers_alloc;/* Allocated eviction workers */
uint32_t evict_workers_max;/* Max eviction workers */
@@ -300,7 +300,7 @@ struct __wt_connection_impl {
WT_SESSION_IMPL *stat_session; /* Statistics log session */
wt_thread_t stat_tid; /* Statistics log thread */
- int stat_tid_set; /* Statistics log thread set */
+ bool stat_tid_set; /* Statistics log thread set */
WT_CONDVAR *stat_cond; /* Statistics log wait mutex */
const char *stat_format; /* Statistics log timestamp format */
FILE *stat_fp; /* Statistics log file handle */
@@ -318,15 +318,15 @@ struct __wt_connection_impl {
WT_CONDVAR *log_cond; /* Log server wait mutex */
WT_SESSION_IMPL *log_session; /* Log server session */
wt_thread_t log_tid; /* Log server thread */
- int log_tid_set; /* Log server thread set */
- WT_CONDVAR *log_file_cond; /* Log file thread wait mutex */
+ bool log_tid_set; /* Log server thread set */
+ WT_CONDVAR *log_file_cond; /* Log file thread wait mutex */
WT_SESSION_IMPL *log_file_session;/* Log file thread session */
wt_thread_t log_file_tid; /* Log file thread thread */
- int log_file_tid_set;/* Log file thread set */
+ bool log_file_tid_set;/* Log file thread set */
WT_CONDVAR *log_wrlsn_cond;/* Log write lsn thread wait mutex */
WT_SESSION_IMPL *log_wrlsn_session;/* Log write lsn thread session */
wt_thread_t log_wrlsn_tid; /* Log write lsn thread thread */
- int log_wrlsn_tid_set;/* Log write lsn thread set */
+ bool log_wrlsn_tid_set;/* Log write lsn thread set */
WT_LOG *log; /* Logging structure */
WT_COMPRESSOR *log_compressor;/* Logging compressor */
wt_off_t log_file_max; /* Log file max size */
@@ -365,7 +365,7 @@ struct __wt_connection_impl {
wt_off_t log_extend_len; /* file_extend log length */
uint32_t direct_io; /* O_DIRECT file type flags */
- int mmap; /* mmap configuration */
+ bool mmap; /* mmap configuration */
uint32_t verbose;
uint32_t flags;
diff --git a/src/third_party/wiredtiger/src/include/cursor.h b/src/third_party/wiredtiger/src/include/cursor.h
index d23deee8c98..6aa6589aba2 100644
--- a/src/third_party/wiredtiger/src/include/cursor.h
+++ b/src/third_party/wiredtiger/src/include/cursor.h
@@ -218,7 +218,7 @@ struct __wt_cursor_bulk {
uint32_t nrecs; /* Max records per chunk */
/* Special bitmap bulk load for fixed-length column stores. */
- int bitmap;
+ bool bitmap;
void *reconcile; /* Reconciliation information */
};
@@ -289,8 +289,8 @@ struct __wt_cursor_metadata {
struct __wt_cursor_stat {
WT_CURSOR iface;
- int notinitialized; /* Cursor not initialized */
- int notpositioned; /* Cursor not positioned */
+ bool notinitialized; /* Cursor not initialized */
+ bool notpositioned; /* Cursor not positioned */
WT_STATS *stats; /* Stats owned by the cursor */
WT_STATS *stats_first; /* First stats reference */
@@ -360,11 +360,11 @@ struct __wt_cursor_table {
*/
#define WT_CURSOR_CHECKKEY(cursor) do { \
if (!F_ISSET(cursor, WT_CURSTD_KEY_SET)) \
- WT_ERR(__wt_cursor_kv_not_set(cursor, 1)); \
+ WT_ERR(__wt_cursor_kv_not_set(cursor, true)); \
} while (0)
#define WT_CURSOR_CHECKVALUE(cursor) do { \
if (!F_ISSET(cursor, WT_CURSTD_VALUE_SET)) \
- WT_ERR(__wt_cursor_kv_not_set(cursor, 0)); \
+ WT_ERR(__wt_cursor_kv_not_set(cursor, false)); \
} while (0)
#define WT_CURSOR_NEEDKEY(cursor) do { \
if (F_ISSET(cursor, WT_CURSTD_KEY_INT)) { \
diff --git a/src/third_party/wiredtiger/src/include/cursor.i b/src/third_party/wiredtiger/src/include/cursor.i
index 97739c83b8f..63ffa3c7e84 100644
--- a/src/third_party/wiredtiger/src/include/cursor.i
+++ b/src/third_party/wiredtiger/src/include/cursor.i
@@ -178,7 +178,7 @@ __wt_cursor_dhandle_decr_use(WT_SESSION_IMPL *session)
* Cursor call setup.
*/
static inline int
-__cursor_func_init(WT_CURSOR_BTREE *cbt, int reenter)
+__cursor_func_init(WT_CURSOR_BTREE *cbt, bool reenter)
{
WT_SESSION_IMPL *session;
@@ -295,8 +295,8 @@ __cursor_row_slot_return(WT_CURSOR_BTREE *cbt, WT_ROW *rip, WT_UPDATE *upd)
* Call __wt_row_leaf_key_work instead of __wt_row_leaf_key: we
* already did __wt_row_leaf_key's fast-path checks inline.
*/
-slow: WT_RET(
- __wt_row_leaf_key_work(session, page, rip, &cbt->tmp, 0));
+slow: WT_RET(__wt_row_leaf_key_work(
+ session, page, rip, &cbt->tmp, false));
}
kb->data = cbt->tmp.data;
kb->size = cbt->tmp.size;
diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h
index 447a74d2d67..4b341a6adaa 100644
--- a/src/third_party/wiredtiger/src/include/extern.h
+++ b/src/third_party/wiredtiger/src/include/extern.h
@@ -11,21 +11,21 @@ extern int __wt_async_op_init(WT_SESSION_IMPL *session);
extern WT_THREAD_RET __wt_async_worker(void *arg);
extern int __wt_block_addr_to_buffer(WT_BLOCK *block, uint8_t **pp, wt_off_t offset, uint32_t size, uint32_t cksum);
extern int __wt_block_buffer_to_addr(WT_BLOCK *block, const uint8_t *p, wt_off_t *offsetp, uint32_t *sizep, uint32_t *cksump);
-extern int __wt_block_addr_valid(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size, int live);
+extern int __wt_block_addr_valid(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size, bool live);
extern int __wt_block_addr_string(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, const uint8_t *addr, size_t addr_size);
extern int __wt_block_buffer_to_ckpt(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *p, WT_BLOCK_CKPT *ci);
extern int __wt_block_ckpt_to_buffer(WT_SESSION_IMPL *session, WT_BLOCK *block, uint8_t **pp, WT_BLOCK_CKPT *ci);
extern int __wt_block_ckpt_init( WT_SESSION_IMPL *session, WT_BLOCK_CKPT *ci, const char *name);
-extern int __wt_block_checkpoint_load(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size, uint8_t *root_addr, size_t *root_addr_sizep, int checkpoint);
-extern int __wt_block_checkpoint_unload( WT_SESSION_IMPL *session, WT_BLOCK *block, int checkpoint);
+extern int __wt_block_checkpoint_load(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size, uint8_t *root_addr, size_t *root_addr_sizep, bool checkpoint);
+extern int __wt_block_checkpoint_unload( WT_SESSION_IMPL *session, WT_BLOCK *block, bool checkpoint);
extern void __wt_block_ckpt_destroy(WT_SESSION_IMPL *session, WT_BLOCK_CKPT *ci);
-extern int __wt_block_checkpoint(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, WT_CKPT *ckptbase, int data_cksum);
+extern int __wt_block_checkpoint(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, WT_CKPT *ckptbase, bool data_cksum);
extern int __wt_block_checkpoint_resolve(WT_SESSION_IMPL *session, WT_BLOCK *block);
extern int __wt_block_compact_start(WT_SESSION_IMPL *session, WT_BLOCK *block);
extern int __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block);
-extern int __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, int *skipp);
-extern int __wt_block_compact_page_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size, int *skipp);
-extern int __wt_block_misplaced(WT_SESSION_IMPL *session, WT_BLOCK *block, const char *tag, wt_off_t offset, uint32_t size, int live);
+extern int __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp);
+extern int __wt_block_compact_page_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size, bool *skipp);
+extern int __wt_block_misplaced(WT_SESSION_IMPL *session, WT_BLOCK *block, const char *tag, wt_off_t offset, uint32_t size, bool live);
extern int __wt_block_off_remove_overlap(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST *el, wt_off_t off, wt_off_t size);
extern int __wt_block_alloc( WT_SESSION_IMPL *session, WT_BLOCK *block, wt_off_t *offp, wt_off_t size);
extern int __wt_block_free(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size);
@@ -38,15 +38,15 @@ extern int __wt_block_extlist_read_avail(WT_SESSION_IMPL *session, WT_BLOCK *blo
extern int __wt_block_extlist_read(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST *el, wt_off_t ckpt_size);
extern int __wt_block_extlist_write(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST *el, WT_EXTLIST *additional);
extern int __wt_block_extlist_truncate( WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST *el);
-extern int __wt_block_extlist_init(WT_SESSION_IMPL *session, WT_EXTLIST *el, const char *name, const char *extname, int track_size);
+extern int __wt_block_extlist_init(WT_SESSION_IMPL *session, WT_EXTLIST *el, const char *name, const char *extname, bool track_size);
extern void __wt_block_extlist_free(WT_SESSION_IMPL *session, WT_EXTLIST *el);
extern int __wt_block_map( WT_SESSION_IMPL *session, WT_BLOCK *block, void *mapp, size_t *maplenp, void **mappingcookie);
extern int __wt_block_unmap( WT_SESSION_IMPL *session, WT_BLOCK *block, void *map, size_t maplen, void **mappingcookie);
-extern int __wt_block_manager_open(WT_SESSION_IMPL *session, const char *filename, const char *cfg[], int forced_salvage, int readonly, uint32_t allocsize, WT_BM **bmp);
+extern int __wt_block_manager_open(WT_SESSION_IMPL *session, const char *filename, const char *cfg[], bool forced_salvage, bool readonly, uint32_t allocsize, WT_BM **bmp);
extern int __wt_block_manager_truncate( WT_SESSION_IMPL *session, const char *filename, uint32_t allocsize);
extern int __wt_block_manager_create( WT_SESSION_IMPL *session, const char *filename, uint32_t allocsize);
-extern void __wt_block_configure_first_fit(WT_BLOCK *block, int on);
-extern int __wt_block_open(WT_SESSION_IMPL *session, const char *filename, const char *cfg[], int forced_salvage, int readonly, uint32_t allocsize, WT_BLOCK **blockp);
+extern void __wt_block_configure_first_fit(WT_BLOCK *block, bool on);
+extern int __wt_block_open(WT_SESSION_IMPL *session, const char *filename, const char *cfg[], bool forced_salvage, bool readonly, uint32_t allocsize, WT_BLOCK **blockp);
extern int __wt_block_close(WT_SESSION_IMPL *session, WT_BLOCK *block);
extern int __wt_desc_init(WT_SESSION_IMPL *session, WT_FH *fh, uint32_t allocsize);
extern void __wt_block_stat(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_DSRC_STATS *stats);
@@ -63,9 +63,9 @@ extern int __wt_block_ext_prealloc(WT_SESSION_IMPL *session, u_int max);
extern int __wt_block_ext_discard(WT_SESSION_IMPL *session, u_int max);
extern int __wt_block_salvage_start(WT_SESSION_IMPL *session, WT_BLOCK *block);
extern int __wt_block_salvage_end(WT_SESSION_IMPL *session, WT_BLOCK *block);
-extern int __wt_block_offset_invalid(WT_BLOCK *block, wt_off_t offset, uint32_t size);
-extern int __wt_block_salvage_next(WT_SESSION_IMPL *session, WT_BLOCK *block, uint8_t *addr, size_t *addr_sizep, int *eofp);
-extern int __wt_block_salvage_valid(WT_SESSION_IMPL *session, WT_BLOCK *block, uint8_t *addr, size_t addr_size, int valid);
+extern bool __wt_block_offset_invalid(WT_BLOCK *block, wt_off_t offset, uint32_t size);
+extern int __wt_block_salvage_next(WT_SESSION_IMPL *session, WT_BLOCK *block, uint8_t *addr, size_t *addr_sizep, bool *eofp);
+extern int __wt_block_salvage_valid(WT_SESSION_IMPL *session, WT_BLOCK *block, uint8_t *addr, size_t addr_size, bool valid);
extern int __wt_block_verify_start(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase, const char *cfg[]);
extern int __wt_block_verify_end(WT_SESSION_IMPL *session, WT_BLOCK *block);
extern int __wt_verify_ckpt_load( WT_SESSION_IMPL *session, WT_BLOCK *block, WT_BLOCK_CKPT *ci);
@@ -74,8 +74,8 @@ extern int __wt_block_verify_addr(WT_SESSION_IMPL *session, WT_BLOCK *block, con
extern u_int __wt_block_header(WT_BLOCK *block);
extern int __wt_block_truncate(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t len);
extern int __wt_block_write_size(WT_SESSION_IMPL *session, WT_BLOCK *block, size_t *sizep);
-extern int __wt_block_write(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, uint8_t *addr, size_t *addr_sizep, int data_cksum);
-extern int __wt_block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, wt_off_t *offsetp, uint32_t *sizep, uint32_t *cksump, int data_cksum, int caller_locked);
+extern int __wt_block_write(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, uint8_t *addr, size_t *addr_sizep, bool data_cksum);
+extern int __wt_block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, wt_off_t *offsetp, uint32_t *sizep, uint32_t *cksump, bool data_cksum, bool caller_locked);
extern int __wt_bloom_create( WT_SESSION_IMPL *session, const char *uri, const char *config, uint64_t count, uint32_t factor, uint32_t k, WT_BLOOM **bloomp);
extern int __wt_bloom_open(WT_SESSION_IMPL *session, const char *uri, uint32_t factor, uint32_t k, WT_CURSOR *owner, WT_BLOOM **bloomp);
extern int __wt_bloom_insert(WT_BLOOM *bloom, WT_ITEM *key);
@@ -86,10 +86,10 @@ extern int __wt_bloom_get(WT_BLOOM *bloom, WT_ITEM *key);
extern int __wt_bloom_close(WT_BLOOM *bloom);
extern int __wt_bloom_drop(WT_BLOOM *bloom, const char *config);
extern int __wt_compact(WT_SESSION_IMPL *session, const char *cfg[]);
-extern int __wt_compact_page_skip(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp);
-extern void __wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt, int next);
-extern int __wt_btcur_next(WT_CURSOR_BTREE *cbt, int truncating);
-extern int __wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating);
+extern int __wt_compact_page_skip(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp);
+extern void __wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt);
+extern int __wt_btcur_next(WT_CURSOR_BTREE *cbt, bool truncating);
+extern int __wt_btcur_prev(WT_CURSOR_BTREE *cbt, bool truncating);
extern int __wt_btcur_reset(WT_CURSOR_BTREE *cbt);
extern int __wt_btcur_search(WT_CURSOR_BTREE *cbt);
extern int __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp);
@@ -99,7 +99,7 @@ extern int __wt_btcur_remove(WT_CURSOR_BTREE *cbt);
extern int __wt_btcur_update(WT_CURSOR_BTREE *cbt);
extern int __wt_btcur_next_random(WT_CURSOR_BTREE *cbt);
extern int __wt_btcur_compare(WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *cmpp);
-extern int __wt_btcur_equals( WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp);
+extern int __wt_btcur_equals(WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp);
extern int __wt_btcur_range_truncate(WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop);
extern int __wt_btcur_close(WT_CURSOR_BTREE *cbt);
extern int __wt_debug_set_verbose(WT_SESSION_IMPL *session, const char *v);
@@ -112,25 +112,25 @@ extern int __wt_debug_tree_shape( WT_SESSION_IMPL *session, WT_PAGE *page, const
extern int __wt_debug_tree_all(WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile);
extern int __wt_debug_tree(WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile);
extern int __wt_debug_page(WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile);
-extern int __wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp);
+extern int __wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp);
extern void __wt_delete_page_rollback(WT_SESSION_IMPL *session, WT_REF *ref);
-extern int __wt_delete_page_skip(WT_SESSION_IMPL *session, WT_REF *ref);
+extern bool __wt_delete_page_skip(WT_SESSION_IMPL *session, WT_REF *ref);
extern int __wt_delete_page_instantiate(WT_SESSION_IMPL *session, WT_REF *ref);
extern void __wt_ref_out(WT_SESSION_IMPL *session, WT_REF *ref);
extern void __wt_page_out(WT_SESSION_IMPL *session, WT_PAGE **pagep);
-extern void __wt_free_ref( WT_SESSION_IMPL *session, WT_PAGE *page, WT_REF *ref, int free_pages);
-extern void __wt_free_ref_index(WT_SESSION_IMPL *session, WT_PAGE *page, WT_PAGE_INDEX *pindex, int free_pages);
+extern void __wt_free_ref( WT_SESSION_IMPL *session, WT_PAGE *page, WT_REF *ref, bool free_pages);
+extern void __wt_free_ref_index(WT_SESSION_IMPL *session, WT_PAGE *page, WT_PAGE_INDEX *pindex, bool free_pages);
extern int __wt_btree_open(WT_SESSION_IMPL *session, const char *op_cfg[]);
extern int __wt_btree_close(WT_SESSION_IMPL *session);
-extern void __wt_root_ref_init(WT_REF *root_ref, WT_PAGE *root, int is_recno);
+extern void __wt_root_ref_init(WT_REF *root_ref, WT_PAGE *root, bool is_recno);
extern int __wt_btree_tree_open( WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size);
extern int __wt_btree_new_leaf_page(WT_SESSION_IMPL *session, WT_PAGE **pagep);
-extern void __wt_btree_evictable(WT_SESSION_IMPL *session, int on);
+extern void __wt_btree_evictable(WT_SESSION_IMPL *session, bool on);
extern int __wt_huffman_confchk(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v);
extern int __wt_btree_huffman_open(WT_SESSION_IMPL *session);
extern void __wt_btree_huffman_close(WT_SESSION_IMPL *session);
extern int __wt_bt_read(WT_SESSION_IMPL *session, WT_ITEM *buf, const uint8_t *addr, size_t addr_size);
-extern int __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf, uint8_t *addr, size_t *addr_sizep, int checkpoint, int compressed);
+extern int __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf, uint8_t *addr, size_t *addr_sizep, bool checkpoint, bool compressed);
extern const char *__wt_page_type_string(u_int type);
extern const char *__wt_cell_type_string(uint8_t type);
extern const char *__wt_page_addr_string(WT_SESSION_IMPL *session, WT_REF *ref, WT_ITEM *buf);
@@ -144,7 +144,7 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags
, const char *file, int line
#endif
);
-extern int __wt_page_alloc(WT_SESSION_IMPL *session, uint8_t type, uint64_t recno, uint32_t alloc_entries, int alloc_refs, WT_PAGE **pagep);
+extern int __wt_page_alloc(WT_SESSION_IMPL *session, uint8_t type, uint64_t recno, uint32_t alloc_entries, bool alloc_refs, WT_PAGE **pagep);
extern int __wt_page_inmem(WT_SESSION_IMPL *session, WT_REF *ref, const void *image, size_t memsize, uint32_t flags, WT_PAGE **pagep);
extern int __wt_cache_read(WT_SESSION_IMPL *session, WT_REF *ref);
extern int __wt_kv_return(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_UPDATE *upd);
@@ -152,32 +152,32 @@ extern int __wt_bt_salvage(WT_SESSION_IMPL *session, WT_CKPT *ckptbase, const ch
extern void __wt_split_stash_discard(WT_SESSION_IMPL *session);
extern void __wt_split_stash_discard_all( WT_SESSION_IMPL *session_safe, WT_SESSION_IMPL *session);
extern int __wt_multi_to_ref(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi, WT_REF **refp, size_t *incrp);
-extern int __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref, int *splitp);
+extern int __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref);
extern int __wt_split_rewrite(WT_SESSION_IMPL *session, WT_REF *ref);
-extern int __wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive);
+extern int __wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, int closing);
extern int __wt_btree_stat_init(WT_SESSION_IMPL *session, WT_CURSOR_STAT *cst);
extern int __wt_cache_op(WT_SESSION_IMPL *session, WT_CKPT *ckptbase, int op);
extern int __wt_upgrade(WT_SESSION_IMPL *session, const char *cfg[]);
extern int __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]);
-extern int __wt_verify_dsk_image(WT_SESSION_IMPL *session, const char *addr, const WT_PAGE_HEADER *dsk, size_t size, int empty_page_ok);
+extern int __wt_verify_dsk_image(WT_SESSION_IMPL *session, const char *addr, const WT_PAGE_HEADER *dsk, size_t size, bool empty_page_ok);
extern int __wt_verify_dsk(WT_SESSION_IMPL *session, const char *addr, WT_ITEM *buf);
extern int __wt_tree_walk(WT_SESSION_IMPL *session, WT_REF **refp, uint64_t *walkcntp, uint32_t flags);
-extern int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, uint64_t recno, WT_ITEM *value, WT_UPDATE *upd, int is_remove);
+extern int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, uint64_t recno, WT_ITEM *value, WT_UPDATE *upd, bool is_remove);
extern int __wt_col_search(WT_SESSION_IMPL *session, uint64_t recno, WT_REF *leaf, WT_CURSOR_BTREE *cbt);
extern int __wt_row_leaf_keys(WT_SESSION_IMPL *session, WT_PAGE *page);
extern int __wt_row_leaf_key_copy( WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip, WT_ITEM *key);
-extern int __wt_row_leaf_key_work(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip_arg, WT_ITEM *keyb, int instantiate);
+extern int __wt_row_leaf_key_work(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip_arg, WT_ITEM *keyb, bool instantiate);
extern int __wt_row_ikey_alloc(WT_SESSION_IMPL *session, uint32_t cell_offset, const void *key, size_t size, WT_IKEY **ikeyp);
extern int __wt_row_ikey_incr(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t cell_offset, const void *key, size_t size, WT_REF *ref);
extern int __wt_row_ikey(WT_SESSION_IMPL *session, uint32_t cell_offset, const void *key, size_t size, WT_REF *ref);
extern int __wt_page_modify_alloc(WT_SESSION_IMPL *session, WT_PAGE *page);
-extern int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ITEM *key, WT_ITEM *value, WT_UPDATE *upd_arg, int is_remove);
+extern int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ITEM *key, WT_ITEM *value, WT_UPDATE *upd_arg, bool is_remove);
extern int __wt_row_insert_alloc(WT_SESSION_IMPL *session, WT_ITEM *key, u_int skipdepth, WT_INSERT **insp, size_t *ins_sizep);
extern int __wt_update_alloc( WT_SESSION_IMPL *session, WT_ITEM *value, WT_UPDATE **updp, size_t *sizep);
extern WT_UPDATE *__wt_update_obsolete_check( WT_SESSION_IMPL *session, WT_PAGE *page, WT_UPDATE *upd);
extern void __wt_update_obsolete_free( WT_SESSION_IMPL *session, WT_PAGE *page, WT_UPDATE *upd);
extern int __wt_search_insert( WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ITEM *srch_key);
-extern int __wt_row_search(WT_SESSION_IMPL *session, WT_ITEM *srch_key, WT_REF *leaf, WT_CURSOR_BTREE *cbt, int insert);
+extern int __wt_row_search(WT_SESSION_IMPL *session, WT_ITEM *srch_key, WT_REF *leaf, WT_CURSOR_BTREE *cbt, bool insert);
extern int __wt_row_random(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt);
extern int __wt_config_initn( WT_SESSION_IMPL *session, WT_CONFIG *conf, const char *str, size_t len);
extern int __wt_config_init(WT_SESSION_IMPL *session, WT_CONFIG *conf, const char *str);
@@ -215,7 +215,7 @@ extern int __wt_extractor_confchk(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *cnam
extern int __wt_extractor_config(WT_SESSION_IMPL *session, const char *config, WT_EXTRACTOR **extractorp, int *ownp);
extern int __wt_conn_remove_extractor(WT_SESSION_IMPL *session);
extern int __wt_verbose_config(WT_SESSION_IMPL *session, const char *cfg[]);
-extern int __wt_cache_config(WT_SESSION_IMPL *session, int reconfigure, const char *cfg[]);
+extern int __wt_cache_config(WT_SESSION_IMPL *session, bool reconfigure, const char *cfg[]);
extern int __wt_cache_create(WT_SESSION_IMPL *session, const char *cfg[]);
extern void __wt_cache_stats_update(WT_SESSION_IMPL *session);
extern int __wt_cache_destroy(WT_SESSION_IMPL *session);
@@ -227,13 +227,13 @@ extern int __wt_checkpoint_server_create(WT_SESSION_IMPL *session, const char *c
extern int __wt_checkpoint_server_destroy(WT_SESSION_IMPL *session);
extern int __wt_checkpoint_signal(WT_SESSION_IMPL *session, wt_off_t logsize);
extern int __wt_conn_dhandle_find(WT_SESSION_IMPL *session, const char *name, const char *ckpt, uint32_t flags);
-extern int __wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, int final, int force);
+extern int __wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, bool final, bool force);
extern int __wt_conn_btree_get(WT_SESSION_IMPL *session, const char *name, const char *ckpt, const char *cfg[], uint32_t flags);
-extern int __wt_conn_btree_apply(WT_SESSION_IMPL *session, int apply_checkpoints, const char *uri, int (*func)(WT_SESSION_IMPL *, const char *[]), const char *cfg[]);
+extern int __wt_conn_btree_apply(WT_SESSION_IMPL *session, bool apply_checkpoints, const char *uri, int (*func)(WT_SESSION_IMPL *, const char *[]), const char *cfg[]);
extern int __wt_conn_btree_apply_single_ckpt(WT_SESSION_IMPL *session, const char *uri, int (*func)(WT_SESSION_IMPL *, const char *[]), const char *cfg[]);
extern int __wt_conn_btree_apply_single(WT_SESSION_IMPL *session, const char *uri, const char *checkpoint, int (*func)(WT_SESSION_IMPL *, const char *[]), const char *cfg[]);
-extern int __wt_conn_dhandle_close_all( WT_SESSION_IMPL *session, const char *name, int force);
-extern int __wt_conn_dhandle_discard_single(WT_SESSION_IMPL *session, int final, int force);
+extern int __wt_conn_dhandle_close_all( WT_SESSION_IMPL *session, const char *uri, bool force);
+extern int __wt_conn_dhandle_discard_single( WT_SESSION_IMPL *session, bool final, bool force);
extern int __wt_conn_dhandle_discard(WT_SESSION_IMPL *session);
extern int __wt_connection_init(WT_CONNECTION_IMPL *conn);
extern int __wt_connection_destroy(WT_CONNECTION_IMPL *conn);
@@ -247,28 +247,28 @@ extern int __wt_connection_workers(WT_SESSION_IMPL *session, const char *cfg[]);
extern void __wt_conn_stat_init(WT_SESSION_IMPL *session);
extern int __wt_statlog_log_one(WT_SESSION_IMPL *session);
extern int __wt_statlog_create(WT_SESSION_IMPL *session, const char *cfg[]);
-extern int __wt_statlog_destroy(WT_SESSION_IMPL *session, int is_close);
+extern int __wt_statlog_destroy(WT_SESSION_IMPL *session, bool is_close);
extern int __wt_sweep_config(WT_SESSION_IMPL *session, const char *cfg[]);
extern int __wt_sweep_create(WT_SESSION_IMPL *session);
extern int __wt_sweep_destroy(WT_SESSION_IMPL *session);
extern int __wt_curbackup_open(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], WT_CURSOR **cursorp);
extern int __wt_backup_file_remove(WT_SESSION_IMPL *session);
-extern int __wt_backup_list_uri_append( WT_SESSION_IMPL *session, const char *name, int *skip);
-extern int __wt_curbulk_init(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk, int bitmap, int skip_sort_check);
+extern int __wt_backup_list_uri_append( WT_SESSION_IMPL *session, const char *name, bool *skip);
+extern int __wt_curbulk_init(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk, bool bitmap, bool skip_sort_check);
extern int __wt_curconfig_open(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], WT_CURSOR **cursorp);
extern int __wt_curds_open( WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_DATA_SOURCE *dsrc, WT_CURSOR **cursorp);
extern int __wt_curdump_create(WT_CURSOR *child, WT_CURSOR *owner, WT_CURSOR **cursorp);
extern int __wt_curfile_update_check(WT_CURSOR *cursor);
-extern int __wt_curfile_create(WT_SESSION_IMPL *session, WT_CURSOR *owner, const char *cfg[], int bulk, int bitmap, WT_CURSOR **cursorp);
+extern int __wt_curfile_create(WT_SESSION_IMPL *session, WT_CURSOR *owner, const char *cfg[], bool bulk, bool bitmap, WT_CURSOR **cursorp);
extern int __wt_curfile_open(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_CURSOR **cursorp);
extern int __wt_curindex_open(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_CURSOR **cursorp);
-extern int __wt_json_alloc_unpack(WT_SESSION_IMPL *session, const void *buffer, size_t size, const char *fmt, WT_CURSOR_JSON *json, int iskey, va_list ap);
+extern int __wt_json_alloc_unpack(WT_SESSION_IMPL *session, const void *buffer, size_t size, const char *fmt, WT_CURSOR_JSON *json, bool iskey, va_list ap);
extern void __wt_json_close(WT_SESSION_IMPL *session, WT_CURSOR *cursor);
-extern size_t __wt_json_unpack_char(char ch, u_char *buf, size_t bufsz, int force_unicode);
+extern size_t __wt_json_unpack_char(char ch, u_char *buf, size_t bufsz, bool force_unicode);
extern int __wt_json_column_init(WT_CURSOR *cursor, const char *keyformat, const WT_CONFIG_ITEM *idxconf, const WT_CONFIG_ITEM *colconf);
extern int __wt_json_token(WT_SESSION *wt_session, const char *src, int *toktype, const char **tokstart, size_t *toklen);
extern const char *__wt_json_tokname(int toktype);
-extern int __wt_json_to_item(WT_SESSION_IMPL *session, const char *jstr, const char *format, WT_CURSOR_JSON *json, int iskey, WT_ITEM *item);
+extern int __wt_json_to_item(WT_SESSION_IMPL *session, const char *jstr, const char *format, WT_CURSOR_JSON *json, bool iskey, WT_ITEM *item);
extern ssize_t __wt_json_strlen(const char *src, size_t srclen);
extern int __wt_json_strncpy(char **pdst, size_t dstlen, const char *src, size_t srclen);
extern int __wt_curlog_open(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], WT_CURSOR **cursorp);
@@ -279,7 +279,7 @@ extern int __wt_curstat_open(WT_SESSION_IMPL *session, const char *uri, const ch
extern int __wt_cursor_notsup(WT_CURSOR *cursor);
extern int __wt_cursor_noop(WT_CURSOR *cursor);
extern void __wt_cursor_set_notsup(WT_CURSOR *cursor);
-extern int __wt_cursor_kv_not_set(WT_CURSOR *cursor, int key);
+extern int __wt_cursor_kv_not_set(WT_CURSOR *cursor, bool key);
extern int __wt_cursor_get_key(WT_CURSOR *cursor, ...);
extern void __wt_cursor_set_key(WT_CURSOR *cursor, ...);
extern int __wt_cursor_get_raw_key(WT_CURSOR *cursor, WT_ITEM *key);
@@ -309,25 +309,25 @@ extern int __wt_evict_server_wake(WT_SESSION_IMPL *session);
extern int __wt_evict_create(WT_SESSION_IMPL *session);
extern int __wt_evict_destroy(WT_SESSION_IMPL *session);
extern int __wt_evict_page(WT_SESSION_IMPL *session, WT_REF *ref);
-extern int __wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, int *evict_resetp);
+extern int __wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, bool *evict_resetp);
extern void __wt_evict_file_exclusive_off(WT_SESSION_IMPL *session);
-extern int __wt_evict_lru_page(WT_SESSION_IMPL *session, int is_server);
+extern int __wt_evict_lru_page(WT_SESSION_IMPL *session, bool is_server);
extern int __wt_cache_wait(WT_SESSION_IMPL *session, int full);
extern void __wt_cache_dump(WT_SESSION_IMPL *session);
-extern int __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive);
+extern int __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, bool closing);
extern void __wt_evict_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref);
extern int __wt_log_ckpt(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn);
extern int __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn);
-extern int __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, int *rec);
+extern int __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, bool *recp);
extern void __wt_log_written_reset(WT_SESSION_IMPL *session);
-extern int __wt_log_get_all_files(WT_SESSION_IMPL *session, char ***filesp, u_int *countp, uint32_t *maxid, int active_only);
+extern int __wt_log_get_all_files(WT_SESSION_IMPL *session, char ***filesp, u_int *countp, uint32_t *maxid, bool active_only);
extern void __wt_log_files_free(WT_SESSION_IMPL *session, char **files, u_int count);
extern int __wt_log_extract_lognum( WT_SESSION_IMPL *session, const char *name, uint32_t *id);
-extern int __wt_log_allocfile( WT_SESSION_IMPL *session, uint32_t lognum, const char *dest, int prealloc);
+extern int __wt_log_allocfile( WT_SESSION_IMPL *session, uint32_t lognum, const char *dest, bool prealloc);
extern int __wt_log_remove(WT_SESSION_IMPL *session, const char *file_prefix, uint32_t lognum);
extern int __wt_log_open(WT_SESSION_IMPL *session);
extern int __wt_log_close(WT_SESSION_IMPL *session);
-extern int __wt_log_newfile(WT_SESSION_IMPL *session, int conn_create, int *created);
+extern int __wt_log_newfile(WT_SESSION_IMPL *session, bool conn_create, int *created);
extern int __wt_log_read(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, uint32_t flags);
extern int __wt_log_scan(WT_SESSION_IMPL *session, WT_LSN *lsnp, uint32_t flags, int (*func)(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, WT_LSN *next_lsnp, void *cookie, int firstrecord), void *cookie);
extern int __wt_log_write(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, uint32_t flags);
@@ -389,10 +389,10 @@ extern int __wt_lsm_tree_chunk_name(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_t
extern int __wt_lsm_tree_set_chunk_size( WT_SESSION_IMPL *session, WT_LSM_CHUNK *chunk);
extern int __wt_lsm_tree_setup_chunk( WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, WT_LSM_CHUNK *chunk);
extern int __wt_lsm_tree_setup_bloom( WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, WT_LSM_CHUNK *chunk);
-extern int __wt_lsm_tree_create(WT_SESSION_IMPL *session, const char *uri, int exclusive, const char *config);
-extern int __wt_lsm_tree_get(WT_SESSION_IMPL *session, const char *uri, int exclusive, WT_LSM_TREE **treep);
+extern int __wt_lsm_tree_create(WT_SESSION_IMPL *session, const char *uri, bool exclusive, const char *config);
+extern int __wt_lsm_tree_get(WT_SESSION_IMPL *session, const char *uri, bool exclusive, WT_LSM_TREE **treep);
extern void __wt_lsm_tree_release(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
-extern void __wt_lsm_tree_throttle( WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, int decrease_only);
+extern void __wt_lsm_tree_throttle( WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool decrease_only);
extern int __wt_lsm_tree_switch(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
extern int __wt_lsm_tree_retire_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int start_chunk, u_int nchunks);
extern int __wt_lsm_tree_drop( WT_SESSION_IMPL *session, const char *name, const char *cfg[]);
@@ -402,10 +402,10 @@ extern int __wt_lsm_tree_readlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tre
extern int __wt_lsm_tree_readunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
extern int __wt_lsm_tree_writelock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
extern int __wt_lsm_tree_writeunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
-extern int __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip);
-extern int __wt_lsm_tree_worker(WT_SESSION_IMPL *session, const char *uri, int (*file_func)(WT_SESSION_IMPL *, const char *[]), int (*name_func)(WT_SESSION_IMPL *, const char *, int *), const char *cfg[], uint32_t open_flags);
-extern int __wt_lsm_get_chunk_to_flush(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, int force, WT_LSM_CHUNK **chunkp);
-extern int __wt_lsm_work_switch( WT_SESSION_IMPL *session, WT_LSM_WORK_UNIT **entryp, int *ran);
+extern int __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, bool *skipp);
+extern int __wt_lsm_tree_worker(WT_SESSION_IMPL *session, const char *uri, int (*file_func)(WT_SESSION_IMPL *, const char *[]), int (*name_func)(WT_SESSION_IMPL *, const char *, bool *), const char *cfg[], uint32_t open_flags);
+extern int __wt_lsm_get_chunk_to_flush(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool force, WT_LSM_CHUNK **chunkp);
+extern int __wt_lsm_work_switch( WT_SESSION_IMPL *session, WT_LSM_WORK_UNIT **entryp, bool *ran);
extern int __wt_lsm_work_bloom(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
extern int __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, WT_LSM_CHUNK *chunk);
extern int __wt_lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
@@ -433,7 +433,7 @@ extern int __wt_metadata_search( WT_SESSION_IMPL *session, const char *key, char
extern void __wt_meta_track_discard(WT_SESSION_IMPL *session);
extern int __wt_meta_track_on(WT_SESSION_IMPL *session);
extern int __wt_meta_track_find_handle( WT_SESSION_IMPL *session, const char *name, const char *checkpoint);
-extern int __wt_meta_track_off(WT_SESSION_IMPL *session, int need_sync, int unroll);
+extern int __wt_meta_track_off(WT_SESSION_IMPL *session, bool need_sync, bool unroll);
extern int __wt_meta_track_sub_on(WT_SESSION_IMPL *session);
extern int __wt_meta_track_sub_off(WT_SESSION_IMPL *session);
extern int __wt_meta_track_checkpoint(WT_SESSION_IMPL *session);
@@ -441,7 +441,7 @@ extern int __wt_meta_track_insert(WT_SESSION_IMPL *session, const char *key);
extern int __wt_meta_track_update(WT_SESSION_IMPL *session, const char *key);
extern int __wt_meta_track_fileop( WT_SESSION_IMPL *session, const char *olduri, const char *newuri);
extern int __wt_meta_track_drop( WT_SESSION_IMPL *session, const char *filename);
-extern int __wt_meta_track_handle_lock(WT_SESSION_IMPL *session, int created);
+extern int __wt_meta_track_handle_lock(WT_SESSION_IMPL *session, bool created);
extern int __wt_turtle_init(WT_SESSION_IMPL *session);
extern int __wt_turtle_read(WT_SESSION_IMPL *session, const char *key, char **valuep);
extern int __wt_turtle_update( WT_SESSION_IMPL *session, const char *key, const char *value);
@@ -454,16 +454,16 @@ extern int __wt_strdup(WT_SESSION_IMPL *session, const char *str, void *retp);
extern void __wt_free_int(WT_SESSION_IMPL *session, const void *p_arg);
extern int __wt_dirlist(WT_SESSION_IMPL *session, const char *dir, const char *prefix, uint32_t flags, char ***dirlist, u_int *countp);
extern int __wt_dlopen(WT_SESSION_IMPL *session, const char *path, WT_DLH **dlhp);
-extern int __wt_dlsym(WT_SESSION_IMPL *session, WT_DLH *dlh, const char *name, int fail, void *sym_ret);
+extern int __wt_dlsym(WT_SESSION_IMPL *session, WT_DLH *dlh, const char *name, bool fail, void *sym_ret);
extern int __wt_dlclose(WT_SESSION_IMPL *session, WT_DLH *dlh);
extern int __wt_errno(void);
extern const char *__wt_strerror(WT_SESSION_IMPL *session, int error, char *errbuf, size_t errlen);
-extern int __wt_exist(WT_SESSION_IMPL *session, const char *filename, int *existp);
+extern int __wt_exist(WT_SESSION_IMPL *session, const char *filename, bool *existp);
extern void __wt_fallocate_config(WT_SESSION_IMPL *session, WT_FH *fh);
extern int __wt_fallocate( WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset, wt_off_t len);
extern int __wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t *sizep);
extern int __wt_filesize_name( WT_SESSION_IMPL *session, const char *filename, wt_off_t *sizep);
-extern int __wt_bytelock(WT_FH *fhp, wt_off_t byte, int lock);
+extern int __wt_bytelock(WT_FH *fhp, wt_off_t byte, bool lock);
extern int __wt_directory_sync_fh(WT_SESSION_IMPL *session, WT_FH *fh);
extern int __wt_directory_sync(WT_SESSION_IMPL *session, char *path);
extern int __wt_fsync(WT_SESSION_IMPL *session, WT_FH *fh);
@@ -476,7 +476,7 @@ extern int __wt_mmap(WT_SESSION_IMPL *session, WT_FH *fh, void *mapp, size_t *le
extern int __wt_mmap_preload(WT_SESSION_IMPL *session, const void *p, size_t size);
extern int __wt_mmap_discard(WT_SESSION_IMPL *session, void *p, size_t size);
extern int __wt_munmap(WT_SESSION_IMPL *session, WT_FH *fh, void *map, size_t len, void **mappingcookie);
-extern int __wt_cond_alloc(WT_SESSION_IMPL *session, const char *name, int is_signalled, WT_CONDVAR **condp);
+extern int __wt_cond_alloc(WT_SESSION_IMPL *session, const char *name, bool is_signalled, WT_CONDVAR **condp);
extern int __wt_cond_wait(WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs);
extern int __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond);
extern int __wt_cond_destroy(WT_SESSION_IMPL *session, WT_CONDVAR **condp);
@@ -489,11 +489,11 @@ extern int __wt_writelock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock);
extern int __wt_writeunlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock);
extern int __wt_rwlock_destroy(WT_SESSION_IMPL *session, WT_RWLOCK **rwlockp);
extern int __wt_once(void (*init_routine)(void));
-extern int __wt_open(WT_SESSION_IMPL *session, const char *name, int ok_create, int exclusive, int dio_type, WT_FH **fhp);
+extern int __wt_open(WT_SESSION_IMPL *session, const char *name, bool ok_create, bool exclusive, int dio_type, WT_FH **fhp);
extern int __wt_close(WT_SESSION_IMPL *session, WT_FH **fhp);
-extern int __wt_absolute_path(const char *path);
+extern bool __wt_absolute_path(const char *path);
extern const char *__wt_path_separator(void);
-extern int __wt_has_priv(void);
+extern bool __wt_has_priv(void);
extern int __wt_remove(WT_SESSION_IMPL *session, const char *name);
extern int __wt_rename(WT_SESSION_IMPL *session, const char *from, const char *to);
extern int __wt_read( WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset, size_t len, void *buf);
@@ -514,7 +514,7 @@ extern void __wt_yield(void);
extern int __wt_ext_struct_pack(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, void *buffer, size_t size, const char *fmt, ...);
extern int __wt_ext_struct_size(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, size_t *sizep, const char *fmt, ...);
extern int __wt_ext_struct_unpack(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const void *buffer, size_t size, const char *fmt, ...);
-extern int __wt_struct_check(WT_SESSION_IMPL *session, const char *fmt, size_t len, int *fixedp, uint32_t *fixed_lenp);
+extern int __wt_struct_check(WT_SESSION_IMPL *session, const char *fmt, size_t len, bool *fixedp, uint32_t *fixed_lenp);
extern int __wt_struct_confchk(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v);
extern int __wt_struct_size(WT_SESSION_IMPL *session, size_t *sizep, const char *fmt, ...);
extern int __wt_struct_pack(WT_SESSION_IMPL *session, void *buffer, size_t size, const char *fmt, ...);
@@ -541,7 +541,7 @@ extern int __wt_schema_colgroup_source(WT_SESSION_IMPL *session, WT_TABLE *table
extern int __wt_schema_index_source(WT_SESSION_IMPL *session, WT_TABLE *table, const char *idxname, const char *config, WT_ITEM *buf);
extern int __wt_schema_create( WT_SESSION_IMPL *session, const char *uri, const char *config);
extern int __wt_schema_drop(WT_SESSION_IMPL *session, const char *uri, const char *cfg[]);
-extern int __wt_schema_get_table(WT_SESSION_IMPL *session, const char *name, size_t namelen, int ok_incomplete, WT_TABLE **tablep);
+extern int __wt_schema_get_table(WT_SESSION_IMPL *session, const char *name, size_t namelen, bool ok_incomplete, WT_TABLE **tablep);
extern void __wt_schema_release_table(WT_SESSION_IMPL *session, WT_TABLE *table);
extern void __wt_schema_destroy_colgroup(WT_SESSION_IMPL *session, WT_COLGROUP *colgroup);
extern int __wt_schema_destroy_index(WT_SESSION_IMPL *session, WT_INDEX *idx);
@@ -552,17 +552,17 @@ extern int __wt_schema_colgroup_name(WT_SESSION_IMPL *session, WT_TABLE *table,
extern int __wt_schema_open_colgroups(WT_SESSION_IMPL *session, WT_TABLE *table);
extern int __wt_schema_open_index(WT_SESSION_IMPL *session, WT_TABLE *table, const char *idxname, size_t len, WT_INDEX **indexp);
extern int __wt_schema_open_indices(WT_SESSION_IMPL *session, WT_TABLE *table);
-extern int __wt_schema_open_table(WT_SESSION_IMPL *session, const char *name, size_t namelen, int ok_incomplete, WT_TABLE **tablep);
-extern int __wt_schema_get_colgroup(WT_SESSION_IMPL *session, const char *uri, int quiet, WT_TABLE **tablep, WT_COLGROUP **colgroupp);
-extern int __wt_schema_get_index(WT_SESSION_IMPL *session, const char *uri, int quiet, WT_TABLE **tablep, WT_INDEX **indexp);
+extern int __wt_schema_open_table(WT_SESSION_IMPL *session, const char *name, size_t namelen, bool ok_incomplete, WT_TABLE **tablep);
+extern int __wt_schema_get_colgroup(WT_SESSION_IMPL *session, const char *uri, bool quiet, WT_TABLE **tablep, WT_COLGROUP **colgroupp);
+extern int __wt_schema_get_index(WT_SESSION_IMPL *session, const char *uri, bool quiet, WT_TABLE **tablep, WT_INDEX **indexp);
extern int __wt_schema_colcheck(WT_SESSION_IMPL *session, const char *key_format, const char *value_format, WT_CONFIG_ITEM *colconf, u_int *kcolsp, u_int *vcolsp);
extern int __wt_table_check(WT_SESSION_IMPL *session, WT_TABLE *table);
-extern int __wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table, const char *columns, size_t len, int value_only, WT_ITEM *plan);
-extern int __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table, const char *columns, size_t len, const char *extra_cols, int value_only, WT_ITEM *format);
+extern int __wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table, const char *columns, size_t len, bool value_only, WT_ITEM *plan);
+extern int __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table, const char *columns, size_t len, const char *extra_cols, bool value_only, WT_ITEM *format);
extern int __wt_struct_truncate(WT_SESSION_IMPL *session, const char *input_fmt, u_int ncols, WT_ITEM *format);
extern int __wt_schema_project_in(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, va_list ap);
extern int __wt_schema_project_out(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, va_list ap);
-extern int __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, int key_only, const char *vformat, WT_ITEM *value);
+extern int __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, bool key_only, const char *vformat, WT_ITEM *value);
extern int __wt_schema_project_merge(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, const char *vformat, WT_ITEM *value);
extern int __wt_schema_rename(WT_SESSION_IMPL *session, const char *uri, const char *newuri, const char *cfg[]);
extern int __wt_curstat_colgroup_init(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], WT_CURSOR_STAT *cst);
@@ -574,16 +574,16 @@ extern int __wt_schema_range_truncate( WT_SESSION_IMPL *session, WT_CURSOR *star
extern WT_DATA_SOURCE *__wt_schema_get_source(WT_SESSION_IMPL *session, const char *name);
extern int __wt_str_name_check(WT_SESSION_IMPL *session, const char *str);
extern int __wt_name_check(WT_SESSION_IMPL *session, const char *str, size_t len);
-extern int __wt_schema_worker(WT_SESSION_IMPL *session, const char *uri, int (*file_func)(WT_SESSION_IMPL *, const char *[]), int (*name_func)(WT_SESSION_IMPL *, const char *, int *), const char *cfg[], uint32_t open_flags);
+extern int __wt_schema_worker(WT_SESSION_IMPL *session, const char *uri, int (*file_func)(WT_SESSION_IMPL *, const char *[]), int (*name_func)(WT_SESSION_IMPL *, const char *, bool *), const char *cfg[], uint32_t open_flags);
extern int __wt_session_reset_cursors(WT_SESSION_IMPL *session);
extern int __wt_session_copy_values(WT_SESSION_IMPL *session);
extern int __wt_open_cursor(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_CURSOR **cursorp);
extern int __wt_session_create_strip(WT_SESSION *wt_session, const char *v1, const char *v2, char **value_ret);
-extern int __wt_open_internal_session(WT_CONNECTION_IMPL *conn, const char *name, int uses_dhandles, int open_metadata, WT_SESSION_IMPL **sessionp);
+extern int __wt_open_internal_session(WT_CONNECTION_IMPL *conn, const char *name, bool uses_dhandles, bool open_metadata, WT_SESSION_IMPL **sessionp);
extern int __wt_open_session(WT_CONNECTION_IMPL *conn, WT_EVENT_HANDLER *event_handler, const char *config, WT_SESSION_IMPL **sessionp);
-extern int __wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, int *skip);
+extern int __wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, bool *skipp);
extern int __wt_session_compact( WT_SESSION *wt_session, const char *uri, const char *config);
-extern int __wt_session_lock_dhandle(WT_SESSION_IMPL *session, uint32_t flags, int *deadp);
+extern int __wt_session_lock_dhandle( WT_SESSION_IMPL *session, uint32_t flags, bool *is_deadp);
extern int __wt_session_release_btree(WT_SESSION_IMPL *session);
extern int __wt_session_get_btree_ckpt(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], uint32_t flags);
extern void __wt_session_close_cache(WT_SESSION_IMPL *session);
@@ -593,7 +593,7 @@ extern int __wt_salvage(WT_SESSION_IMPL *session, const char *cfg[]);
extern uint32_t __wt_cksum(const void *chunk, size_t len);
extern void __wt_cksum_init(void);
extern void __wt_event_handler_set(WT_SESSION_IMPL *session, WT_EVENT_HANDLER *handler);
-extern int __wt_eventv(WT_SESSION_IMPL *session, int msg_event, int error, const char *file_name, int line_number, const char *fmt, va_list ap);
+extern int __wt_eventv(WT_SESSION_IMPL *session, bool msg_event, int error, const char *file_name, int line_number, const char *fmt, va_list ap);
extern void __wt_err(WT_SESSION_IMPL *session, int error, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4)));
extern void __wt_errx(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 2, 3)));
extern int __wt_ext_err_printf( WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4)));
@@ -617,7 +617,7 @@ extern void __wt_attach(WT_SESSION_IMPL *session);
extern uint64_t __wt_hash_city64(const void *s, size_t len);
extern uint64_t __wt_hash_fnv64(const void *string, size_t len);
extern int
-__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp
+__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, bool *busyp
#ifdef HAVE_DIAGNOSTIC
, const char *file, int line
#endif
@@ -642,7 +642,7 @@ extern int __wt_statlog_dump_spinlock(WT_CONNECTION_IMPL *conn, const char *tag)
extern uint32_t __wt_nlpo2_round(uint32_t v);
extern uint32_t __wt_nlpo2(uint32_t v);
extern uint32_t __wt_log2_int(uint32_t n);
-extern int __wt_ispo2(uint32_t v);
+extern bool __wt_ispo2(uint32_t v);
extern uint32_t __wt_rduppo2(uint32_t n, uint32_t po2);
extern void __wt_random_init(WT_RAND_STATE volatile *rnd_state);
extern uint32_t __wt_random(WT_RAND_STATE volatile *rnd_state);
@@ -666,7 +666,7 @@ extern void __wt_stat_refresh_connection_stats(void *stats_arg);
extern int WT_CDECL __wt_txnid_cmp(const void *v1, const void *v2);
extern void __wt_txn_release_snapshot(WT_SESSION_IMPL *session);
extern void __wt_txn_get_snapshot(WT_SESSION_IMPL *session);
-extern void __wt_txn_update_oldest(WT_SESSION_IMPL *session, int force);
+extern void __wt_txn_update_oldest(WT_SESSION_IMPL *session, bool force);
extern int __wt_txn_config(WT_SESSION_IMPL *session, const char *cfg[]);
extern void __wt_txn_release(WT_SESSION_IMPL *session);
extern int __wt_txn_commit(WT_SESSION_IMPL *session, const char *cfg[]);
@@ -681,7 +681,7 @@ extern int __wt_checkpoint_list(WT_SESSION_IMPL *session, const char *cfg[]);
extern int __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[]);
extern int __wt_checkpoint(WT_SESSION_IMPL *session, const char *cfg[]);
extern int __wt_checkpoint_sync(WT_SESSION_IMPL *session, const char *cfg[]);
-extern int __wt_checkpoint_close(WT_SESSION_IMPL *session, int final);
+extern int __wt_checkpoint_close(WT_SESSION_IMPL *session, bool final);
extern uint64_t __wt_ext_transaction_id(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session);
extern int __wt_ext_transaction_isolation_level( WT_EXTENSION_API *wt_api, WT_SESSION *wt_session);
extern int __wt_ext_transaction_notify( WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, WT_TXN_NOTIFY *notify);
@@ -691,7 +691,7 @@ extern void __wt_txn_op_free(WT_SESSION_IMPL *session, WT_TXN_OP *op);
extern int __wt_txn_log_op(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt);
extern int __wt_txn_log_commit(WT_SESSION_IMPL *session, const char *cfg[]);
extern int __wt_txn_checkpoint_logread( WT_SESSION_IMPL *session, const uint8_t **pp, const uint8_t *end, WT_LSN *ckpt_lsn);
-extern int __wt_txn_checkpoint_log( WT_SESSION_IMPL *session, int full, uint32_t flags, WT_LSN *lsnp);
+extern int __wt_txn_checkpoint_log( WT_SESSION_IMPL *session, bool full, uint32_t flags, WT_LSN *lsnp);
extern int __wt_txn_truncate_log( WT_SESSION_IMPL *session, WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop);
extern int __wt_txn_truncate_end(WT_SESSION_IMPL *session);
extern int __wt_txn_printlog(WT_SESSION *wt_session, FILE *out);
diff --git a/src/third_party/wiredtiger/src/include/flags.h b/src/third_party/wiredtiger/src/include/flags.h
index 1d7173743e5..71fc54f9eac 100644
--- a/src/third_party/wiredtiger/src/include/flags.h
+++ b/src/third_party/wiredtiger/src/include/flags.h
@@ -42,18 +42,18 @@
#define WT_SESSION_CAN_WAIT 0x00000001
#define WT_SESSION_CLEAR_EVICT_WALK 0x00000002
#define WT_SESSION_DISCARD_FORCE 0x00000004
-#define WT_SESSION_HANDLE_LIST_LOCKED 0x00000008
-#define WT_SESSION_INTERNAL 0x00000010
-#define WT_SESSION_LOGGING_INMEM 0x00000020
-#define WT_SESSION_NO_CACHE 0x00000040
-#define WT_SESSION_NO_CACHE_CHECK 0x00000080
-#define WT_SESSION_NO_DATA_HANDLES 0x00000100
-#define WT_SESSION_NO_LOGGING 0x00000200
-#define WT_SESSION_NO_SCHEMA_LOCK 0x00000400
-#define WT_SESSION_SALVAGE_CORRUPT_OK 0x00000800
-#define WT_SESSION_SCHEMA_LOCKED 0x00001000
-#define WT_SESSION_SERVER_ASYNC 0x00002000
-#define WT_SESSION_TABLE_LOCKED 0x00004000
+#define WT_SESSION_INTERNAL 0x00000008
+#define WT_SESSION_LOCKED_HANDLE_LIST 0x00000010
+#define WT_SESSION_LOCKED_SCHEMA 0x00000020
+#define WT_SESSION_LOCKED_TABLE 0x00000040
+#define WT_SESSION_LOGGING_INMEM 0x00000080
+#define WT_SESSION_NO_CACHE 0x00000100
+#define WT_SESSION_NO_CACHE_CHECK 0x00000200
+#define WT_SESSION_NO_DATA_HANDLES 0x00000400
+#define WT_SESSION_NO_LOGGING 0x00000800
+#define WT_SESSION_NO_SCHEMA_LOCK 0x00001000
+#define WT_SESSION_SALVAGE_CORRUPT_OK 0x00002000
+#define WT_SESSION_SERVER_ASYNC 0x00004000
#define WT_SKIP_UPDATE_ERR 0x00000002
#define WT_SKIP_UPDATE_RESTORE 0x00000004
#define WT_SYNC_CHECKPOINT 0x00000001
diff --git a/src/third_party/wiredtiger/src/include/gcc.h b/src/third_party/wiredtiger/src/include/gcc.h
index 831dcd735d5..238c54fed9e 100644
--- a/src/third_party/wiredtiger/src/include/gcc.h
+++ b/src/third_party/wiredtiger/src/include/gcc.h
@@ -123,7 +123,7 @@ __wt_atomic_sub##name(type *vp, type v) \
{ \
return (__sync_sub_and_fetch(vp, v)); \
} \
-static inline int \
+static inline bool \
__wt_atomic_cas##name(type *vp, type old, type new) \
{ \
return (WT_ATOMIC_CAS(vp, old, new)); \
@@ -145,7 +145,7 @@ WT_ATOMIC_FUNC(size, size_t, size_t)
* __wt_atomic_cas_ptr --
* Pointer compare and swap.
*/
-static inline int
+static inline bool
__wt_atomic_cas_ptr(void *vp, void *old, void *new)
{
return (WT_ATOMIC_CAS((void **)vp, old, new));
diff --git a/src/third_party/wiredtiger/src/include/lint.h b/src/third_party/wiredtiger/src/include/lint.h
index eba4a1c3b3f..f288fb98683 100644
--- a/src/third_party/wiredtiger/src/include/lint.h
+++ b/src/third_party/wiredtiger/src/include/lint.h
@@ -49,14 +49,14 @@ __wt_atomic_sub##name(type *vp, type v) \
*vp -= v; \
return (*vp); \
} \
-static inline int \
+static inline bool \
__wt_atomic_cas##name(type *vp, type old, type new) \
{ \
if (*vp == old) { \
*vp = new; \
- return (1); \
+ return (true); \
} \
- return (0); \
+ return (false); \
}
WT_ATOMIC_FUNC(8, uint8_t, uint8_t)
@@ -75,13 +75,13 @@ WT_ATOMIC_FUNC(size, size_t, size_t)
* __wt_atomic_cas_ptr --
* Pointer compare and swap.
*/
-static inline int
+static inline bool
__wt_atomic_cas_ptr(void *vp, void *old, void *new) {
if (*(void **)vp == old) {
*(void **)vp = new;
- return (1);
+ return (true);
}
- return (0);
+ return (false);
}
static inline void WT_BARRIER(void) { return; }
diff --git a/src/third_party/wiredtiger/src/include/misc.h b/src/third_party/wiredtiger/src/include/misc.h
index ba12f00f672..e2b46d0dbdc 100644
--- a/src/third_party/wiredtiger/src/include/misc.h
+++ b/src/third_party/wiredtiger/src/include/misc.h
@@ -114,17 +114,21 @@
* hex constant might be a negative integer), and to ensure the hex constant is
* the correct size before applying the bitwise not operator.
*/
-#define F_CLR(p, mask) ((p)->flags &= ~((uint32_t)(mask)))
-#define F_ISSET(p, mask) ((p)->flags & ((uint32_t)(mask)))
-#define F_SET(p, mask) ((p)->flags |= ((uint32_t)(mask)))
-
-#define LF_CLR(mask) ((flags) &= ~((uint32_t)(mask)))
-#define LF_ISSET(mask) ((flags) & ((uint32_t)(mask)))
-#define LF_SET(mask) ((flags) |= ((uint32_t)(mask)))
-
-#define FLD_CLR(field, mask) ((field) &= ~((uint32_t)(mask)))
-#define FLD_ISSET(field, mask) ((field) & ((uint32_t)(mask)))
-#define FLD_SET(field, mask) ((field) |= ((uint32_t)(mask)))
+#define FLD_CLR(field, mask) ((field) &= ~((uint32_t)(mask)))
+#define FLD_MASK(field, mask) ((field) & (uint32_t)(mask))
+#define FLD_ISSET(field, mask) (FLD_MASK(field, mask) != 0)
+#define FLD64_ISSET(field, mask) (((field) & (uint64_t)(mask)) != 0)
+#define FLD_SET(field, mask) ((field) |= ((uint32_t)(mask)))
+
+#define F_CLR(p, mask) FLD_CLR((p)->flags, mask)
+#define F_ISSET(p, mask) FLD_ISSET((p)->flags, mask)
+#define F_MASK(p, mask) FLD_MASK((p)->flags, mask)
+#define F_SET(p, mask) FLD_SET((p)->flags, mask)
+
+#define LF_CLR(mask) FLD_CLR(flags, mask)
+#define LF_ISSET(mask) FLD_ISSET(flags, mask)
+#define LF_MASK(mask) FLD_MASK(flags, mask)
+#define LF_SET(mask) FLD_SET(flags, mask)
/* Verbose messages. */
#ifdef HAVE_VERBOSE
diff --git a/src/third_party/wiredtiger/src/include/misc.i b/src/third_party/wiredtiger/src/include/misc.i
index 53f08b3cbeb..8ffabcfc7eb 100644
--- a/src/third_party/wiredtiger/src/include/misc.i
+++ b/src/third_party/wiredtiger/src/include/misc.i
@@ -20,7 +20,7 @@ __wt_verbose(WT_SESSION_IMPL *session, int flag, const char *fmt, ...)
if (WT_VERBOSE_ISSET(session, flag)) {
va_start(ap, fmt);
- ret = __wt_eventv(session, 1, 0, NULL, 0, fmt, ap);
+ ret = __wt_eventv(session, true, 0, NULL, 0, fmt, ap);
va_end(ap);
}
return (ret);
diff --git a/src/third_party/wiredtiger/src/include/msvc.h b/src/third_party/wiredtiger/src/include/msvc.h
index f4d8ba52fc1..8f5aa9abde8 100644
--- a/src/third_party/wiredtiger/src/include/msvc.h
+++ b/src/third_party/wiredtiger/src/include/msvc.h
@@ -52,7 +52,7 @@ __wt_atomic_sub##name(type *vp, type v) \
{ \
return (_InterlockedExchangeAdd ## s((t *)(vp), - (t)v) - (v)); \
} \
-static inline int \
+static inline bool \
__wt_atomic_cas##name(type *vp, type old, type new) \
{ \
return (_InterlockedCompareExchange ## s \
@@ -75,7 +75,7 @@ WT_ATOMIC_FUNC(size, size_t, size_t, 64, __int64)
* __wt_atomic_cas_ptr --
* Pointer compare and swap.
*/
-static inline int
+static inline bool
__wt_atomic_cas_ptr(void *vp, void *old, void *new)
{
return (_InterlockedCompareExchange64(
diff --git a/src/third_party/wiredtiger/src/include/os.h b/src/third_party/wiredtiger/src/include/os.h
index 518b124f547..4ba588111b8 100644
--- a/src/third_party/wiredtiger/src/include/os.h
+++ b/src/third_party/wiredtiger/src/include/os.h
@@ -93,7 +93,7 @@ struct __wt_fh {
wt_off_t extend_size; /* File extended size */
wt_off_t extend_len; /* File extend chunk size */
- int direct_io; /* O_DIRECT configured */
+ bool direct_io; /* O_DIRECT configured */
enum { /* file extend configuration */
WT_FALLOCATE_AVAILABLE,
@@ -101,5 +101,5 @@ struct __wt_fh {
WT_FALLOCATE_POSIX,
WT_FALLOCATE_STD,
WT_FALLOCATE_SYS } fallocate_available;
- int fallocate_requires_locking;
+ bool fallocate_requires_locking;
};
diff --git a/src/third_party/wiredtiger/src/include/packing.i b/src/third_party/wiredtiger/src/include/packing.i
index b97b3a322ce..3b60a1269f8 100644
--- a/src/third_party/wiredtiger/src/include/packing.i
+++ b/src/third_party/wiredtiger/src/include/packing.i
@@ -42,7 +42,7 @@ typedef struct {
WT_CONFIG config;
char buf[20];
int count;
- int iskey;
+ bool iskey;
int genname;
} WT_PACK_NAME;
@@ -82,7 +82,7 @@ __pack_init(WT_SESSION_IMPL *session, WT_PACK *pack, const char *fmt)
*/
static inline int
__pack_name_init(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *names,
- int iskey, WT_PACK_NAME *pn)
+ bool iskey, WT_PACK_NAME *pn)
{
WT_CLEAR(*pn);
pn->iskey = iskey;
diff --git a/src/third_party/wiredtiger/src/include/schema.h b/src/third_party/wiredtiger/src/include/schema.h
index 50d8e37800b..f957e734faa 100644
--- a/src/third_party/wiredtiger/src/include/schema.h
+++ b/src/third_party/wiredtiger/src/include/schema.h
@@ -65,7 +65,7 @@ struct __wt_table {
TAILQ_ENTRY(__wt_table) q;
TAILQ_ENTRY(__wt_table) hashq;
- int cg_complete, idx_complete, is_simple;
+ bool cg_complete, idx_complete, is_simple;
u_int ncolgroups, nindices, nkey_columns;
uint32_t refcnt; /* Number of open cursors */
@@ -95,12 +95,12 @@ struct __wt_table {
} while (0)
/*
- * WT_WITH_DHANDLE_LOCK --
+ * WT_WITH_HANDLE_LIST_LOCK --
* Acquire the data handle list lock, perform an operation, drop the lock.
*/
-#define WT_WITH_DHANDLE_LOCK(session, op) \
+#define WT_WITH_HANDLE_LIST_LOCK(session, op) \
WT_WITH_LOCK(session, \
- &S2C(session)->dhandle_lock, WT_SESSION_HANDLE_LIST_LOCKED, op)
+ &S2C(session)->dhandle_lock, WT_SESSION_LOCKED_HANDLE_LIST, op)
/*
* WT_WITH_SCHEMA_LOCK --
* Acquire the schema lock, perform an operation, drop the lock.
@@ -109,11 +109,11 @@ struct __wt_table {
*/
#define WT_WITH_SCHEMA_LOCK(session, op) do { \
WT_ASSERT(session, \
- F_ISSET(session, WT_SESSION_SCHEMA_LOCKED) || \
- !F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED | \
- WT_SESSION_NO_SCHEMA_LOCK | WT_SESSION_TABLE_LOCKED)); \
+ F_ISSET(session, WT_SESSION_LOCKED_SCHEMA) || \
+ !F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST | \
+ WT_SESSION_NO_SCHEMA_LOCK | WT_SESSION_LOCKED_TABLE)); \
WT_WITH_LOCK(session, \
- &S2C(session)->schema_lock, WT_SESSION_SCHEMA_LOCKED, op); \
+ &S2C(session)->schema_lock, WT_SESSION_LOCKED_SCHEMA, op); \
} while (0)
/*
@@ -121,39 +121,39 @@ struct __wt_table {
* Drop the schema lock and/or the handle list lock, perform an operation,
* re-acquire the lock(s).
*/
-#define WT_WITHOUT_LOCKS(session, op) do { \
- WT_CONNECTION_IMPL *__conn = S2C(session); \
- int __handle_locked = \
- F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED);\
- int __table_locked = \
- F_ISSET(session, WT_SESSION_TABLE_LOCKED); \
- int __schema_locked = \
- F_ISSET(session, WT_SESSION_SCHEMA_LOCKED); \
- if (__handle_locked) { \
- F_CLR(session, WT_SESSION_HANDLE_LIST_LOCKED); \
- __wt_spin_unlock(session, &__conn->dhandle_lock);\
- } \
- if (__table_locked) { \
- F_CLR(session, WT_SESSION_TABLE_LOCKED); \
- __wt_spin_unlock(session, &__conn->table_lock);\
- } \
- if (__schema_locked) { \
- F_CLR(session, WT_SESSION_SCHEMA_LOCKED); \
- __wt_spin_unlock(session, &__conn->schema_lock);\
- } \
- op; \
- if (__schema_locked) { \
- __wt_spin_lock(session, &__conn->schema_lock); \
- F_SET(session, WT_SESSION_SCHEMA_LOCKED); \
- } \
- if (__table_locked) { \
- __wt_spin_lock(session, &__conn->table_lock); \
- F_SET(session, WT_SESSION_TABLE_LOCKED); \
- } \
- if (__handle_locked) { \
- __wt_spin_lock(session, &__conn->dhandle_lock); \
- F_SET(session, WT_SESSION_HANDLE_LIST_LOCKED); \
- } \
+#define WT_WITHOUT_LOCKS(session, op) do { \
+ WT_CONNECTION_IMPL *__conn = S2C(session); \
+ bool __handle_locked = \
+ F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST); \
+ bool __table_locked = \
+ F_ISSET(session, WT_SESSION_LOCKED_TABLE); \
+ bool __schema_locked = \
+ F_ISSET(session, WT_SESSION_LOCKED_SCHEMA); \
+ if (__handle_locked) { \
+ F_CLR(session, WT_SESSION_LOCKED_HANDLE_LIST); \
+ __wt_spin_unlock(session, &__conn->dhandle_lock); \
+ } \
+ if (__table_locked) { \
+ F_CLR(session, WT_SESSION_LOCKED_TABLE); \
+ __wt_spin_unlock(session, &__conn->table_lock); \
+ } \
+ if (__schema_locked) { \
+ F_CLR(session, WT_SESSION_LOCKED_SCHEMA); \
+ __wt_spin_unlock(session, &__conn->schema_lock); \
+ } \
+ op; \
+ if (__schema_locked) { \
+ __wt_spin_lock(session, &__conn->schema_lock); \
+ F_SET(session, WT_SESSION_LOCKED_SCHEMA); \
+ } \
+ if (__table_locked) { \
+ __wt_spin_lock(session, &__conn->table_lock); \
+ F_SET(session, WT_SESSION_LOCKED_TABLE); \
+ } \
+ if (__handle_locked) { \
+ __wt_spin_lock(session, &__conn->dhandle_lock); \
+ F_SET(session, WT_SESSION_LOCKED_HANDLE_LIST); \
+ } \
} while (0)
/*
@@ -162,8 +162,8 @@ struct __wt_table {
*/
#define WT_WITH_TABLE_LOCK(session, op) do { \
WT_ASSERT(session, \
- F_ISSET(session, WT_SESSION_TABLE_LOCKED) || \
- !F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED)); \
+ F_ISSET(session, WT_SESSION_LOCKED_TABLE) || \
+ !F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST)); \
WT_WITH_LOCK(session, \
- &S2C(session)->table_lock, WT_SESSION_TABLE_LOCKED, op); \
+ &S2C(session)->table_lock, WT_SESSION_LOCKED_TABLE, op); \
} while (0)
diff --git a/src/third_party/wiredtiger/src/include/serial.i b/src/third_party/wiredtiger/src/include/serial.i
index 7b62e66eccb..f38e50cee6b 100644
--- a/src/third_party/wiredtiger/src/include/serial.i
+++ b/src/third_party/wiredtiger/src/include/serial.i
@@ -202,8 +202,8 @@ __wt_insert_serial(WT_SESSION_IMPL *session, WT_PAGE *page,
{
WT_INSERT *new_ins = *new_insp;
WT_DECL_RET;
- int simple;
u_int i;
+ bool simple;
/* Check for page write generation wrap. */
WT_RET(__page_write_gen_wrapped_check(page));
@@ -211,10 +211,10 @@ __wt_insert_serial(WT_SESSION_IMPL *session, WT_PAGE *page,
/* Clear references to memory we now own and must free on error. */
*new_insp = NULL;
- simple = 1;
+ simple = true;
for (i = 0; i < skipdepth; i++)
if (new_ins->next[i] == NULL)
- simple = 0;
+ simple = false;
if (simple)
ret = __insert_simple_func(
diff --git a/src/third_party/wiredtiger/src/include/session.h b/src/third_party/wiredtiger/src/include/session.h
index afcb0c94f5b..535ad07c50b 100644
--- a/src/third_party/wiredtiger/src/include/session.h
+++ b/src/third_party/wiredtiger/src/include/session.h
@@ -129,7 +129,7 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl {
void *reconcile; /* Reconciliation support */
int (*reconcile_cleanup)(WT_SESSION_IMPL *);
- int compaction; /* Compaction did some work */
+ bool compaction; /* Compaction did some work */
uint32_t flags;
diff --git a/src/third_party/wiredtiger/src/include/txn.h b/src/third_party/wiredtiger/src/include/txn.h
index 7a31ed2f3fe..0d5f337fff0 100644
--- a/src/third_party/wiredtiger/src/include/txn.h
+++ b/src/third_party/wiredtiger/src/include/txn.h
@@ -17,11 +17,11 @@
* transaction), WT_TXN_NONE is smaller than any possible ID (visible to all
* running transactions).
*/
-#define TXNID_LE(t1, t2) \
+#define WT_TXNID_LE(t1, t2) \
((t1) <= (t2))
-#define TXNID_LT(t1, t2) \
- ((t1) != (t2) && TXNID_LE(t1, t2))
+#define WT_TXNID_LT(t1, t2) \
+ ((t1) != (t2) && WT_TXNID_LE(t1, t2))
#define WT_SESSION_TXN_STATE(s) (&S2C(s)->txn_global.states[(s)->id])
@@ -139,14 +139,14 @@ struct __wt_txn {
/* Checkpoint status. */
WT_LSN ckpt_lsn;
- int full_ckpt;
+ bool full_ckpt;
uint32_t ckpt_nsnapshot;
WT_ITEM *ckpt_snapshot;
-#define TXN_AUTOCOMMIT 0x01
-#define TXN_ERROR 0x02
-#define TXN_HAS_ID 0x04
-#define TXN_HAS_SNAPSHOT 0x08
-#define TXN_RUNNING 0x10
+#define WT_TXN_AUTOCOMMIT 0x01
+#define WT_TXN_ERROR 0x02
+#define WT_TXN_HAS_ID 0x04
+#define WT_TXN_HAS_SNAPSHOT 0x08
+#define WT_TXN_RUNNING 0x10
uint32_t flags;
};
diff --git a/src/third_party/wiredtiger/src/include/txn.i b/src/third_party/wiredtiger/src/include/txn.i
index a262672630f..3152ff6bdd5 100644
--- a/src/third_party/wiredtiger/src/include/txn.i
+++ b/src/third_party/wiredtiger/src/include/txn.i
@@ -26,7 +26,7 @@ __txn_next_op(WT_SESSION_IMPL *session, WT_TXN_OP **opp)
* Make sure we have allocated a transaction ID.
*/
WT_RET(__wt_txn_id_check(session));
- WT_ASSERT(session, F_ISSET(txn, TXN_HAS_ID));
+ WT_ASSERT(session, F_ISSET(txn, WT_TXN_HAS_ID));
WT_RET(__wt_realloc_def(session, &txn->mod_alloc,
txn->mod_count + 1, &txn->mod));
@@ -49,7 +49,7 @@ __wt_txn_unmodify(WT_SESSION_IMPL *session)
WT_TXN *txn;
txn = &session->txn;
- if (F_ISSET(txn, TXN_HAS_ID)) {
+ if (F_ISSET(txn, WT_TXN_HAS_ID)) {
WT_ASSERT(session, txn->mod_count > 0);
txn->mod_count--;
}
@@ -123,7 +123,7 @@ __wt_txn_oldest_id(WT_SESSION_IMPL *session)
* then it's safe to ignore the checkpoint ID in the visibility check.
*/
if (checkpoint_pinned == WT_TXN_NONE ||
- TXNID_LT(oldest_id, checkpoint_pinned) ||
+ WT_TXNID_LT(oldest_id, checkpoint_pinned) ||
WT_SESSION_IS_CHECKPOINT(session) ||
(btree != NULL && btree->checkpoint_gen == checkpoint_gen))
return (oldest_id);
@@ -137,21 +137,21 @@ __wt_txn_oldest_id(WT_SESSION_IMPL *session)
* all sessions in the system will see the transaction ID including the
* ID that belongs to a running checkpoint.
*/
-static inline int
+static inline bool
__wt_txn_visible_all(WT_SESSION_IMPL *session, uint64_t id)
{
uint64_t oldest_id;
oldest_id = __wt_txn_oldest_id(session);
- return (TXNID_LT(id, oldest_id));
+ return (WT_TXNID_LT(id, oldest_id));
}
/*
* __wt_txn_visible --
* Can the current transaction see the given ID?
*/
-static inline int
+static inline bool
__wt_txn_visible(WT_SESSION_IMPL *session, uint64_t id)
{
WT_TXN *txn;
@@ -160,11 +160,11 @@ __wt_txn_visible(WT_SESSION_IMPL *session, uint64_t id)
/* Changes with no associated transaction are always visible. */
if (id == WT_TXN_NONE)
- return (1);
+ return (true);
/* Nobody sees the results of aborted transactions. */
if (id == WT_TXN_ABORTED)
- return (0);
+ return (false);
/*
* Eviction only sees globally visible updates, or if there is a
@@ -185,11 +185,11 @@ __wt_txn_visible(WT_SESSION_IMPL *session, uint64_t id)
*/
if (txn->isolation == WT_ISO_READ_UNCOMMITTED ||
session->dhandle == session->meta_dhandle)
- return (1);
+ return (true);
/* Transactions see their own changes. */
if (id == txn->id)
- return (1);
+ return (true);
/*
* WT_ISO_SNAPSHOT, WT_ISO_READ_COMMITTED: the ID is visible if it is
@@ -200,10 +200,10 @@ __wt_txn_visible(WT_SESSION_IMPL *session, uint64_t id)
* saw when taking the snapshot should be invisible, even if the
* snapshot is empty.
*/
- if (TXNID_LE(txn->snap_max, id))
- return (0);
- if (txn->snapshot_count == 0 || TXNID_LT(id, txn->snap_min))
- return (1);
+ if (WT_TXNID_LE(txn->snap_max, id))
+ return (false);
+ if (txn->snapshot_count == 0 || WT_TXNID_LT(id, txn->snap_min))
+ return (true);
return (bsearch(&id, txn->snapshot, txn->snapshot_count,
sizeof(uint64_t), __wt_txnid_cmp) == NULL);
@@ -225,7 +225,6 @@ __wt_txn_begin(WT_SESSION_IMPL *session, const char *cfg[])
if (cfg != NULL)
WT_RET(__wt_txn_config(session, cfg));
- F_SET(txn, TXN_RUNNING);
if (txn->isolation == WT_ISO_SNAPSHOT) {
if (session->ncursors > 0)
WT_RET(__wt_session_copy_values(session));
@@ -235,9 +234,12 @@ __wt_txn_begin(WT_SESSION_IMPL *session, const char *cfg[])
* eviction, it's better to do it beforehand.
*/
WT_RET(__wt_cache_full_check(session));
+
__wt_txn_get_snapshot(session);
}
- return (0);
+
+ F_SET(txn, WT_TXN_RUNNING);
+ return (false);
}
/*
@@ -263,8 +265,8 @@ __wt_txn_autocommit_check(WT_SESSION_IMPL *session)
WT_TXN *txn;
txn = &session->txn;
- if (F_ISSET(txn, TXN_AUTOCOMMIT)) {
- F_CLR(txn, TXN_AUTOCOMMIT);
+ if (F_ISSET(txn, WT_TXN_AUTOCOMMIT)) {
+ F_CLR(txn, WT_TXN_AUTOCOMMIT);
return (__wt_txn_begin(session, NULL));
}
return (0);
@@ -304,10 +306,10 @@ __wt_txn_idle_cache_check(WT_SESSION_IMPL *session)
/*
* Check the published snap_min because read-uncommitted never sets
- * TXN_HAS_SNAPSHOT.
+ * WT_TXN_HAS_SNAPSHOT.
*/
- if (F_ISSET(txn, TXN_RUNNING) &&
- !F_ISSET(txn, TXN_HAS_ID) && txn_state->snap_min == WT_TXN_NONE)
+ if (F_ISSET(txn, WT_TXN_RUNNING) &&
+ !F_ISSET(txn, WT_TXN_HAS_ID) && txn_state->snap_min == WT_TXN_NONE)
WT_RET(__wt_cache_full_check(session));
return (0);
@@ -328,12 +330,12 @@ __wt_txn_id_check(WT_SESSION_IMPL *session)
txn = &session->txn;
- WT_ASSERT(session, F_ISSET(txn, TXN_RUNNING));
+ WT_ASSERT(session, F_ISSET(txn, WT_TXN_RUNNING));
/* If the transaction is idle, check that the cache isn't full. */
WT_RET(__wt_txn_idle_cache_check(session));
- if (!F_ISSET(txn, TXN_HAS_ID)) {
+ if (!F_ISSET(txn, WT_TXN_HAS_ID)) {
conn = S2C(session);
txn_global = &conn->txn_global;
txn_state = WT_SESSION_TXN_STATE(session);
@@ -362,7 +364,7 @@ __wt_txn_id_check(WT_SESSION_IMPL *session)
txn_state->id = txn->id = txn_global->current;
} while (!__wt_atomic_casv64(
&txn_global->current, txn->id, txn->id + 1) ||
- TXNID_LT(txn->id, txn_global->last_running));
+ WT_TXNID_LT(txn->id, txn_global->last_running));
/*
* If we have used 64-bits of transaction IDs, there is nothing
@@ -370,7 +372,7 @@ __wt_txn_id_check(WT_SESSION_IMPL *session)
*/
if (txn->id == WT_TXN_ABORTED)
WT_RET_MSG(session, ENOMEM, "Out of transaction IDs");
- F_SET(txn, TXN_HAS_ID);
+ F_SET(txn, WT_TXN_HAS_ID);
}
return (0);
@@ -411,7 +413,7 @@ __wt_txn_read_last(WT_SESSION_IMPL *session)
txn = &session->txn;
/* Release the snap_min ID we put in the global table. */
- if (!F_ISSET(txn, TXN_RUNNING) ||
+ if (!F_ISSET(txn, WT_TXN_RUNNING) ||
txn->isolation != WT_ISO_SNAPSHOT)
__wt_txn_release_snapshot(session);
}
@@ -448,12 +450,12 @@ __wt_txn_cursor_op(WT_SESSION_IMPL *session)
* positioned on a value, it can't be freed.
*/
if (txn->isolation == WT_ISO_READ_UNCOMMITTED &&
- !F_ISSET(txn, TXN_HAS_ID) &&
- TXNID_LT(txn_state->snap_min, txn_global->last_running))
+ !F_ISSET(txn, WT_TXN_HAS_ID) &&
+ WT_TXNID_LT(txn_state->snap_min, txn_global->last_running))
txn_state->snap_min = txn_global->last_running;
if (txn->isolation != WT_ISO_READ_UNCOMMITTED &&
- !F_ISSET(txn, TXN_HAS_SNAPSHOT))
+ !F_ISSET(txn, WT_TXN_HAS_SNAPSHOT))
__wt_txn_get_snapshot(session);
}
@@ -461,7 +463,7 @@ __wt_txn_cursor_op(WT_SESSION_IMPL *session)
* __wt_txn_am_oldest --
* Am I the oldest transaction in the system?
*/
-static inline int
+static inline bool
__wt_txn_am_oldest(WT_SESSION_IMPL *session)
{
WT_CONNECTION_IMPL *conn;
@@ -476,12 +478,12 @@ __wt_txn_am_oldest(WT_SESSION_IMPL *session)
txn_global = &conn->txn_global;
if (txn->id == WT_TXN_NONE)
- return (0);
+ return (false);
WT_ORDERED_READ(session_cnt, conn->session_cnt);
for (i = 0, s = txn_global->states; i < session_cnt; i++, s++)
- if ((id = s->id) != WT_TXN_NONE && TXNID_LT(id, txn->id))
- return (0);
+ if ((id = s->id) != WT_TXN_NONE && WT_TXNID_LT(id, txn->id))
+ return (false);
- return (1);
+ return (true);
}
diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in
index 2667e02c5b6..e00e53e5af7 100644
--- a/src/third_party/wiredtiger/src/include/wiredtiger.in
+++ b/src/third_party/wiredtiger/src/include/wiredtiger.in
@@ -1216,7 +1216,12 @@ struct __wt_session {
* Flush the log.
*
* @param session the session handle
- * @configstart{WT_SESSION.log_flush, see dist/api_data.py}
+ * @configstart{session.log_flush, see dist/api_data.py}
+ * @config{sync, forcibly flush the log and wait for it to synchronize.
+ * If using \c off\, then wait for the log to be written to the file
+ * system. If using \c on\, wait for the log to be synchronized to the
+ * backing store., a string\, chosen from the following options: \c
+ * "off"\, \c "on"; default \c on.}
* @configend
* @errors
*/
diff --git a/src/third_party/wiredtiger/src/include/wt_internal.h b/src/third_party/wiredtiger/src/include/wt_internal.h
index fa25fc872f4..6e9f37737bf 100644
--- a/src/third_party/wiredtiger/src/include/wt_internal.h
+++ b/src/third_party/wiredtiger/src/include/wt_internal.h
@@ -41,9 +41,7 @@ extern "C" {
#else
#include <pthread.h>
#endif
-#ifdef HAVE_PTHREAD_NP_H
-#include <pthread_np.h>
-#endif
+#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
diff --git a/src/third_party/wiredtiger/src/log/log.c b/src/third_party/wiredtiger/src/log/log.c
index 567200ffa0b..6eb0d4323ab 100644
--- a/src/third_party/wiredtiger/src/log/log.c
+++ b/src/third_party/wiredtiger/src/log/log.c
@@ -99,7 +99,7 @@ err:
* must be run in the given variable.
*/
int
-__wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, int *rec)
+__wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, bool *recp)
{
WT_CONNECTION_IMPL *conn;
WT_CURSOR *c;
@@ -116,7 +116,7 @@ __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, int *rec)
* Default is to run recovery always (regardless of whether this
* connection has logging enabled).
*/
- *rec = 1;
+ *recp = true;
if (log == NULL)
return (0);
@@ -142,7 +142,7 @@ __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, int *rec)
* If we get to the end of the log, we can skip recovery.
*/
if (ret == WT_NOTFOUND) {
- *rec = 0;
+ *recp = false;
ret = 0;
}
} else if (ret == WT_NOTFOUND)
@@ -208,7 +208,7 @@ __log_get_files(WT_SESSION_IMPL *session,
*/
int
__wt_log_get_all_files(WT_SESSION_IMPL *session,
- char ***filesp, u_int *countp, uint32_t *maxid, int active_only)
+ char ***filesp, u_int *countp, uint32_t *maxid, bool active_only)
{
WT_DECL_RET;
WT_LOG *log;
@@ -361,7 +361,7 @@ __log_acquire(WT_SESSION_IMPL *session, uint64_t recsize, WT_LOGSLOT *slot)
*/
slot->slot_release_lsn = log->alloc_lsn;
if (!__log_size_fit(session, &log->alloc_lsn, recsize)) {
- WT_RET(__wt_log_newfile(session, 0, &created_log));
+ WT_RET(__wt_log_newfile(session, false, &created_log));
if (log->log_close_fh != NULL)
F_SET(slot, WT_SLOT_CLOSEFH);
}
@@ -448,7 +448,7 @@ __log_decompress(WT_SESSION_IMPL *session, WT_ITEM *in, WT_ITEM **out)
*/
static int
__log_fill(WT_SESSION_IMPL *session,
- WT_MYSLOT *myslot, int direct, WT_ITEM *record, WT_LSN *lsnp)
+ WT_MYSLOT *myslot, bool direct, WT_ITEM *record, WT_LSN *lsnp)
{
WT_DECL_RET;
WT_LOG_RECORD *logrec;
@@ -487,7 +487,7 @@ err:
*/
static int
__log_file_header(
- WT_SESSION_IMPL *session, WT_FH *fh, WT_LSN *end_lsn, int prealloc)
+ WT_SESSION_IMPL *session, WT_FH *fh, WT_LSN *end_lsn, bool prealloc)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_ITEM(buf);
@@ -539,7 +539,7 @@ __log_file_header(
log->prep_missed++;
WT_ERR(__log_acquire(session, logrec->len, &tmp));
}
- WT_ERR(__log_fill(session, &myslot, 1, buf, NULL));
+ WT_ERR(__log_fill(session, &myslot, true, buf, NULL));
/*
* Make sure the header gets to disk.
*/
@@ -557,7 +557,7 @@ err: __wt_scr_free(session, &buf);
*/
static int
__log_openfile(WT_SESSION_IMPL *session,
- int ok_create, WT_FH **fh, const char *file_prefix, uint32_t id)
+ bool ok_create, WT_FH **fh, const char *file_prefix, uint32_t id)
{
WT_DECL_ITEM(buf);
WT_DECL_RET;
@@ -576,7 +576,7 @@ __log_openfile(WT_SESSION_IMPL *session,
WT_ERR(__wt_verbose(session, WT_VERB_LOG,
"opening log %s", (const char *)buf->data));
WT_ERR(__wt_open(
- session, buf->data, ok_create, 0, WT_FILE_TYPE_LOG, fh));
+ session, buf->data, ok_create, false, WT_FILE_TYPE_LOG, fh));
/*
* XXX - if we are not creating the file, we should verify the
* log file header record for the magic number and versions here.
@@ -687,7 +687,7 @@ __log_truncate(WT_SESSION_IMPL *session,
/*
* Truncate the log file to the given LSN.
*/
- WT_ERR(__log_openfile(session, 0, &log_fh, file_prefix, lsn->file));
+ WT_ERR(__log_openfile(session, false, &log_fh, file_prefix, lsn->file));
WT_ERR(__wt_ftruncate(session, log_fh, lsn->offset));
WT_ERR(__wt_fsync(session, log_fh));
WT_ERR(__wt_close(session, &log_fh));
@@ -704,7 +704,7 @@ __log_truncate(WT_SESSION_IMPL *session,
WT_ERR(__wt_log_extract_lognum(session, logfiles[i], &lognum));
if (lognum > lsn->file && lognum < log->trunc_lsn.file) {
WT_ERR(__log_openfile(session,
- 0, &log_fh, file_prefix, lognum));
+ false, &log_fh, file_prefix, lognum));
/*
* If there are intervening files pre-allocated,
* truncate them to the end of the log file header.
@@ -728,7 +728,7 @@ err: WT_TRET(__wt_close(session, &log_fh));
*/
int
__wt_log_allocfile(
- WT_SESSION_IMPL *session, uint32_t lognum, const char *dest, int prealloc)
+ WT_SESSION_IMPL *session, uint32_t lognum, const char *dest, bool prealloc)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_ITEM(from_path);
@@ -754,8 +754,8 @@ __wt_log_allocfile(
/*
* Set up the temporary file.
*/
- WT_ERR(__log_openfile(session, 1, &log_fh, WT_LOG_TMPNAME, lognum));
- WT_ERR(__log_file_header(session, log_fh, NULL, 1));
+ WT_ERR(__log_openfile(session, true, &log_fh, WT_LOG_TMPNAME, lognum));
+ WT_ERR(__log_file_header(session, log_fh, NULL, true));
WT_ERR(__wt_ftruncate(session, log_fh, LOG_FIRST_RECORD));
if (prealloc)
WT_ERR(__log_prealloc(session, log_fh));
@@ -826,7 +826,7 @@ __wt_log_open(WT_SESSION_IMPL *session)
WT_RET(__wt_verbose(session, WT_VERB_LOG,
"log_open: open fh to directory %s", conn->log_path));
WT_RET(__wt_open(session, conn->log_path,
- 0, 0, WT_FILE_TYPE_DIRECTORY, &log->log_dir_fh));
+ false, false, WT_FILE_TYPE_DIRECTORY, &log->log_dir_fh));
}
/*
* Clean up any old interim pre-allocated files.
@@ -874,7 +874,7 @@ __wt_log_open(WT_SESSION_IMPL *session)
* Start logging at the beginning of the next log file, no matter
* where the previous log file ends.
*/
- WT_ERR(__wt_log_newfile(session, 1, NULL));
+ WT_ERR(__wt_log_newfile(session, true, NULL));
/* If we found log files, save the new state. */
if (logcount > 0) {
@@ -1016,20 +1016,23 @@ err:
* Release a log slot.
*/
static int
-__log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *freep)
+__log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
WT_LOG *log;
WT_LSN sync_lsn;
size_t write_size;
- int locked, yield_count;
+ int yield_count;
+ bool locked;
WT_DECL_SPINLOCK_ID(id); /* Must appear last */
conn = S2C(session);
log = conn->log;
- locked = yield_count = 0;
- *freep = 1;
+ yield_count = 0;
+ locked = false;
+ if (freep != NULL)
+ *freep = true;
/* Write the buffered records */
if (F_ISSET(slot, WT_SLOT_BUFFERED)) {
@@ -1048,7 +1051,8 @@ __log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *freep)
*/
if (F_ISSET(slot, WT_SLOT_BUFFERED) &&
!F_ISSET(slot, WT_SLOT_SYNC | WT_SLOT_SYNC_DIR)) {
- *freep = 0;
+ if (freep != NULL)
+ *freep = 0;
slot->slot_state = WT_LOG_SLOT_WRITTEN;
/*
* After this point the worker thread owns the slot. There
@@ -1097,7 +1101,7 @@ __log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *freep)
session, log->log_sync_cond, 10000));
continue;
}
- locked = 1;
+ locked = true;
/*
* Record the current end of our update after the lock.
@@ -1138,7 +1142,7 @@ __log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *freep)
* Clear the flags before leaving the loop.
*/
F_CLR(slot, WT_SLOT_SYNC | WT_SLOT_SYNC_DIR);
- locked = 0;
+ locked = false;
__wt_spin_unlock(session, &log->log_sync_lock);
break;
}
@@ -1155,7 +1159,7 @@ done:
* Create the next log file and write the file header record into it.
*/
int
-__wt_log_newfile(WT_SESSION_IMPL *session, int conn_create, int *created)
+__wt_log_newfile(WT_SESSION_IMPL *session, bool conn_create, int *created)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
@@ -1356,8 +1360,8 @@ __wt_log_scan(WT_SESSION_IMPL *session, WT_LSN *lsnp, uint32_t flags,
wt_off_t log_size;
uint32_t allocsize, cksum, firstlog, lastlog, lognum, rdup_len, reclen;
u_int i, logcount;
- int eol;
int firstrecord;
+ bool eol;
char **logfiles;
conn = S2C(session);
@@ -1365,8 +1369,8 @@ __wt_log_scan(WT_SESSION_IMPL *session, WT_LSN *lsnp, uint32_t flags,
log_fh = NULL;
logcount = 0;
logfiles = NULL;
+ eol = false;
firstrecord = 1;
- eol = 0;
WT_CLEAR(buf);
/*
@@ -1445,7 +1449,7 @@ __wt_log_scan(WT_SESSION_IMPL *session, WT_LSN *lsnp, uint32_t flags,
logfiles = NULL;
}
WT_ERR(__log_openfile(
- session, 0, &log_fh, WT_LOG_FILENAME, start_lsn.file));
+ session, false, &log_fh, WT_LOG_FILENAME, start_lsn.file));
WT_ERR(__log_filesize(session, log_fh, &log_size));
rd_lsn = start_lsn;
WT_ERR(__wt_buf_initsize(session, &buf, WT_LOG_ALIGN));
@@ -1457,7 +1461,7 @@ advance:
*/
WT_ERR(__wt_close(session, &log_fh));
log_fh = NULL;
- eol = 1;
+ eol = true;
/*
* Truncate this log file before we move to the next.
*/
@@ -1472,10 +1476,10 @@ advance:
*/
if (rd_lsn.file > end_lsn.file)
break;
- WT_ERR(__log_openfile(
- session, 0, &log_fh, WT_LOG_FILENAME, rd_lsn.file));
+ WT_ERR(__log_openfile(session,
+ false, &log_fh, WT_LOG_FILENAME, rd_lsn.file));
WT_ERR(__log_filesize(session, log_fh, &log_size));
- eol = 0;
+ eol = false;
continue;
}
/*
@@ -1500,7 +1504,7 @@ advance:
*/
if (reclen == 0) {
/* This LSN is the end. */
- eol = 1;
+ eol = true;
break;
}
rdup_len = __wt_rduppo2(reclen, allocsize);
@@ -1606,19 +1610,18 @@ __log_direct_write(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp,
WT_LOG *log;
WT_LOGSLOT tmp;
WT_MYSLOT myslot;
- int dummy, locked;
+ bool locked;
WT_DECL_SPINLOCK_ID(id); /* Must appear last */
log = S2C(session)->log;
myslot.slot = &tmp;
myslot.offset = 0;
- dummy = 0;
WT_CLEAR(tmp);
/* Fast path the contended case. */
if (__wt_spin_trylock(session, &log->log_slot_lock, &id) != 0)
return (EAGAIN);
- locked = 1;
+ locked = true;
if (LF_ISSET(WT_LOG_DSYNC | WT_LOG_FSYNC))
F_SET(&tmp, WT_SLOT_SYNC_DIR);
@@ -1626,9 +1629,9 @@ __log_direct_write(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp,
F_SET(&tmp, WT_SLOT_SYNC);
WT_ERR(__log_acquire(session, record->size, &tmp));
__wt_spin_unlock(session, &log->log_slot_lock);
- locked = 0;
- WT_ERR(__log_fill(session, &myslot, 1, record, lsnp));
- WT_ERR(__log_release(session, &tmp, &dummy));
+ locked = false;
+ WT_ERR(__log_fill(session, &myslot, true, record, lsnp));
+ WT_ERR(__log_release(session, &tmp, NULL));
err: if (locked)
__wt_spin_unlock(session, &log->log_slot_lock);
@@ -1756,13 +1759,20 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp,
WT_LSN lsn;
WT_MYSLOT myslot;
uint32_t rdup_len;
- int free_slot, locked;
+ bool free_slot, locked;
conn = S2C(session);
log = conn->log;
- free_slot = locked = 0;
+ if (record->size > UINT32_MAX) {
+ __wt_errx(session, "Log record size of %" WT_SIZET_FMT
+ " exceeds the maximum supported size of %" PRIu32,
+ record->size, UINT32_MAX);
+ return (EFBIG);
+ }
WT_INIT_LSN(&lsn);
+ free_slot = locked = false;
myslot.slot = NULL;
+
/*
* Assume the WT_ITEM the caller passed is a WT_LOG_RECORD, which has a
* header at the beginning for us to fill in.
@@ -1826,16 +1836,16 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp,
WT_ERR(ret);
if (myslot.offset == 0) {
__wt_spin_lock(session, &log->log_slot_lock);
- locked = 1;
+ locked = true;
WT_ERR(__wt_log_slot_close(session, myslot.slot));
WT_ERR(__log_acquire(
session, myslot.slot->slot_group_size, myslot.slot));
__wt_spin_unlock(session, &log->log_slot_lock);
- locked = 0;
+ locked = false;
WT_ERR(__wt_log_slot_notify(session, myslot.slot));
} else
WT_ERR(__wt_log_slot_wait(session, myslot.slot));
- WT_ERR(__log_fill(session, &myslot, 0, record, &lsn));
+ WT_ERR(__log_fill(session, &myslot, false, record, &lsn));
if (__wt_log_slot_release(myslot.slot, rdup_len) == WT_LOG_SLOT_DONE) {
WT_ERR(__log_release(session, myslot.slot, &free_slot));
if (free_slot)
diff --git a/src/third_party/wiredtiger/src/log/log_auto.c b/src/third_party/wiredtiger/src/log/log_auto.c
index bd830687df2..9977ab01849 100644
--- a/src/third_party/wiredtiger/src/log/log_auto.c
+++ b/src/third_party/wiredtiger/src/log/log_auto.c
@@ -52,7 +52,8 @@ __logrec_json_unpack_str(char *dest, size_t destlen, const char *src,
total = 0;
while (srclen > 0) {
- n = __wt_json_unpack_char(*src++, (u_char *)dest, destlen, 0);
+ n = __wt_json_unpack_char(
+ *src++, (u_char *)dest, destlen, false);
srclen--;
if (n > destlen)
destlen = 0;
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_cursor.c b/src/third_party/wiredtiger/src/lsm/lsm_cursor.c
index 0962da7768b..d3657d4342b 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_cursor.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_cursor.c
@@ -16,7 +16,7 @@
__wt_compare(s, (lsm_tree)->collator, &(c1)->key, &(c2)->key, &cmp)
static int __clsm_lookup(WT_CURSOR_LSM *, WT_ITEM *);
-static int __clsm_open_cursors(WT_CURSOR_LSM *, int, u_int, uint32_t);
+static int __clsm_open_cursors(WT_CURSOR_LSM *, bool, u_int, uint32_t);
static int __clsm_reset_cursors(WT_CURSOR_LSM *, WT_CURSOR *);
/*
@@ -100,22 +100,22 @@ __clsm_enter_update(WT_CURSOR_LSM *clsm)
WT_LSM_CHUNK *primary_chunk;
WT_LSM_TREE *lsm_tree;
WT_SESSION_IMPL *session;
- int hard_limit, have_primary, ovfl;
+ bool hard_limit, have_primary, ovfl;
lsm_tree = clsm->lsm_tree;
- ovfl = 0;
+ ovfl = false;
session = (WT_SESSION_IMPL *)clsm->iface.session;
if (clsm->nchunks == 0) {
primary = NULL;
- have_primary = 0;
+ have_primary = false;
} else {
primary = clsm->cursors[clsm->nchunks - 1];
primary_chunk = clsm->primary_chunk;
- WT_ASSERT(session, F_ISSET(&session->txn, TXN_HAS_ID));
+ WT_ASSERT(session, F_ISSET(&session->txn, WT_TXN_HAS_ID));
have_primary = (primary != NULL && primary_chunk != NULL &&
(primary_chunk->switch_txn == WT_TXN_NONE ||
- TXNID_LT(session->txn.id, primary_chunk->switch_txn)));
+ WT_TXNID_LT(session->txn.id, primary_chunk->switch_txn)));
}
/*
@@ -129,12 +129,12 @@ __clsm_enter_update(WT_CURSOR_LSM *clsm)
* chunk grows twice as large as the configured size, block until it
* can be switched.
*/
- hard_limit = F_ISSET(lsm_tree, WT_LSM_TREE_NEED_SWITCH) ? 1 : 0;
+ hard_limit = F_ISSET(lsm_tree, WT_LSM_TREE_NEED_SWITCH);
if (have_primary) {
WT_ENTER_PAGE_INDEX(session);
WT_WITH_BTREE(session, ((WT_CURSOR_BTREE *)primary)->btree,
- ovfl = __wt_btree_lsm_size(session, hard_limit ?
+ ovfl = __wt_btree_lsm_over_size(session, hard_limit ?
2 * lsm_tree->chunk_size : lsm_tree->chunk_size));
WT_LEAVE_PAGE_INDEX(session);
@@ -160,7 +160,7 @@ __clsm_enter_update(WT_CURSOR_LSM *clsm)
* Start an operation on an LSM cursor, update if the tree has changed.
*/
static inline int
-__clsm_enter(WT_CURSOR_LSM *clsm, int reset, int update)
+__clsm_enter(WT_CURSOR_LSM *clsm, bool reset, bool update)
{
WT_DECL_RET;
WT_LSM_TREE *lsm_tree;
@@ -222,14 +222,14 @@ __clsm_enter(WT_CURSOR_LSM *clsm, int reset, int update)
clsm->nupdates = 1;
if (session->txn.isolation == WT_ISO_SNAPSHOT &&
F_ISSET(clsm, WT_CLSM_OPEN_SNAPSHOT)) {
- WT_ASSERT(session,
- F_ISSET(&session->txn, TXN_HAS_SNAPSHOT));
+ WT_ASSERT(session, F_ISSET(&session->txn,
+ WT_TXN_HAS_SNAPSHOT));
snap_min = session->txn.snap_min;
for (switch_txnp =
&clsm->switch_txn[clsm->nchunks - 2];
clsm->nupdates < clsm->nchunks;
clsm->nupdates++, switch_txnp--) {
- if (TXNID_LT(*switch_txnp, snap_min))
+ if (WT_TXNID_LT(*switch_txnp, snap_min))
break;
WT_ASSERT(session,
!__wt_txn_visible_all(
@@ -295,7 +295,7 @@ static const WT_ITEM __tombstone = { "\x14\x14", 2, 0, NULL, 0 };
* __clsm_deleted --
* Check whether the current value is a tombstone.
*/
-static inline int
+static inline bool
__clsm_deleted(WT_CURSOR_LSM *clsm, const WT_ITEM *item)
{
return (!F_ISSET(clsm, WT_CLSM_MINOR_MERGE) &&
@@ -392,7 +392,7 @@ __clsm_close_cursors(WT_CURSOR_LSM *clsm, u_int start, u_int end)
*/
static int
__clsm_open_cursors(
- WT_CURSOR_LSM *clsm, int update, u_int start_chunk, uint32_t start_id)
+ WT_CURSOR_LSM *clsm, bool update, u_int start_chunk, uint32_t start_id)
{
WT_BTREE *btree;
WT_CURSOR *c, **cp, *primary;
@@ -405,13 +405,13 @@ __clsm_open_cursors(
uint64_t saved_gen;
u_int i, nchunks, ngood, nupdates;
u_int close_range_end, close_range_start;
- int locked;
+ bool locked;
c = &clsm->iface;
session = (WT_SESSION_IMPL *)c->session;
txn = &session->txn;
chunk = NULL;
- locked = 0;
+ locked = false;
lsm_tree = clsm->lsm_tree;
/*
@@ -445,7 +445,7 @@ __clsm_open_cursors(
F_CLR(clsm, WT_CLSM_ITERATE_NEXT | WT_CLSM_ITERATE_PREV);
WT_RET(__wt_lsm_tree_readlock(session, lsm_tree));
- locked = 1;
+ locked = true;
/* Merge cursors have already figured out how many chunks they need. */
retry: if (F_ISSET(clsm, WT_CLSM_MERGE)) {
@@ -562,12 +562,12 @@ retry: if (F_ISSET(clsm, WT_CLSM_MERGE)) {
}
if (close_range_end > close_range_start) {
saved_gen = lsm_tree->dsk_gen;
- locked = 0;
+ locked = false;
WT_ERR(__wt_lsm_tree_readunlock(session, lsm_tree));
WT_ERR(__clsm_close_cursors(
clsm, close_range_start, close_range_end));
WT_ERR(__wt_lsm_tree_readlock(session, lsm_tree));
- locked = 1;
+ locked = true;
if (lsm_tree->dsk_gen != saved_gen)
goto retry;
}
@@ -646,9 +646,9 @@ retry: if (F_ISSET(clsm, WT_CLSM_MERGE)) {
*/
btree = ((WT_CURSOR_BTREE *)(primary))->btree;
if (btree->bulk_load_ok) {
- btree->bulk_load_ok = 0;
+ btree->bulk_load_ok = false;
WT_WITH_BTREE(session, btree,
- __wt_btree_evictable(session, 0));
+ __wt_btree_evictable(session, false));
}
}
@@ -709,7 +709,7 @@ __wt_clsm_init_merge(
clsm->nchunks = nchunks;
WT_WITH_SCHEMA_LOCK(session,
- ret = __clsm_open_cursors(clsm, 0, start_chunk, start_id));
+ ret = __clsm_open_cursors(clsm, false, start_chunk, start_id));
return (ret);
}
@@ -718,15 +718,16 @@ __wt_clsm_init_merge(
* Find the smallest / largest of the cursors and copy its key/value.
*/
static int
-__clsm_get_current(
- WT_SESSION_IMPL *session, WT_CURSOR_LSM *clsm, int smallest, int *deletedp)
+__clsm_get_current(WT_SESSION_IMPL *session,
+ WT_CURSOR_LSM *clsm, bool smallest, bool *deletedp)
{
WT_CURSOR *c, *current;
- int cmp, multiple;
+ int cmp;
u_int i;
+ bool multiple;
current = NULL;
- multiple = 0;
+ multiple = false;
WT_FORALL_CURSORS(clsm, c, i) {
if (!F_ISSET(c, WT_CURSTD_KEY_INT))
@@ -738,9 +739,9 @@ __clsm_get_current(
WT_RET(WT_LSM_CURCMP(session, clsm->lsm_tree, c, current, cmp));
if (smallest ? cmp < 0 : cmp > 0) {
current = c;
- multiple = 0;
+ multiple = false;
} else if (cmp == 0)
- multiple = 1;
+ multiple = true;
}
c = &clsm->iface;
@@ -758,7 +759,7 @@ __clsm_get_current(
WT_RET(current->get_value(current, &c->value));
F_CLR(c, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET);
- if ((*deletedp = __clsm_deleted(clsm, &c->value)) == 0)
+ if ((*deletedp = __clsm_deleted(clsm, &c->value)) == false)
F_SET(c, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT);
return (0);
@@ -808,13 +809,14 @@ __clsm_next(WT_CURSOR *cursor)
WT_DECL_RET;
WT_SESSION_IMPL *session;
u_int i;
- int check, cmp, deleted;
+ int cmp;
+ bool check, deleted;
clsm = (WT_CURSOR_LSM *)cursor;
CURSOR_API_CALL(cursor, session, next, NULL);
WT_CURSOR_NOVALUE(cursor);
- WT_ERR(__clsm_enter(clsm, 0, 0));
+ WT_ERR(__clsm_enter(clsm, false, false));
/* If we aren't positioned for a forward scan, get started. */
if (clsm->current == NULL || !F_ISSET(clsm, WT_CLSM_ITERATE_NEXT)) {
@@ -852,7 +854,7 @@ retry: /*
* forward.
*/
if (F_ISSET(clsm, WT_CLSM_MULTIPLE)) {
- check = 0;
+ check = false;
WT_FORALL_CURSORS(clsm, c, i) {
if (!F_ISSET(c, WT_CURSTD_KEY_INT))
continue;
@@ -864,7 +866,7 @@ retry: /*
WT_ERR_NOTFOUND_OK(c->next(c));
}
if (c == clsm->current)
- check = 1;
+ check = true;
}
}
@@ -874,7 +876,7 @@ retry: /*
}
/* Find the cursor(s) with the smallest key. */
- if ((ret = __clsm_get_current(session, clsm, 1, &deleted)) == 0 &&
+ if ((ret = __clsm_get_current(session, clsm, true, &deleted)) == 0 &&
deleted)
goto retry;
@@ -897,13 +899,14 @@ __clsm_prev(WT_CURSOR *cursor)
WT_DECL_RET;
WT_SESSION_IMPL *session;
u_int i;
- int check, cmp, deleted;
+ int cmp;
+ bool check, deleted;
clsm = (WT_CURSOR_LSM *)cursor;
CURSOR_API_CALL(cursor, session, prev, NULL);
WT_CURSOR_NOVALUE(cursor);
- WT_ERR(__clsm_enter(clsm, 0, 0));
+ WT_ERR(__clsm_enter(clsm, false, false));
/* If we aren't positioned for a reverse scan, get started. */
if (clsm->current == NULL || !F_ISSET(clsm, WT_CLSM_ITERATE_PREV)) {
@@ -940,7 +943,7 @@ retry: /*
* backwards.
*/
if (F_ISSET(clsm, WT_CLSM_MULTIPLE)) {
- check = 0;
+ check = false;
WT_FORALL_CURSORS(clsm, c, i) {
if (!F_ISSET(c, WT_CURSTD_KEY_INT))
continue;
@@ -952,7 +955,7 @@ retry: /*
WT_ERR_NOTFOUND_OK(c->prev(c));
}
if (c == clsm->current)
- check = 1;
+ check = true;
}
}
@@ -962,7 +965,7 @@ retry: /*
}
/* Find the cursor(s) with the largest key. */
- if ((ret = __clsm_get_current(session, clsm, 0, &deleted)) == 0 &&
+ if ((ret = __clsm_get_current(session, clsm, false, &deleted)) == 0 &&
deleted)
goto retry;
@@ -1045,11 +1048,11 @@ __clsm_lookup(WT_CURSOR_LSM *clsm, WT_ITEM *value)
WT_DECL_RET;
WT_SESSION_IMPL *session;
u_int i;
- int have_hash;
+ bool have_hash;
c = NULL;
cursor = &clsm->iface;
- have_hash = 0;
+ have_hash = false;
session = (WT_SESSION_IMPL *)cursor->session;
WT_FORALL_CURSORS(clsm, c, i) {
@@ -1059,7 +1062,7 @@ __clsm_lookup(WT_CURSOR_LSM *clsm, WT_ITEM *value)
if (!have_hash) {
WT_ERR(__wt_bloom_hash(
bloom, &cursor->key, &bhash));
- have_hash = 1;
+ have_hash = true;
}
ret = __wt_bloom_hash_get(bloom, &bhash);
@@ -1121,7 +1124,7 @@ __clsm_search(WT_CURSOR *cursor)
CURSOR_API_CALL(cursor, session, search, NULL);
WT_CURSOR_NEEDKEY(cursor);
WT_CURSOR_NOVALUE(cursor);
- WT_ERR(__clsm_enter(clsm, 1, 0));
+ WT_ERR(__clsm_enter(clsm, true, false));
ret = __clsm_lookup(clsm, &cursor->value);
@@ -1144,16 +1147,18 @@ __clsm_search_near(WT_CURSOR *cursor, int *exactp)
WT_DECL_RET;
WT_SESSION_IMPL *session;
u_int i;
- int cmp, deleted, exact;
+ int cmp, exact;
+ bool deleted;
closest = NULL;
clsm = (WT_CURSOR_LSM *)cursor;
- deleted = exact = 0;
+ exact = 0;
+ deleted = false;
CURSOR_API_CALL(cursor, session, search_near, NULL);
WT_CURSOR_NEEDKEY(cursor);
WT_CURSOR_NOVALUE(cursor);
- WT_ERR(__clsm_enter(clsm, 1, 0));
+ WT_ERR(__clsm_enter(clsm, true, false));
F_CLR(clsm, WT_CLSM_ITERATE_NEXT | WT_CLSM_ITERATE_PREV);
/*
@@ -1222,7 +1227,7 @@ __clsm_search_near(WT_CURSOR *cursor, int *exactp)
* end up with WT_NOTFOUND, as expected.
*/
if (closest == NULL)
- deleted = 1;
+ deleted = true;
else {
WT_ERR(closest->get_key(closest, &cursor->key));
WT_ERR(closest->get_value(closest, &cursor->value));
@@ -1244,7 +1249,7 @@ __clsm_search_near(WT_CURSOR *cursor, int *exactp)
F_SET(cursor, WT_CURSTD_KEY_INT);
if ((ret = cursor->next(cursor)) == 0) {
cmp = 1;
- deleted = 0;
+ deleted = false;
}
}
WT_ERR_NOTFOUND_OK(ret);
@@ -1276,8 +1281,8 @@ err: __clsm_leave(clsm);
* necessary.
*/
static inline int
-__clsm_put(WT_SESSION_IMPL *session,
- WT_CURSOR_LSM *clsm, const WT_ITEM *key, const WT_ITEM *value, int position)
+__clsm_put(WT_SESSION_IMPL *session, WT_CURSOR_LSM *clsm,
+ const WT_ITEM *key, const WT_ITEM *value, bool position)
{
WT_CURSOR *c, *primary;
WT_LSM_TREE *lsm_tree;
@@ -1286,10 +1291,10 @@ __clsm_put(WT_SESSION_IMPL *session,
lsm_tree = clsm->lsm_tree;
WT_ASSERT(session,
- F_ISSET(&session->txn, TXN_HAS_ID) &&
+ F_ISSET(&session->txn, WT_TXN_HAS_ID) &&
clsm->primary_chunk != NULL &&
(clsm->primary_chunk->switch_txn == WT_TXN_NONE ||
- TXNID_LE(session->txn.id, clsm->primary_chunk->switch_txn)));
+ WT_TXNID_LE(session->txn.id, clsm->primary_chunk->switch_txn)));
/*
* Clear the existing cursor position. Don't clear the primary cursor:
@@ -1362,7 +1367,7 @@ __clsm_insert(WT_CURSOR *cursor)
CURSOR_UPDATE_API_CALL(cursor, session, insert, NULL);
WT_CURSOR_NEEDKEY(cursor);
WT_CURSOR_NEEDVALUE(cursor);
- WT_ERR(__clsm_enter(clsm, 0, 1));
+ WT_ERR(__clsm_enter(clsm, false, true));
if (!F_ISSET(cursor, WT_CURSTD_OVERWRITE) &&
(ret = __clsm_lookup(clsm, &value)) != WT_NOTFOUND) {
@@ -1372,7 +1377,7 @@ __clsm_insert(WT_CURSOR *cursor)
}
WT_ERR(__clsm_deleted_encode(session, &cursor->value, &value, &buf));
- ret = __clsm_put(session, clsm, &cursor->key, &value, 0);
+ ret = __clsm_put(session, clsm, &cursor->key, &value, false);
err: __wt_scr_free(session, &buf);
__clsm_leave(clsm);
@@ -1398,13 +1403,13 @@ __clsm_update(WT_CURSOR *cursor)
CURSOR_UPDATE_API_CALL(cursor, session, update, NULL);
WT_CURSOR_NEEDKEY(cursor);
WT_CURSOR_NEEDVALUE(cursor);
- WT_ERR(__clsm_enter(clsm, 0, 1));
+ WT_ERR(__clsm_enter(clsm, false, true));
if (F_ISSET(cursor, WT_CURSTD_OVERWRITE) ||
(ret = __clsm_lookup(clsm, &value)) == 0) {
WT_ERR(__clsm_deleted_encode(
session, &cursor->value, &value, &buf));
- ret = __clsm_put(session, clsm, &cursor->key, &value, 1);
+ ret = __clsm_put(session, clsm, &cursor->key, &value, true);
}
err: __wt_scr_free(session, &buf);
@@ -1430,11 +1435,12 @@ __clsm_remove(WT_CURSOR *cursor)
CURSOR_UPDATE_API_CALL(cursor, session, remove, NULL);
WT_CURSOR_NEEDKEY(cursor);
WT_CURSOR_NOVALUE(cursor);
- WT_ERR(__clsm_enter(clsm, 0, 1));
+ WT_ERR(__clsm_enter(clsm, false, true));
if (F_ISSET(cursor, WT_CURSTD_OVERWRITE) ||
(ret = __clsm_lookup(clsm, &value)) == 0)
- ret = __clsm_put(session, clsm, &cursor->key, &__tombstone, 1);
+ ret = __clsm_put(
+ session, clsm, &cursor->key, &__tombstone, true);
err: __clsm_leave(clsm);
CURSOR_UPDATE_API_END(session, ret);
@@ -1505,9 +1511,8 @@ __wt_clsm_open(WT_SESSION_IMPL *session,
WT_CURSOR_LSM *clsm;
WT_DECL_RET;
WT_LSM_TREE *lsm_tree;
- int bulk;
+ bool bulk;
- bulk = 0;
clsm = NULL;
cursor = NULL;
lsm_tree = NULL;
@@ -1521,11 +1526,10 @@ __wt_clsm_open(WT_SESSION_IMPL *session,
"LSM does not support opening by checkpoint");
WT_RET(__wt_config_gets_def(session, cfg, "bulk", 0, &cval));
- if (cval.val != 0)
- bulk = 1;
+ bulk = cval.val != 0;
/* Get the LSM tree. */
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, uri, bulk, &lsm_tree));
/*
* Check whether the exclusive open for a bulk load succeeded, and
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_manager.c b/src/third_party/wiredtiger/src/lsm/lsm_manager.c
index 0e22af3b623..14377f10125 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_manager.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_manager.c
@@ -226,7 +226,7 @@ __wt_lsm_manager_start(WT_SESSION_IMPL *session)
*/
for (i = 0; i < WT_LSM_MAX_WORKERS; i++) {
WT_ERR(__wt_open_internal_session(
- S2C(session), "lsm-worker", 1, 0, &worker_session));
+ S2C(session), "lsm-worker", true, false, &worker_session));
worker_session->isolation = WT_ISO_READ_UNCOMMITTED;
manager->lsm_worker_cookies[i].session = worker_session;
}
@@ -408,18 +408,18 @@ __lsm_manager_run_server(WT_SESSION_IMPL *session)
WT_LSM_TREE *lsm_tree;
struct timespec now;
uint64_t fillms, pushms;
- int dhandle_locked;
+ bool dhandle_locked;
conn = S2C(session);
- dhandle_locked = 0;
+ dhandle_locked = false;
while (F_ISSET(conn, WT_CONN_SERVER_RUN)) {
__wt_sleep(0, 10000);
if (TAILQ_EMPTY(&conn->lsmqh))
continue;
__wt_spin_lock(session, &conn->dhandle_lock);
- F_SET(session, WT_SESSION_HANDLE_LIST_LOCKED);
- dhandle_locked = 1;
+ F_SET(session, WT_SESSION_LOCKED_HANDLE_LIST);
+ dhandle_locked = true;
TAILQ_FOREACH(lsm_tree, &S2C(session)->lsmqh, q) {
if (!F_ISSET(lsm_tree, WT_LSM_TREE_ACTIVE))
continue;
@@ -478,13 +478,13 @@ __lsm_manager_run_server(WT_SESSION_IMPL *session)
}
}
__wt_spin_unlock(session, &conn->dhandle_lock);
- F_CLR(session, WT_SESSION_HANDLE_LIST_LOCKED);
- dhandle_locked = 0;
+ F_CLR(session, WT_SESSION_LOCKED_HANDLE_LIST);
+ dhandle_locked = false;
}
err: if (dhandle_locked) {
__wt_spin_unlock(session, &conn->dhandle_lock);
- F_CLR(session, WT_SESSION_HANDLE_LIST_LOCKED);
+ F_CLR(session, WT_SESSION_LOCKED_HANDLE_LIST);
}
return (ret);
}
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_merge.c b/src/third_party/wiredtiger/src/lsm/lsm_merge.c
index de7ea37e498..76caf4318fa 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_merge.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_merge.c
@@ -239,21 +239,18 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id)
WT_LSM_CHUNK *chunk;
uint32_t generation;
uint64_t insert_count, record_count;
- u_int dest_id, end_chunk, i, nchunks, start_chunk, start_id;
- u_int created_chunk, verb;
- int create_bloom, locked, in_sync, tret;
+ u_int dest_id, end_chunk, i, nchunks, start_chunk, start_id, verb;
+ int tret;
+ bool created_chunk, create_bloom, locked, in_sync;
const char *cfg[3];
const char *drop_cfg[] =
{ WT_CONFIG_BASE(session, session_drop), "force", NULL };
bloom = NULL;
chunk = NULL;
- create_bloom = 0;
- created_chunk = 0;
dest = src = NULL;
- locked = 0;
start_id = 0;
- in_sync = 0;
+ created_chunk = create_bloom = locked = in_sync = false;
/* Fast path if it's obvious no merges could be done. */
if (lsm_tree->nchunks < lsm_tree->merge_min &&
@@ -266,7 +263,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id)
* long time.
*/
WT_RET(__wt_lsm_tree_writelock(session, lsm_tree));
- locked = 1;
+ locked = true;
WT_ERR(__lsm_merge_span(session,
lsm_tree, id, &start_chunk, &end_chunk, &record_count));
@@ -281,7 +278,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id)
lsm_tree->chunk[start_chunk + i]->generation + 1);
WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree));
- locked = 0;
+ locked = false;
/* Allocate an ID for the merge. */
dest_id = __wt_atomic_add32(&lsm_tree->last, 1);
@@ -304,13 +301,13 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id)
}
WT_ERR(__wt_calloc_one(session, &chunk));
- created_chunk = 1;
+ created_chunk = true;
chunk->id = dest_id;
if (FLD_ISSET(lsm_tree->bloom, WT_LSM_BLOOM_MERGED) &&
(FLD_ISSET(lsm_tree->bloom, WT_LSM_BLOOM_OLDEST) ||
start_chunk > 0) && record_count > 0)
- create_bloom = 1;
+ create_bloom = true;
/*
* Special setup for the merge cursor:
@@ -376,7 +373,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id)
* progress.
*/
(void)__wt_atomic_add32(&lsm_tree->merge_syncing, 1);
- in_sync = 1;
+ in_sync = true;
/*
* We've successfully created the new chunk. Now install it. We need
* to ensure that the NO_CACHE flag is cleared and the bloom filter
@@ -427,12 +424,12 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id)
dest = NULL;
++lsm_tree->merge_progressing;
(void)__wt_atomic_sub32(&lsm_tree->merge_syncing, 1);
- in_sync = 0;
+ in_sync = false;
WT_ERR_NOTFOUND_OK(ret);
WT_ERR(__wt_lsm_tree_set_chunk_size(session, chunk));
WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree));
- locked = 1;
+ locked = true;
/*
* Check whether we raced with another merge, and adjust the chunk
@@ -473,7 +470,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id)
lsm_tree->dsk_gen++;
/* Update the throttling while holding the tree lock. */
- __wt_lsm_tree_throttle(session, lsm_tree, 1);
+ __wt_lsm_tree_throttle(session, lsm_tree, true);
/* Schedule a pass to discard old chunks */
WT_ERR(__wt_lsm_manager_push_entry(
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_meta.c b/src/third_party/wiredtiger/src/lsm/lsm_meta.c
index e4c95125428..64ca283e2c8 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_meta.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_meta.c
@@ -184,7 +184,7 @@ __wt_lsm_meta_write(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
WT_DECL_RET;
WT_LSM_CHUNK *chunk;
u_int i;
- int first;
+ bool first;
WT_RET(__wt_scr_alloc(session, 0, &buf));
WT_ERR(__wt_buf_fmt(session, buf,
@@ -229,12 +229,12 @@ __wt_lsm_meta_write(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
}
WT_ERR(__wt_buf_catfmt(session, buf, "]"));
WT_ERR(__wt_buf_catfmt(session, buf, ",old_chunks=["));
- first = 1;
+ first = true;
for (i = 0; i < lsm_tree->nold_chunks; i++) {
chunk = lsm_tree->old_chunks[i];
WT_ASSERT(session, chunk != NULL);
if (first)
- first = 0;
+ first = false;
else
WT_ERR(__wt_buf_catfmt(session, buf, ","));
WT_ERR(__wt_buf_catfmt(session, buf, "\"%s\"", chunk->uri));
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_stat.c b/src/third_party/wiredtiger/src/lsm/lsm_stat.c
index 656e43c978d..086860fc73a 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_stat.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_stat.c
@@ -23,7 +23,7 @@ __curstat_lsm_init(
WT_LSM_CHUNK *chunk;
WT_LSM_TREE *lsm_tree;
u_int i;
- int locked;
+ bool locked;
char config[64];
const char *cfg[] = {
WT_CONFIG_BASE(session, session_open_cursor), NULL, NULL };
@@ -31,9 +31,9 @@ __curstat_lsm_init(
WT_CONFIG_BASE(session, session_open_cursor),
"checkpoint=" WT_CHECKPOINT, NULL, NULL };
- locked = 0;
- WT_WITH_DHANDLE_LOCK(session,
- ret = __wt_lsm_tree_get(session, uri, 0, &lsm_tree));
+ locked = false;
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ ret = __wt_lsm_tree_get(session, uri, false, &lsm_tree));
WT_RET(ret);
WT_ERR(__wt_scr_alloc(session, 0, &uribuf));
@@ -58,7 +58,7 @@ __curstat_lsm_init(
/* Hold the LSM lock so that we can safely walk through the chunks. */
WT_ERR(__wt_lsm_tree_readlock(session, lsm_tree));
- locked = 1;
+ locked = true;
/* Initialize the statistics. */
__wt_stat_init_dsrc_stats(stats);
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_tree.c b/src/third_party/wiredtiger/src/lsm/lsm_tree.c
index 3c8f4d5750a..0680d98bdde 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_tree.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_tree.c
@@ -11,7 +11,7 @@
static int __lsm_tree_cleanup_old(WT_SESSION_IMPL *, const char *);
static int __lsm_tree_open_check(WT_SESSION_IMPL *, WT_LSM_TREE *);
static int __lsm_tree_open(
- WT_SESSION_IMPL *, const char *, int, WT_LSM_TREE **);
+ WT_SESSION_IMPL *, const char *, bool, WT_LSM_TREE **);
static int __lsm_tree_set_name(WT_SESSION_IMPL *, WT_LSM_TREE *, const char *);
/*
@@ -19,7 +19,7 @@ static int __lsm_tree_set_name(WT_SESSION_IMPL *, WT_LSM_TREE *, const char *);
* Free an LSM tree structure.
*/
static int
-__lsm_tree_discard(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, int final)
+__lsm_tree_discard(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool final)
{
WT_DECL_RET;
WT_LSM_CHUNK *chunk;
@@ -30,7 +30,7 @@ __lsm_tree_discard(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, int final)
/* We may be destroying an lsm_tree before it was added. */
if (F_ISSET(lsm_tree, WT_LSM_TREE_OPEN)) {
WT_ASSERT(session, final ||
- F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
TAILQ_REMOVE(&S2C(session)->lsmqh, lsm_tree, q);
}
@@ -136,7 +136,7 @@ __wt_lsm_tree_close_all(WT_SESSION_IMPL *session)
*/
(void)__wt_atomic_add32(&lsm_tree->refcnt, 1);
WT_TRET(__lsm_tree_close(session, lsm_tree));
- WT_TRET(__lsm_tree_discard(session, lsm_tree, 1));
+ WT_TRET(__lsm_tree_discard(session, lsm_tree, true));
}
return (ret);
@@ -232,7 +232,7 @@ __lsm_tree_cleanup_old(WT_SESSION_IMPL *session, const char *uri)
WT_DECL_RET;
const char *cfg[] =
{ WT_CONFIG_BASE(session, session_drop), "force", NULL };
- int exists;
+ bool exists;
WT_RET(__wt_exist(session, uri + strlen("file:"), &exists));
if (exists)
@@ -249,7 +249,7 @@ int
__wt_lsm_tree_setup_chunk(
WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, WT_LSM_CHUNK *chunk)
{
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_SCHEMA_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SCHEMA));
WT_RET(__wt_epoch(session, &chunk->create_ts));
WT_RET(__wt_lsm_tree_chunk_name(
@@ -297,7 +297,7 @@ __wt_lsm_tree_setup_bloom(
*/
int
__wt_lsm_tree_create(WT_SESSION_IMPL *session,
- const char *uri, int exclusive, const char *config)
+ const char *uri, bool exclusive, const char *config)
{
WT_CONFIG_ITEM cval;
WT_DECL_ITEM(buf);
@@ -308,8 +308,8 @@ __wt_lsm_tree_create(WT_SESSION_IMPL *session,
char *tmpconfig;
/* If the tree is open, it already exists. */
- WT_WITH_DHANDLE_LOCK(session,
- ret = __wt_lsm_tree_get(session, uri, 0, &lsm_tree));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ ret = __wt_lsm_tree_get(session, uri, false, &lsm_tree));
if (ret == 0) {
__wt_lsm_tree_release(session, lsm_tree);
return (exclusive ? EEXIST : 0);
@@ -421,7 +421,7 @@ __wt_lsm_tree_create(WT_SESSION_IMPL *session,
WT_ERR(__wt_lsm_meta_write(session, lsm_tree));
/* Discard our partially populated handle. */
- ret = __lsm_tree_discard(session, lsm_tree, 0);
+ ret = __lsm_tree_discard(session, lsm_tree, false);
lsm_tree = NULL;
/*
@@ -430,13 +430,13 @@ __wt_lsm_tree_create(WT_SESSION_IMPL *session,
* tracking macros handle cleaning up on failure.
*/
if (ret == 0)
- WT_WITH_DHANDLE_LOCK(session,
- ret = __lsm_tree_open(session, uri, 1, &lsm_tree));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ ret = __lsm_tree_open(session, uri, true, &lsm_tree));
if (ret == 0)
__wt_lsm_tree_release(session, lsm_tree);
if (0) {
-err: WT_TRET(__lsm_tree_discard(session, lsm_tree, 0));
+err: WT_TRET(__lsm_tree_discard(session, lsm_tree, false));
}
__wt_scr_free(session, &buf);
return (ret);
@@ -451,11 +451,11 @@ err: WT_TRET(__lsm_tree_discard(session, lsm_tree, 0));
*/
static int
__lsm_tree_find(WT_SESSION_IMPL *session,
- const char *uri, int exclusive, WT_LSM_TREE **treep)
+ const char *uri, bool exclusive, WT_LSM_TREE **treep)
{
WT_LSM_TREE *lsm_tree;
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
/* See if the tree is already open. */
TAILQ_FOREACH(lsm_tree, &S2C(session)->lsmqh, q)
@@ -543,7 +543,7 @@ __lsm_tree_open_check(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
*/
static int
__lsm_tree_open(WT_SESSION_IMPL *session,
- const char *uri, int exclusive, WT_LSM_TREE **treep)
+ const char *uri, bool exclusive, WT_LSM_TREE **treep)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
@@ -552,7 +552,7 @@ __lsm_tree_open(WT_SESSION_IMPL *session,
conn = S2C(session);
lsm_tree = NULL;
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
/* Start the LSM manager thread if it isn't running. */
if (__wt_atomic_cas32(&conn->lsm_manager.lsm_workers, 0, 1))
@@ -586,7 +586,7 @@ __lsm_tree_open(WT_SESSION_IMPL *session,
* with getting handles exclusive.
*/
lsm_tree->refcnt = 1;
- lsm_tree->exclusive = exclusive;
+ lsm_tree->exclusive = exclusive ? 1 : 0;
lsm_tree->queue_ref = 0;
/* Set a flush timestamp as a baseline. */
@@ -599,7 +599,7 @@ __lsm_tree_open(WT_SESSION_IMPL *session,
*treep = lsm_tree;
if (0) {
-err: WT_TRET(__lsm_tree_discard(session, lsm_tree, 0));
+err: WT_TRET(__lsm_tree_discard(session, lsm_tree, false));
}
return (ret);
}
@@ -610,17 +610,18 @@ err: WT_TRET(__lsm_tree_discard(session, lsm_tree, 0));
*/
int
__wt_lsm_tree_get(WT_SESSION_IMPL *session,
- const char *uri, int exclusive, WT_LSM_TREE **treep)
+ const char *uri, bool exclusive, WT_LSM_TREE **treep)
{
WT_DECL_RET;
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
ret = __lsm_tree_find(session, uri, exclusive, treep);
if (ret == WT_NOTFOUND)
ret = __lsm_tree_open(session, uri, exclusive, treep);
- WT_ASSERT(session, ret != 0 || exclusive == (*treep)->exclusive);
+ WT_ASSERT(session, ret != 0 ||
+ (exclusive ? 1 : 0) == (*treep)->exclusive);
return (ret);
}
@@ -664,7 +665,7 @@ __wt_lsm_tree_release(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
*/
void
__wt_lsm_tree_throttle(
- WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, int decrease_only)
+ WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool decrease_only)
{
WT_LSM_CHUNK *last_chunk, **cp, *ondisk, *prev_chunk;
uint64_t cache_sz, cache_used, oldtime, record_count, timediff;
@@ -807,13 +808,13 @@ __wt_lsm_tree_switch(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
WT_DECL_RET;
WT_LSM_CHUNK *chunk, *last_chunk;
uint32_t chunks_moved, nchunks, new_id;
- int first_switch;
+ bool first_switch;
WT_RET(__wt_lsm_tree_writelock(session, lsm_tree));
nchunks = lsm_tree->nchunks;
- first_switch = nchunks == 0 ? 1 : 0;
+ first_switch = nchunks == 0;
/*
* Check if a switch is still needed: we may have raced while waiting
@@ -827,7 +828,7 @@ __wt_lsm_tree_switch(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
goto err;
/* Update the throttle time. */
- __wt_lsm_tree_throttle(session, lsm_tree, 0);
+ __wt_lsm_tree_throttle(session, lsm_tree, false);
new_id = __wt_atomic_add32(&lsm_tree->last, 1);
@@ -936,13 +937,13 @@ __wt_lsm_tree_drop(
WT_LSM_CHUNK *chunk;
WT_LSM_TREE *lsm_tree;
u_int i;
- int locked;
+ bool locked;
- locked = 0;
+ locked = false;
/* Get the LSM tree. */
- WT_WITH_DHANDLE_LOCK(session,
- ret = __wt_lsm_tree_get(session, name, 1, &lsm_tree));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ ret = __wt_lsm_tree_get(session, name, true, &lsm_tree));
WT_RET(ret);
/* Shut down the LSM worker. */
@@ -950,7 +951,7 @@ __wt_lsm_tree_drop(
/* Prevent any new opens. */
WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree));
- locked = 1;
+ locked = true;
/* Drop the chunks. */
for (i = 0; i < lsm_tree->nchunks; i++) {
@@ -971,14 +972,14 @@ __wt_lsm_tree_drop(
__wt_schema_drop(session, chunk->bloom_uri, cfg));
}
- locked = 0;
+ locked = false;
WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree));
ret = __wt_metadata_remove(session, name);
err: if (locked)
WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree));
- WT_WITH_DHANDLE_LOCK(session,
- WT_TRET(__lsm_tree_discard(session, lsm_tree, 0)));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ WT_TRET(__lsm_tree_discard(session, lsm_tree, false)));
return (ret);
}
@@ -995,14 +996,14 @@ __wt_lsm_tree_rename(WT_SESSION_IMPL *session,
WT_LSM_TREE *lsm_tree;
const char *old;
u_int i;
- int locked;
+ bool locked;
old = NULL;
- locked = 0;
+ locked = false;
/* Get the LSM tree. */
- WT_WITH_DHANDLE_LOCK(session,
- ret = __wt_lsm_tree_get(session, olduri, 1, &lsm_tree));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ ret = __wt_lsm_tree_get(session, olduri, true, &lsm_tree));
WT_RET(ret);
/* Shut down the LSM worker. */
@@ -1010,7 +1011,7 @@ __wt_lsm_tree_rename(WT_SESSION_IMPL *session,
/* Prevent any new opens. */
WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree));
- locked = 1;
+ locked = true;
/* Set the new name. */
WT_ERR(__lsm_tree_set_name(session, lsm_tree, newuri));
@@ -1039,7 +1040,7 @@ __wt_lsm_tree_rename(WT_SESSION_IMPL *session,
}
WT_ERR(__wt_lsm_meta_write(session, lsm_tree));
- locked = 0;
+ locked = false;
WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree));
WT_ERR(__wt_metadata_remove(session, olduri));
@@ -1051,8 +1052,8 @@ err: if (locked)
* Discard this LSM tree structure. The first operation on the renamed
* tree will create a new one.
*/
- WT_WITH_DHANDLE_LOCK(session,
- WT_TRET(__lsm_tree_discard(session, lsm_tree, 0)));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ WT_TRET(__lsm_tree_discard(session, lsm_tree, false)));
return (ret);
}
@@ -1067,15 +1068,15 @@ __wt_lsm_tree_truncate(
WT_DECL_RET;
WT_LSM_CHUNK *chunk;
WT_LSM_TREE *lsm_tree;
- int locked;
+ bool locked;
WT_UNUSED(cfg);
chunk = NULL;
- locked = 0;
+ locked = false;
/* Get the LSM tree. */
- WT_WITH_DHANDLE_LOCK(session,
- ret = __wt_lsm_tree_get(session, name, 1, &lsm_tree));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ ret = __wt_lsm_tree_get(session, name, true, &lsm_tree));
WT_RET(ret);
/* Shut down the LSM worker. */
@@ -1083,7 +1084,7 @@ __wt_lsm_tree_truncate(
/* Prevent any new opens. */
WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree));
- locked = 1;
+ locked = true;
/* Create the new chunk. */
WT_ERR(__wt_calloc_one(session, &chunk));
@@ -1096,7 +1097,7 @@ __wt_lsm_tree_truncate(
WT_ERR(__wt_lsm_meta_write(session, lsm_tree));
- locked = 0;
+ locked = false;
WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree));
__wt_lsm_tree_release(session, lsm_tree);
@@ -1113,8 +1114,8 @@ err: if (locked)
* the last good version of the metadata will be used, resulting
* in a valid (not truncated) tree.
*/
- WT_WITH_DHANDLE_LOCK(session,
- WT_TRET(__lsm_tree_discard(session, lsm_tree, 0)));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ WT_TRET(__lsm_tree_discard(session, lsm_tree, false)));
}
return (ret);
}
@@ -1190,7 +1191,7 @@ __wt_lsm_tree_writeunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
* Compact an LSM tree called via __wt_schema_worker.
*/
int
-__wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
+__wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, bool *skipp)
{
WT_DECL_RET;
WT_LSM_CHUNK *chunk;
@@ -1198,9 +1199,9 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
time_t begin, end;
uint64_t progress;
uint32_t i;
- int compacting, flushing, locked, ref;
+ bool compacting, flushing, locked, ref;
- compacting = flushing = locked = ref = 0;
+ compacting = flushing = locked = ref = false;
chunk = NULL;
/*
* This function is applied to all matching sources: ignore anything
@@ -1210,10 +1211,10 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
return (0);
/* Tell __wt_schema_worker not to look inside the LSM tree. */
- *skip = 1;
+ *skipp = true;
- WT_WITH_DHANDLE_LOCK(session,
- ret = __wt_lsm_tree_get(session, name, 0, &lsm_tree));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ ret = __wt_lsm_tree_get(session, name, false, &lsm_tree));
WT_RET(ret);
if (!F_ISSET(S2C(session), WT_CONN_LSM_MERGE))
@@ -1237,7 +1238,7 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
/* Lock the tree: single-thread compaction. */
WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree));
- locked = 1;
+ locked = true;
/* Clear any merge throttle: compact throws out that calculation. */
lsm_tree->merge_throttle = 0;
@@ -1262,10 +1263,10 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
* So we need to add a reference to keep it available.
*/
(void)__wt_atomic_add32(&chunk->refcnt, 1);
- ref = 1;
+ ref = true;
}
- locked = 0;
+ locked = false;
WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree));
if (chunk != NULL) {
@@ -1273,7 +1274,7 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
"Compact force flush %s flags 0x%" PRIx32
" chunk %u flags 0x%"
PRIx32, name, lsm_tree->flags, chunk->id, chunk->flags));
- flushing = 1;
+ flushing = true;
/*
* Make sure the in-memory chunk gets flushed do not push a
* switch, because we don't want to create a new in-memory
@@ -1286,7 +1287,7 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
* If there is no chunk to flush, go straight to the
* compacting state.
*/
- compacting = 1;
+ compacting = true;
progress = lsm_tree->merge_progressing;
F_SET(lsm_tree, WT_LSM_TREE_COMPACTING);
WT_ERR(__wt_verbose(session, WT_VERB_LSM,
@@ -1310,8 +1311,8 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
name, chunk->id,
lsm_tree->merge_progressing));
(void)__wt_atomic_sub32(&chunk->refcnt, 1);
- flushing = ref = 0;
- compacting = 1;
+ flushing = ref = false;
+ compacting = true;
F_SET(lsm_tree, WT_LSM_TREE_COMPACTING);
progress = lsm_tree->merge_progressing;
} else {
@@ -1387,18 +1388,18 @@ int
__wt_lsm_tree_worker(WT_SESSION_IMPL *session,
const char *uri,
int (*file_func)(WT_SESSION_IMPL *, const char *[]),
- int (*name_func)(WT_SESSION_IMPL *, const char *, int *),
+ int (*name_func)(WT_SESSION_IMPL *, const char *, bool *),
const char *cfg[], uint32_t open_flags)
{
WT_DECL_RET;
WT_LSM_CHUNK *chunk;
WT_LSM_TREE *lsm_tree;
u_int i;
- int exclusive, locked;
+ bool exclusive, locked;
- locked = 0;
- exclusive = FLD_ISSET(open_flags, WT_DHANDLE_EXCLUSIVE) ? 1 : 0;
- WT_WITH_DHANDLE_LOCK(session,
+ locked = false;
+ exclusive = FLD_ISSET(open_flags, WT_DHANDLE_EXCLUSIVE);
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, uri, exclusive, &lsm_tree));
WT_RET(ret);
@@ -1410,7 +1411,7 @@ __wt_lsm_tree_worker(WT_SESSION_IMPL *session,
WT_ERR(exclusive ?
__wt_lsm_tree_writelock(session, lsm_tree) :
__wt_lsm_tree_readlock(session, lsm_tree));
- locked = 1;
+ locked = true;
for (i = 0; i < lsm_tree->nchunks; i++) {
chunk = lsm_tree->chunk[i];
if (file_func == __wt_checkpoint &&
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_work_unit.c b/src/third_party/wiredtiger/src/lsm/lsm_work_unit.c
index 3e0fd43d404..48c7bc31d7c 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_work_unit.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_work_unit.c
@@ -19,7 +19,7 @@ static int __lsm_discard_handle(WT_SESSION_IMPL *, const char *, const char *);
*/
static int
__lsm_copy_chunks(WT_SESSION_IMPL *session,
- WT_LSM_TREE *lsm_tree, WT_LSM_WORKER_COOKIE *cookie, int old_chunks)
+ WT_LSM_TREE *lsm_tree, WT_LSM_WORKER_COOKIE *cookie, bool old_chunks)
{
WT_DECL_RET;
u_int i, nchunks;
@@ -68,7 +68,7 @@ err: WT_TRET(__wt_lsm_tree_readunlock(session, lsm_tree));
*/
int
__wt_lsm_get_chunk_to_flush(WT_SESSION_IMPL *session,
- WT_LSM_TREE *lsm_tree, int force, WT_LSM_CHUNK **chunkp)
+ WT_LSM_TREE *lsm_tree, bool force, WT_LSM_CHUNK **chunkp)
{
WT_DECL_RET;
WT_LSM_CHUNK *chunk, *evict_chunk, *flush_chunk;
@@ -157,14 +157,14 @@ __lsm_unpin_chunks(WT_SESSION_IMPL *session, WT_LSM_WORKER_COOKIE *cookie)
*/
int
__wt_lsm_work_switch(
- WT_SESSION_IMPL *session, WT_LSM_WORK_UNIT **entryp, int *ran)
+ WT_SESSION_IMPL *session, WT_LSM_WORK_UNIT **entryp, bool *ran)
{
WT_DECL_RET;
WT_LSM_WORK_UNIT *entry;
/* We've become responsible for freeing the work unit. */
entry = *entryp;
- *ran = 0;
+ *ran = false;
*entryp = NULL;
if (F_ISSET(entry->lsm_tree, WT_LSM_TREE_NEED_SWITCH)) {
@@ -177,7 +177,7 @@ __wt_lsm_work_switch(
WT_LSM_WORK_SWITCH, 0, entry->lsm_tree));
ret = 0;
} else
- *ran = 1;
+ *ran = true;
}
err: __wt_lsm_manager_free_work_unit(session, entry);
return (ret);
@@ -198,7 +198,7 @@ __wt_lsm_work_bloom(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
WT_CLEAR(cookie);
- WT_RET(__lsm_copy_chunks(session, lsm_tree, &cookie, 0));
+ WT_RET(__lsm_copy_chunks(session, lsm_tree, &cookie, false));
/* Create bloom filters in all checkpointed chunks. */
merge = 0;
@@ -281,7 +281,7 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session,
}
/* Stop if a running transaction needs the chunk. */
- __wt_txn_update_oldest(session, 1);
+ __wt_txn_update_oldest(session, true);
if (chunk->switch_txn == WT_TXN_NONE ||
!__wt_txn_visible_all(session, chunk->switch_txn)) {
WT_RET(__wt_verbose(session, WT_VERB_LSM,
@@ -337,7 +337,7 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session,
++lsm_tree->dsk_gen;
/* Update the throttle time. */
- __wt_lsm_tree_throttle(session, lsm_tree, 1);
+ __wt_lsm_tree_throttle(session, lsm_tree, true);
WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree));
if (ret != 0)
@@ -350,7 +350,7 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session,
* forced eviction.
*/
WT_RET(__wt_session_get_btree(session, chunk->uri, NULL, NULL, 0));
- __wt_btree_evictable(session, 1);
+ __wt_btree_evictable(session, true);
WT_RET(__wt_session_release_btree(session));
/* Make sure we aren't pinning a transaction ID. */
@@ -472,7 +472,7 @@ __lsm_discard_handle(
WT_DECL_RET;
WT_WITH_SCHEMA_LOCK(session,
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __lsm_discard_handle_internal(session, uri, checkpoint)));
return (ret);
@@ -530,9 +530,10 @@ __wt_lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
WT_LSM_CHUNK *chunk;
WT_LSM_WORKER_COOKIE cookie;
u_int i, skipped;
- int flush_metadata, drop_ret;
+ int drop_ret;
+ bool flush_metadata;
- flush_metadata = 0;
+ flush_metadata = false;
if (lsm_tree->nold_chunks == 0)
return (0);
@@ -554,7 +555,7 @@ __wt_lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
* one to keep the non-NULL slots at the beginning of the array.
*/
WT_CLEAR(cookie);
- WT_RET(__lsm_copy_chunks(session, lsm_tree, &cookie, 1));
+ WT_RET(__lsm_copy_chunks(session, lsm_tree, &cookie, true));
for (i = skipped = 0; i < cookie.nchunks; i++) {
chunk = cookie.chunk_array[i];
WT_ASSERT(session, chunk != NULL);
@@ -571,7 +572,7 @@ __wt_lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
* prevents us from removing a file that hot backup already
* knows about.
*/
- if (S2C(session)->hot_backup != 0)
+ if (S2C(session)->hot_backup)
break;
/*
@@ -591,7 +592,7 @@ __wt_lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
} else if (drop_ret != ENOENT)
WT_ERR(drop_ret);
- flush_metadata = 1;
+ flush_metadata = true;
F_CLR(chunk, WT_LSM_CHUNK_BLOOM);
}
if (chunk->uri != NULL) {
@@ -601,7 +602,7 @@ __wt_lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
continue;
} else if (drop_ret != ENOENT)
WT_ERR(drop_ret);
- flush_metadata = 1;
+ flush_metadata = true;
}
/* Lock the tree to clear out the old chunk information. */
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_worker.c b/src/third_party/wiredtiger/src/lsm/lsm_worker.c
index 252523c5c57..fcf35261604 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_worker.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_worker.c
@@ -9,7 +9,7 @@
#include "wt_internal.h"
static int __lsm_worker_general_op(
- WT_SESSION_IMPL *, WT_LSM_WORKER_ARGS *, int *);
+ WT_SESSION_IMPL *, WT_LSM_WORKER_ARGS *, bool *);
static WT_THREAD_RET __lsm_worker(void *);
/*
@@ -30,14 +30,14 @@ __wt_lsm_worker_start(WT_SESSION_IMPL *session, WT_LSM_WORKER_ARGS *args)
*/
static int
__lsm_worker_general_op(
- WT_SESSION_IMPL *session, WT_LSM_WORKER_ARGS *cookie, int *completed)
+ WT_SESSION_IMPL *session, WT_LSM_WORKER_ARGS *cookie, bool *completed)
{
WT_DECL_RET;
WT_LSM_CHUNK *chunk;
WT_LSM_WORK_UNIT *entry;
- int force;
+ bool force;
- *completed = 0;
+ *completed = false;
/*
* Return if this thread cannot process a bloom, drop or flush.
*/
@@ -72,7 +72,7 @@ __lsm_worker_general_op(
WT_ERR(__wt_lsm_free_chunks(session, entry->lsm_tree));
else if (entry->type == WT_LSM_WORK_BLOOM)
WT_ERR(__wt_lsm_work_bloom(session, entry->lsm_tree));
- *completed = 1;
+ *completed = true;
err: __wt_lsm_manager_free_work_unit(session, entry);
return (ret);
@@ -90,7 +90,7 @@ __lsm_worker(void *arg)
WT_LSM_WORK_UNIT *entry;
WT_LSM_WORKER_ARGS *cookie;
WT_SESSION_IMPL *session;
- int progress, ran;
+ bool progress, ran;
cookie = (WT_LSM_WORKER_ARGS *)arg;
session = cookie->session;
@@ -99,7 +99,7 @@ __lsm_worker(void *arg)
entry = NULL;
while (F_ISSET(conn, WT_CONN_SERVER_RUN) &&
F_ISSET(cookie, WT_LSM_WORKER_RUN)) {
- progress = 0;
+ progress = false;
/*
* Workers process the different LSM work queues. Some workers
@@ -148,7 +148,7 @@ __lsm_worker(void *arg)
__wt_lsm_manager_free_work_unit(session, entry);
entry = NULL;
- progress = 1;
+ progress = true;
}
/* Flag an error if the pop failed. */
WT_ERR(ret);
diff --git a/src/third_party/wiredtiger/src/meta/meta_apply.c b/src/third_party/wiredtiger/src/meta/meta_apply.c
index 6d08ce3aa6a..053870ba623 100644
--- a/src/third_party/wiredtiger/src/meta/meta_apply.c
+++ b/src/third_party/wiredtiger/src/meta/meta_apply.c
@@ -46,8 +46,8 @@ __wt_meta_btree_apply(WT_SESSION_IMPL *session,
WT_SAVE_DHANDLE(session,
ret = func(session, cfg));
if (WT_META_TRACKING(session))
- WT_TRET(
- __wt_meta_track_handle_lock(session, 0));
+ WT_TRET(__wt_meta_track_handle_lock(
+ session, false));
else
WT_TRET(__wt_session_release_btree(session));
} else if (ret == EBUSY)
diff --git a/src/third_party/wiredtiger/src/meta/meta_table.c b/src/third_party/wiredtiger/src/meta/meta_table.c
index eae0079effd..fde7ccd625e 100644
--- a/src/third_party/wiredtiger/src/meta/meta_table.c
+++ b/src/third_party/wiredtiger/src/meta/meta_table.c
@@ -12,22 +12,22 @@
* __metadata_turtle --
* Return if a key's value should be taken from the turtle file.
*/
-static int
+static bool
__metadata_turtle(const char *key)
{
switch (key[0]) {
case 'f':
if (strcmp(key, WT_METAFILE_URI) == 0)
- return (1);
+ return (true);
break;
case 'W':
if (strcmp(key, "WiredTiger version") == 0)
- return (1);
+ return (true);
if (strcmp(key, "WiredTiger version string") == 0)
- return (1);
+ return (true);
break;
}
- return (0);
+ return (false);
}
/*
diff --git a/src/third_party/wiredtiger/src/meta/meta_track.c b/src/third_party/wiredtiger/src/meta/meta_track.c
index 189a095ae74..ff1173585b4 100644
--- a/src/third_party/wiredtiger/src/meta/meta_track.c
+++ b/src/third_party/wiredtiger/src/meta/meta_track.c
@@ -25,7 +25,7 @@ typedef struct __wt_meta_track {
} op;
char *a, *b; /* Strings */
WT_DATA_HANDLE *dhandle; /* Locked handle */
- int created; /* Handle on newly created file */
+ bool created; /* Handle on newly created file */
} WT_META_TRACK;
/*
@@ -257,7 +257,7 @@ __wt_meta_track_find_handle(
* Turn off metadata operation tracking, unrolling on error.
*/
int
-__wt_meta_track_off(WT_SESSION_IMPL *session, int need_sync, int unroll)
+__wt_meta_track_off(WT_SESSION_IMPL *session, bool need_sync, bool unroll)
{
WT_DECL_RET;
WT_META_TRACK *trk, *trk_orig;
@@ -300,8 +300,8 @@ __wt_meta_track_off(WT_SESSION_IMPL *session, int need_sync, int unroll)
/* If we're logging, make sure the metadata update was flushed. */
if (FLD_ISSET(S2C(session)->log_flags, WT_CONN_LOG_ENABLED)) {
WT_WITH_DHANDLE(session, session->meta_dhandle,
- ret = __wt_txn_checkpoint_log(session,
- 0, WT_TXN_LOG_CKPT_SYNC, NULL));
+ ret = __wt_txn_checkpoint_log(
+ session, false, WT_TXN_LOG_CKPT_SYNC, NULL));
WT_RET(ret);
} else {
WT_WITH_DHANDLE(session, session->meta_dhandle,
@@ -460,7 +460,7 @@ __wt_meta_track_drop(
* Track a locked handle.
*/
int
-__wt_meta_track_handle_lock(WT_SESSION_IMPL *session, int created)
+__wt_meta_track_handle_lock(WT_SESSION_IMPL *session, bool created)
{
WT_META_TRACK *trk;
diff --git a/src/third_party/wiredtiger/src/meta/meta_turtle.c b/src/third_party/wiredtiger/src/meta/meta_turtle.c
index 7e3ac3530f8..0378d8a410c 100644
--- a/src/third_party/wiredtiger/src/meta/meta_turtle.c
+++ b/src/third_party/wiredtiger/src/meta/meta_turtle.c
@@ -72,7 +72,7 @@ __metadata_load_hot_backup(WT_SESSION_IMPL *session)
WT_DECL_ITEM(key);
WT_DECL_ITEM(value);
WT_DECL_RET;
- int exist;
+ bool exist;
/* Look for a hot backup file: if we find it, load it. */
WT_RET(__wt_exist(session, WT_METADATA_BACKUP, &exist));
@@ -112,7 +112,7 @@ __metadata_load_bulk(WT_SESSION_IMPL *session)
WT_CURSOR *cursor;
WT_DECL_RET;
uint32_t allocsize;
- int exist;
+ bool exist;
const char *filecfg[] = { WT_CONFIG_BASE(session, file_meta), NULL };
const char *key;
@@ -155,7 +155,7 @@ int
__wt_turtle_init(WT_SESSION_IMPL *session)
{
WT_DECL_RET;
- int exist, exist_incr;
+ bool exist, exist_incr;
char *metaconf;
metaconf = NULL;
@@ -222,7 +222,7 @@ __wt_turtle_read(WT_SESSION_IMPL *session, const char *key, char **valuep)
FILE *fp;
WT_DECL_ITEM(buf);
WT_DECL_RET;
- int exist, match;
+ bool exist, match;
*valuep = NULL;
@@ -241,12 +241,12 @@ __wt_turtle_read(WT_SESSION_IMPL *session, const char *key, char **valuep)
/* Search for the key. */
WT_ERR(__wt_scr_alloc(session, 512, &buf));
- for (match = 0;;) {
+ for (match = false;;) {
WT_ERR(__wt_getline(session, buf, fp));
if (buf->size == 0)
WT_ERR(WT_NOTFOUND);
if (strcmp(key, buf->data) == 0)
- match = 1;
+ match = true;
/* Key matched: read the subsequent line for the value. */
WT_ERR(__wt_getline(session, buf, fp));
@@ -284,8 +284,8 @@ __wt_turtle_update(
* Create the turtle setup file: we currently re-write it from scratch
* every time.
*/
- WT_RET(__wt_open(
- session, WT_METADATA_TURTLE_SET, 1, 1, WT_FILE_TYPE_TURTLE, &fh));
+ WT_RET(__wt_open(session,
+ WT_METADATA_TURTLE_SET, true, true, WT_FILE_TYPE_TURTLE, &fh));
version = wiredtiger_version(&vmajor, &vminor, &vpatch);
WT_ERR(__wt_scr_alloc(session, 2 * 1024, &buf));
diff --git a/src/third_party/wiredtiger/src/os_posix/os_dir.c b/src/third_party/wiredtiger/src/os_posix/os_dir.c
index 5bf6e7349fe..9eba641ca51 100644
--- a/src/third_party/wiredtiger/src/os_posix/os_dir.c
+++ b/src/third_party/wiredtiger/src/os_posix/os_dir.c
@@ -24,7 +24,7 @@ __wt_dirlist(WT_SESSION_IMPL *session, const char *dir, const char *prefix,
WT_DECL_RET;
size_t dirallocsz;
u_int count, dirsz;
- int match;
+ bool match;
char **entries, *path;
*dirlist = NULL;
@@ -54,13 +54,13 @@ __wt_dirlist(WT_SESSION_IMPL *session, const char *dir, const char *prefix,
if (strcmp(dp->d_name, ".") == 0 ||
strcmp(dp->d_name, "..") == 0)
continue;
- match = 0;
+ match = false;
if (prefix != NULL &&
((LF_ISSET(WT_DIRLIST_INCLUDE) &&
WT_PREFIX_MATCH(dp->d_name, prefix)) ||
(LF_ISSET(WT_DIRLIST_EXCLUDE) &&
!WT_PREFIX_MATCH(dp->d_name, prefix))))
- match = 1;
+ match = true;
if (prefix == NULL || match) {
/*
* We have a file name we want to return.
diff --git a/src/third_party/wiredtiger/src/os_posix/os_dlopen.c b/src/third_party/wiredtiger/src/os_posix/os_dlopen.c
index a468e7ab49d..2b5fa249163 100644
--- a/src/third_party/wiredtiger/src/os_posix/os_dlopen.c
+++ b/src/third_party/wiredtiger/src/os_posix/os_dlopen.c
@@ -39,7 +39,7 @@ err: __wt_free(session, dlh->name);
*/
int
__wt_dlsym(WT_SESSION_IMPL *session,
- WT_DLH *dlh, const char *name, int fail, void *sym_ret)
+ WT_DLH *dlh, const char *name, bool fail, void *sym_ret)
{
void *sym;
diff --git a/src/third_party/wiredtiger/src/os_posix/os_exist.c b/src/third_party/wiredtiger/src/os_posix/os_exist.c
index 173021e6100..644a27dca9a 100644
--- a/src/third_party/wiredtiger/src/os_posix/os_exist.c
+++ b/src/third_party/wiredtiger/src/os_posix/os_exist.c
@@ -13,13 +13,13 @@
* Return if the file exists.
*/
int
-__wt_exist(WT_SESSION_IMPL *session, const char *filename, int *existp)
+__wt_exist(WT_SESSION_IMPL *session, const char *filename, bool *existp)
{
struct stat sb;
WT_DECL_RET;
char *path;
- *existp = 0;
+ *existp = false;
WT_RET(__wt_filename(session, filename, &path));
@@ -28,7 +28,7 @@ __wt_exist(WT_SESSION_IMPL *session, const char *filename, int *existp)
__wt_free(session, path);
if (ret == 0) {
- *existp = 1;
+ *existp = true;
return (0);
}
if (ret == ENOENT)
diff --git a/src/third_party/wiredtiger/src/os_posix/os_fallocate.c b/src/third_party/wiredtiger/src/os_posix/os_fallocate.c
index 142374702a1..20a9e8236ac 100644
--- a/src/third_party/wiredtiger/src/os_posix/os_fallocate.c
+++ b/src/third_party/wiredtiger/src/os_posix/os_fallocate.c
@@ -22,7 +22,7 @@ __wt_fallocate_config(WT_SESSION_IMPL *session, WT_FH *fh)
WT_UNUSED(session);
fh->fallocate_available = WT_FALLOCATE_NOT_AVAILABLE;
- fh->fallocate_requires_locking = 0;
+ fh->fallocate_requires_locking = false;
/*
* Check for the availability of some form of fallocate; in all cases,
@@ -31,11 +31,11 @@ __wt_fallocate_config(WT_SESSION_IMPL *session, WT_FH *fh)
*/
#if defined(HAVE_FALLOCATE) || defined(HAVE_POSIX_FALLOCATE)
fh->fallocate_available = WT_FALLOCATE_AVAILABLE;
- fh->fallocate_requires_locking = 1;
+ fh->fallocate_requires_locking = true;
#endif
#if defined(__linux__) && defined(SYS_fallocate)
fh->fallocate_available = WT_FALLOCATE_AVAILABLE;
- fh->fallocate_requires_locking = 1;
+ fh->fallocate_requires_locking = true;
#endif
}
@@ -155,18 +155,18 @@ __wt_fallocate(
*/
if ((ret = __wt_std_fallocate(fh, offset, len)) == 0) {
fh->fallocate_available = WT_FALLOCATE_STD;
- fh->fallocate_requires_locking = 0;
+ fh->fallocate_requires_locking = false;
return (0);
}
if ((ret = __wt_sys_fallocate(fh, offset, len)) == 0) {
fh->fallocate_available = WT_FALLOCATE_SYS;
- fh->fallocate_requires_locking = 0;
+ fh->fallocate_requires_locking = false;
return (0);
}
if ((ret = __wt_posix_fallocate(fh, offset, len)) == 0) {
fh->fallocate_available = WT_FALLOCATE_POSIX;
#if !defined(__linux__)
- fh->fallocate_requires_locking = 0;
+ fh->fallocate_requires_locking = false;
#endif
return (0);
}
diff --git a/src/third_party/wiredtiger/src/os_posix/os_flock.c b/src/third_party/wiredtiger/src/os_posix/os_flock.c
index 69cd367dde3..07393481e7d 100644
--- a/src/third_party/wiredtiger/src/os_posix/os_flock.c
+++ b/src/third_party/wiredtiger/src/os_posix/os_flock.c
@@ -13,7 +13,7 @@
* Lock/unlock a byte in a file.
*/
int
-__wt_bytelock(WT_FH *fhp, wt_off_t byte, int lock)
+__wt_bytelock(WT_FH *fhp, wt_off_t byte, bool lock)
{
struct flock fl;
WT_DECL_RET;
diff --git a/src/third_party/wiredtiger/src/os_posix/os_mtx_cond.c b/src/third_party/wiredtiger/src/os_posix/os_mtx_cond.c
index baf9b475777..79f9e4959f7 100644
--- a/src/third_party/wiredtiger/src/os_posix/os_mtx_cond.c
+++ b/src/third_party/wiredtiger/src/os_posix/os_mtx_cond.c
@@ -14,7 +14,7 @@
*/
int
__wt_cond_alloc(WT_SESSION_IMPL *session,
- const char *name, int is_signalled, WT_CONDVAR **condp)
+ const char *name, bool is_signalled, WT_CONDVAR **condp)
{
WT_CONDVAR *cond;
WT_DECL_RET;
@@ -49,9 +49,9 @@ __wt_cond_wait(WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs)
{
struct timespec ts;
WT_DECL_RET;
- int locked;
+ bool locked;
- locked = 0;
+ locked = false;
/* Fast path if already signalled. */
if (__wt_atomic_addi32(&cond->waiters, 1) == 0)
@@ -68,7 +68,7 @@ __wt_cond_wait(WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs)
}
WT_ERR(pthread_mutex_lock(&cond->mtx));
- locked = 1;
+ locked = true;
if (usecs > 0) {
WT_ERR(__wt_epoch(session, &ts));
@@ -108,9 +108,9 @@ int
__wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond)
{
WT_DECL_RET;
- int locked;
+ bool locked;
- locked = 0;
+ locked = false;
/*
* !!!
@@ -126,7 +126,7 @@ __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond)
if (cond->waiters > 0 || !__wt_atomic_casi32(&cond->waiters, 0, -1)) {
WT_ERR(pthread_mutex_lock(&cond->mtx));
- locked = 1;
+ locked = true;
WT_ERR(pthread_cond_broadcast(&cond->cond));
}
diff --git a/src/third_party/wiredtiger/src/os_posix/os_open.c b/src/third_party/wiredtiger/src/os_posix/os_open.c
index 1453f1a666d..dc0e9293fb8 100644
--- a/src/third_party/wiredtiger/src/os_posix/os_open.c
+++ b/src/third_party/wiredtiger/src/os_posix/os_open.c
@@ -30,18 +30,19 @@ __open_directory(WT_SESSION_IMPL *session, char *path, int *fd)
*/
int
__wt_open(WT_SESSION_IMPL *session,
- const char *name, int ok_create, int exclusive, int dio_type, WT_FH **fhp)
+ const char *name, bool ok_create, bool exclusive, int dio_type, WT_FH **fhp)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
WT_FH *fh, *tfh;
mode_t mode;
uint64_t bucket, hash;
- int direct_io, f, fd, matched;
+ int f, fd;
+ bool direct_io, matched;
char *path;
conn = S2C(session);
- direct_io = 0;
+ direct_io = false;
fh = NULL;
fd = -1;
path = NULL;
@@ -49,7 +50,7 @@ __wt_open(WT_SESSION_IMPL *session,
WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: open", name));
/* Increment the reference count if we already have the file open. */
- matched = 0;
+ matched = false;
hash = __wt_hash_city64(name, strlen(name));
bucket = hash % WT_HASH_ARRAY_SIZE;
__wt_spin_lock(session, &conn->fh_lock);
@@ -57,7 +58,7 @@ __wt_open(WT_SESSION_IMPL *session,
if (strcmp(name, tfh->name) == 0) {
++tfh->ref;
*fhp = tfh;
- matched = 1;
+ matched = true;
break;
}
}
@@ -103,7 +104,7 @@ __wt_open(WT_SESSION_IMPL *session,
#ifdef O_DIRECT
if (dio_type && FLD_ISSET(conn->direct_io, dio_type)) {
f |= O_DIRECT;
- direct_io = 1;
+ direct_io = true;
}
#endif
if (dio_type == WT_FILE_TYPE_LOG &&
@@ -165,13 +166,13 @@ setupfh:
* Repeat the check for a match, but then link onto the database's list
* of files.
*/
- matched = 0;
+ matched = false;
__wt_spin_lock(session, &conn->fh_lock);
TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq) {
if (strcmp(name, tfh->name) == 0) {
++tfh->ref;
*fhp = tfh;
- matched = 1;
+ matched = true;
break;
}
}
diff --git a/src/third_party/wiredtiger/src/os_posix/os_path.c b/src/third_party/wiredtiger/src/os_posix/os_path.c
index 07b14b55b44..af28e1b3b56 100644
--- a/src/third_party/wiredtiger/src/os_posix/os_path.c
+++ b/src/third_party/wiredtiger/src/os_posix/os_path.c
@@ -12,10 +12,10 @@
* __wt_absolute_path --
* Return if a filename is an absolute path.
*/
-int
+bool
__wt_absolute_path(const char *path)
{
- return (path[0] == '/' ? 1 : 0);
+ return (path[0] == '/');
}
/*
diff --git a/src/third_party/wiredtiger/src/os_posix/os_priv.c b/src/third_party/wiredtiger/src/os_posix/os_priv.c
index 21549cad957..a8479668d67 100644
--- a/src/third_party/wiredtiger/src/os_posix/os_priv.c
+++ b/src/third_party/wiredtiger/src/os_posix/os_priv.c
@@ -13,7 +13,7 @@
* Return if the process has special privileges, defined as having
* different effective and read UIDs or GIDs.
*/
-int
+bool
__wt_has_priv(void)
{
return (getuid() != geteuid() || getgid() != getegid());
diff --git a/src/third_party/wiredtiger/src/os_win/os_dir.c b/src/third_party/wiredtiger/src/os_win/os_dir.c
index 33489bc2497..aff916c25f5 100644
--- a/src/third_party/wiredtiger/src/os_win/os_dir.c
+++ b/src/third_party/wiredtiger/src/os_win/os_dir.c
@@ -23,7 +23,7 @@ __wt_dirlist(WT_SESSION_IMPL *session, const char *dir, const char *prefix,
WT_DECL_RET;
size_t dirallocsz, pathlen;
u_int count, dirsz;
- int match;
+ bool match;
char **entries, *path;
*dirlist = NULL;
@@ -66,13 +66,13 @@ __wt_dirlist(WT_SESSION_IMPL *session, const char *dir, const char *prefix,
if (strcmp(finddata.cFileName, ".") == 0 ||
strcmp(finddata.cFileName, "..") == 0)
continue;
- match = 0;
+ match = false;
if (prefix != NULL &&
((LF_ISSET(WT_DIRLIST_INCLUDE) &&
WT_PREFIX_MATCH(finddata.cFileName, prefix)) ||
(LF_ISSET(WT_DIRLIST_EXCLUDE) &&
!WT_PREFIX_MATCH(finddata.cFileName, prefix))))
- match = 1;
+ match = true;
if (prefix == NULL || match) {
/*
* We have a file name we want to return.
diff --git a/src/third_party/wiredtiger/src/os_win/os_dlopen.c b/src/third_party/wiredtiger/src/os_win/os_dlopen.c
index 0337c7cc368..3b200811aca 100644
--- a/src/third_party/wiredtiger/src/os_win/os_dlopen.c
+++ b/src/third_party/wiredtiger/src/os_win/os_dlopen.c
@@ -49,7 +49,7 @@ err: __wt_free(session, dlh->name);
*/
int
__wt_dlsym(WT_SESSION_IMPL *session,
- WT_DLH *dlh, const char *name, int fail, void *sym_ret)
+ WT_DLH *dlh, const char *name, bool fail, void *sym_ret)
{
void *sym;
diff --git a/src/third_party/wiredtiger/src/os_win/os_exist.c b/src/third_party/wiredtiger/src/os_win/os_exist.c
index 747ea7dfc27..4a727801569 100644
--- a/src/third_party/wiredtiger/src/os_win/os_exist.c
+++ b/src/third_party/wiredtiger/src/os_win/os_exist.c
@@ -13,7 +13,7 @@
* Return if the file exists.
*/
int
-__wt_exist(WT_SESSION_IMPL *session, const char *filename, int *existp)
+__wt_exist(WT_SESSION_IMPL *session, const char *filename, bool *existp)
{
WT_DECL_RET;
char *path;
@@ -25,9 +25,9 @@ __wt_exist(WT_SESSION_IMPL *session, const char *filename, int *existp)
__wt_free(session, path);
if (ret != INVALID_FILE_ATTRIBUTES)
- *existp = 1;
+ *existp = true;
else
- *existp = 0;
+ *existp = false;
return (0);
}
diff --git a/src/third_party/wiredtiger/src/os_win/os_fallocate.c b/src/third_party/wiredtiger/src/os_win/os_fallocate.c
index e0e7b356896..4b567ec3151 100644
--- a/src/third_party/wiredtiger/src/os_win/os_fallocate.c
+++ b/src/third_party/wiredtiger/src/os_win/os_fallocate.c
@@ -28,7 +28,7 @@ __wt_fallocate_config(WT_SESSION_IMPL *session, WT_FH *fh)
* We use a separate handle for file size changes, so there's no need
* for locking.
*/
- fh->fallocate_requires_locking = 0;
+ fh->fallocate_requires_locking = false;
}
/*
diff --git a/src/third_party/wiredtiger/src/os_win/os_flock.c b/src/third_party/wiredtiger/src/os_win/os_flock.c
index d551480ba4d..947d7bdcde7 100644
--- a/src/third_party/wiredtiger/src/os_win/os_flock.c
+++ b/src/third_party/wiredtiger/src/os_win/os_flock.c
@@ -13,7 +13,7 @@
* Lock/unlock a byte in a file.
*/
int
-__wt_bytelock(WT_FH *fhp, wt_off_t byte, int lock)
+__wt_bytelock(WT_FH *fhp, wt_off_t byte, bool lock)
{
WT_DECL_RET;
diff --git a/src/third_party/wiredtiger/src/os_win/os_mtx_cond.c b/src/third_party/wiredtiger/src/os_win/os_mtx_cond.c
index 565928cb863..90aba6b6fad 100644
--- a/src/third_party/wiredtiger/src/os_win/os_mtx_cond.c
+++ b/src/third_party/wiredtiger/src/os_win/os_mtx_cond.c
@@ -14,7 +14,7 @@
*/
int
__wt_cond_alloc(WT_SESSION_IMPL *session,
- const char *name, int is_signalled, WT_CONDVAR **condp)
+ const char *name, bool is_signalled, WT_CONDVAR **condp)
{
WT_CONDVAR *cond;
@@ -46,9 +46,9 @@ __wt_cond_wait(WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs)
DWORD milliseconds;
WT_DECL_RET;
uint64_t milliseconds64;
- int locked;
+ bool locked;
- locked = 0;
+ locked = false;
/* Fast path if already signalled. */
if (__wt_atomic_addi32(&cond->waiters, 1) == 0)
@@ -65,7 +65,7 @@ __wt_cond_wait(WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs)
}
EnterCriticalSection(&cond->mtx);
- locked = 1;
+ locked = true;
if (usecs > 0) {
milliseconds64 = usecs / 1000;
@@ -114,9 +114,9 @@ int
__wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond)
{
WT_DECL_RET;
- int locked;
+ bool locked;
- locked = 0;
+ locked = false;
/*
* !!!
@@ -132,7 +132,7 @@ __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond)
if (cond->waiters > 0 || !__wt_atomic_casi32(&cond->waiters, 0, -1)) {
EnterCriticalSection(&cond->mtx);
- locked = 1;
+ locked = true;
WakeAllConditionVariable(&cond->cond);
}
diff --git a/src/third_party/wiredtiger/src/os_win/os_open.c b/src/third_party/wiredtiger/src/os_win/os_open.c
index 3bd24369242..c7b30408e63 100644
--- a/src/third_party/wiredtiger/src/os_win/os_open.c
+++ b/src/third_party/wiredtiger/src/os_win/os_open.c
@@ -14,7 +14,7 @@
*/
int
__wt_open(WT_SESSION_IMPL *session,
- const char *name, int ok_create, int exclusive, int dio_type, WT_FH **fhp)
+ const char *name, bool ok_create, bool exclusive, int dio_type, WT_FH **fhp)
{
DWORD dwCreationDisposition;
HANDLE filehandle, filehandle_secondary;
@@ -22,7 +22,8 @@ __wt_open(WT_SESSION_IMPL *session,
WT_DECL_RET;
WT_FH *fh, *tfh;
uint64_t bucket, hash;
- int direct_io, f, matched, share_mode;
+ int f, share_mode;
+ bool direct_io, matched;
char *path;
conn = S2C(session);
@@ -30,20 +31,20 @@ __wt_open(WT_SESSION_IMPL *session,
path = NULL;
filehandle = INVALID_HANDLE_VALUE;
filehandle_secondary = INVALID_HANDLE_VALUE;
- direct_io = 0;
+ direct_io = false;
hash = __wt_hash_city64(name, strlen(name));
bucket = hash % WT_HASH_ARRAY_SIZE;
WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: open", name));
/* Increment the reference count if we already have the file open. */
- matched = 0;
+ matched = false;
__wt_spin_lock(session, &conn->fh_lock);
TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq)
if (strcmp(name, tfh->name) == 0) {
++tfh->ref;
*fhp = tfh;
- matched = 1;
+ matched = true;
break;
}
__wt_spin_unlock(session, &conn->fh_lock);
@@ -79,7 +80,7 @@ __wt_open(WT_SESSION_IMPL *session,
if (dio_type && FLD_ISSET(conn->direct_io, dio_type)) {
f |= FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH;
- direct_io = 1;
+ direct_io = true;
}
if (dio_type == WT_FILE_TYPE_LOG &&
@@ -158,13 +159,13 @@ setupfh:
* Repeat the check for a match, but then link onto the database's list
* of files.
*/
- matched = 0;
+ matched = false;
__wt_spin_lock(session, &conn->fh_lock);
TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq)
if (strcmp(name, tfh->name) == 0) {
++tfh->ref;
*fhp = tfh;
- matched = 1;
+ matched = true;
break;
}
if (!matched) {
diff --git a/src/third_party/wiredtiger/src/os_win/os_path.c b/src/third_party/wiredtiger/src/os_win/os_path.c
index 89f05e238c4..9d001e50571 100644
--- a/src/third_party/wiredtiger/src/os_win/os_path.c
+++ b/src/third_party/wiredtiger/src/os_win/os_path.c
@@ -12,7 +12,7 @@
* __wt_absolute_path --
* Return if a filename is an absolute path.
*/
-int
+bool
__wt_absolute_path(const char *path)
{
/*
@@ -21,7 +21,7 @@ __wt_absolute_path(const char *path)
*/
if (strlen(path) >= 3 && isalpha(path[0]) && path[1] == ':')
path += 2;
- return (path[0] == '/' || path[0] == '\\' ? 1 : 0);
+ return (path[0] == '/' || path[0] == '\\');
}
/*
diff --git a/src/third_party/wiredtiger/src/os_win/os_priv.c b/src/third_party/wiredtiger/src/os_win/os_priv.c
index b5dc1eb55fe..5c32d6b5999 100644
--- a/src/third_party/wiredtiger/src/os_win/os_priv.c
+++ b/src/third_party/wiredtiger/src/os_win/os_priv.c
@@ -13,7 +13,7 @@
* Return if the process has special privileges, defined as having
* different effective and read UIDs or GIDs.
*/
-int
+bool
__wt_has_priv(void)
{
return (0);
diff --git a/src/third_party/wiredtiger/src/packing/pack_impl.c b/src/third_party/wiredtiger/src/packing/pack_impl.c
index c92325a4c23..3a4428eae15 100644
--- a/src/third_party/wiredtiger/src/packing/pack_impl.c
+++ b/src/third_party/wiredtiger/src/packing/pack_impl.c
@@ -15,7 +15,7 @@
*/
int
__wt_struct_check(WT_SESSION_IMPL *session,
- const char *fmt, size_t len, int *fixedp, uint32_t *fixed_lenp)
+ const char *fmt, size_t len, bool *fixedp, uint32_t *fixed_lenp)
{
WT_DECL_PACK_VALUE(pv);
WT_DECL_RET;
diff --git a/src/third_party/wiredtiger/src/reconcile/rec_track.c b/src/third_party/wiredtiger/src/reconcile/rec_track.c
index df170cec470..36e85713421 100644
--- a/src/third_party/wiredtiger/src/reconcile/rec_track.c
+++ b/src/third_party/wiredtiger/src/reconcile/rec_track.c
@@ -722,7 +722,7 @@ __ovfl_txnc_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page)
*/
for (i = WT_SKIP_MAXDEPTH - 1; i > 0; --i)
for (e = &head[i]; (txnc = *e) != NULL;) {
- if (TXNID_LE(oldest_txn, txnc->current)) {
+ if (WT_TXNID_LE(oldest_txn, txnc->current)) {
e = &txnc->next[i];
continue;
}
@@ -732,7 +732,7 @@ __ovfl_txnc_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page)
/* Second, discard any no longer needed transaction-cache records. */
decr = 0;
for (e = &head[0]; (txnc = *e) != NULL;) {
- if (TXNID_LE(oldest_txn, txnc->current)) {
+ if (WT_TXNID_LE(oldest_txn, txnc->current)) {
e = &txnc->next[0];
continue;
}
diff --git a/src/third_party/wiredtiger/src/reconcile/rec_write.c b/src/third_party/wiredtiger/src/reconcile/rec_write.c
index eaaa3a56be3..988b7e0a84f 100644
--- a/src/third_party/wiredtiger/src/reconcile/rec_write.c
+++ b/src/third_party/wiredtiger/src/reconcile/rec_write.c
@@ -38,7 +38,7 @@ typedef struct {
* the page cannot be discarded and a subsequent reconciliation will
* be necessary to discard the page.
*/
- int leave_dirty;
+ bool leave_dirty;
/*
* Raw compression (don't get me started, as if normal reconciliation
@@ -49,7 +49,7 @@ typedef struct {
* a lot of work, we turn off most compression: dictionary, copy-cell,
* prefix and row-store internal page suffix compression are all off.
*/
- int raw_compression;
+ bool raw_compression;
uint32_t raw_max_slots; /* Raw compression array sizes */
uint32_t *raw_entries; /* Raw compression slot entries */
uint32_t *raw_offsets; /* Raw compression slot offsets */
@@ -74,7 +74,7 @@ typedef struct {
* figure out if the rows selected by raw compression included overflow
* items, and the optimization isn't worth another pass over the data.
*/
- int ovfl_items;
+ bool ovfl_items;
/*
* Track if reconciliation of a row-store leaf page has seen empty (zero
@@ -89,7 +89,7 @@ typedef struct {
* The test is per-page reconciliation as described above for the
* overflow-item test.
*/
- int all_empty_value, any_empty_value;
+ bool all_empty_value, any_empty_value;
/*
* Reconciliation gets tricky if we have to split a page, which happens
@@ -178,7 +178,7 @@ typedef struct {
* final block as part of a checkpoint. If raw compression
* was configured, that block may have already been compressed.
*/
- int already_compressed;
+ bool already_compressed;
} *bnd; /* Saved boundaries */
uint32_t bnd_next; /* Next boundary slot */
uint32_t bnd_next_max; /* Maximum boundary slots used */
@@ -233,7 +233,7 @@ typedef struct {
* There's some trickiness here, see the code for comments on how
* these fields work.
*/
- int cell_zero; /* Row-store internal page 0th key */
+ bool cell_zero; /* Row-store internal page 0th key */
/*
* WT_DICTIONARY --
@@ -268,31 +268,29 @@ typedef struct {
WT_ITEM *cur, _cur; /* Key/Value being built */
WT_ITEM *last, _last; /* Last key/value built */
- int key_pfx_compress; /* If can prefix-compress next key */
- int key_pfx_compress_conf; /* If prefix compression configured */
- int key_sfx_compress; /* If can suffix-compress next key */
- int key_sfx_compress_conf; /* If suffix compression configured */
+ bool key_pfx_compress; /* If can prefix-compress next key */
+ bool key_pfx_compress_conf; /* If prefix compression configured */
+ bool key_sfx_compress; /* If can suffix-compress next key */
+ bool key_sfx_compress_conf; /* If suffix compression configured */
- int is_bulk_load; /* If it's a bulk load */
+ bool is_bulk_load; /* If it's a bulk load */
WT_SALVAGE_COOKIE *salvage; /* If it's a salvage operation */
uint32_t tested_ref_state; /* Debugging information */
} WT_RECONCILE;
-static void __rec_bnd_cleanup(WT_SESSION_IMPL *, WT_RECONCILE *, int);
+static void __rec_bnd_cleanup(WT_SESSION_IMPL *, WT_RECONCILE *, bool);
static void __rec_cell_build_addr(
WT_RECONCILE *, const void *, size_t, u_int, uint64_t);
static int __rec_cell_build_int_key(WT_SESSION_IMPL *,
- WT_RECONCILE *, const void *, size_t, int *);
+ WT_RECONCILE *, const void *, size_t, bool *);
static int __rec_cell_build_leaf_key(WT_SESSION_IMPL *,
- WT_RECONCILE *, const void *, size_t, int *);
+ WT_RECONCILE *, const void *, size_t, bool *);
static int __rec_cell_build_ovfl(WT_SESSION_IMPL *,
WT_RECONCILE *, WT_KV *, uint8_t, uint64_t);
static int __rec_cell_build_val(WT_SESSION_IMPL *,
WT_RECONCILE *, const void *, size_t, uint64_t);
-static int __rec_child_deleted(
- WT_SESSION_IMPL *, WT_RECONCILE *, WT_REF *, int *);
static int __rec_col_fix(WT_SESSION_IMPL *, WT_RECONCILE *, WT_PAGE *);
static int __rec_col_fix_slvg(WT_SESSION_IMPL *,
WT_RECONCILE *, WT_PAGE *, WT_SALVAGE_COOKIE *);
@@ -301,7 +299,7 @@ static int __rec_col_merge(WT_SESSION_IMPL *, WT_RECONCILE *, WT_PAGE *);
static int __rec_col_var(WT_SESSION_IMPL *,
WT_RECONCILE *, WT_PAGE *, WT_SALVAGE_COOKIE *);
static int __rec_col_var_helper(WT_SESSION_IMPL *, WT_RECONCILE *,
- WT_SALVAGE_COOKIE *, WT_ITEM *, int, uint8_t, uint64_t);
+ WT_SALVAGE_COOKIE *, WT_ITEM *, bool, uint8_t, uint64_t);
static int __rec_destroy_session(WT_SESSION_IMPL *);
static int __rec_root_write(WT_SESSION_IMPL *, WT_PAGE *, uint32_t);
static int __rec_row_int(WT_SESSION_IMPL *, WT_RECONCILE *, WT_PAGE *);
@@ -317,7 +315,7 @@ static int __rec_split_row(WT_SESSION_IMPL *, WT_RECONCILE *, WT_PAGE *);
static int __rec_split_row_promote(
WT_SESSION_IMPL *, WT_RECONCILE *, WT_ITEM *, uint8_t);
static int __rec_split_write(WT_SESSION_IMPL *,
- WT_RECONCILE *, WT_BOUNDARY *, WT_ITEM *, int);
+ WT_RECONCILE *, WT_BOUNDARY *, WT_ITEM *, bool);
static int __rec_write_init(WT_SESSION_IMPL *,
WT_REF *, uint32_t, WT_SALVAGE_COOKIE *, void *);
static int __rec_write_wrapup(WT_SESSION_IMPL *, WT_RECONCILE *, WT_PAGE *);
@@ -372,7 +370,7 @@ __wt_reconcile(WT_SESSION_IMPL *session,
* reconciliation will need.
*/
uint64_t oldest_id = __wt_txn_oldest_id(session);
- WT_ASSERT(session, TXNID_LE(mod->last_oldest_id, oldest_id));
+ WT_ASSERT(session, WT_TXNID_LE(mod->last_oldest_id, oldest_id));
mod->last_oldest_id = oldest_id;
}
#endif
@@ -465,7 +463,7 @@ __wt_reconcile(WT_SESSION_IMPL *session,
* got roped into doing forced eviction, they won't be discarded for the
* life of the session.
*/
- __rec_bnd_cleanup(session, r, 0);
+ __rec_bnd_cleanup(session, r, false);
WT_RET(ret);
@@ -485,7 +483,7 @@ __wt_reconcile(WT_SESSION_IMPL *session,
* checkpoint, it's cleared the tree's dirty flag, and we don't want to
* set it again as part of that walk.
*/
- return (__wt_page_parent_modify_set(session, ref, 1));
+ return (__wt_page_parent_modify_set(session, ref, true));
}
/*
@@ -512,7 +510,7 @@ __rec_root_write(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t flags)
* write it instead of adding code to write blocks based on the list of
* blocks resulting from a multiblock reconciliation.
*/
- switch (F_ISSET(mod, WT_PM_REC_MASK)) {
+ switch (mod->rec_result) {
case WT_PM_REC_EMPTY: /* Page is empty */
case WT_PM_REC_REPLACE: /* 1-for-1 page swap */
case WT_PM_REC_REWRITE: /* Rewrite */
@@ -532,11 +530,11 @@ __rec_root_write(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t flags)
switch (page->type) {
case WT_PAGE_COL_INT:
WT_RET(__wt_page_alloc(session,
- WT_PAGE_COL_INT, 1, mod->mod_multi_entries, 1, &next));
+ WT_PAGE_COL_INT, 1, mod->mod_multi_entries, false, &next));
break;
case WT_PAGE_ROW_INT:
WT_RET(__wt_page_alloc(session,
- WT_PAGE_ROW_INT, 0, mod->mod_multi_entries, 1, &next));
+ WT_PAGE_ROW_INT, 0, mod->mod_multi_entries, false, &next));
break;
WT_ILLEGAL_VALUE(session);
}
@@ -578,7 +576,7 @@ err: __wt_page_out(session, &next);
* __rec_raw_compression_config --
* Configure raw compression.
*/
-static inline int
+static inline bool
__rec_raw_compression_config(
WT_SESSION_IMPL *session, WT_PAGE *page, WT_SALVAGE_COOKIE *salvage)
{
@@ -589,11 +587,11 @@ __rec_raw_compression_config(
/* Check if raw compression configured. */
if (btree->compressor == NULL ||
btree->compressor->compress_raw == NULL)
- return (0);
+ return (false);
/* Only for row-store and variable-length column-store objects. */
if (page->type == WT_PAGE_COL_FIX)
- return (0);
+ return (false);
/*
* Raw compression cannot support dictionary compression. (Technically,
@@ -603,11 +601,11 @@ __rec_raw_compression_config(
* that seems an unlikely use case.)
*/
if (btree->dictionary != 0)
- return (0);
+ return (false);
/* Raw compression cannot support prefix compression. */
- if (btree->prefix_compression != 0)
- return (0);
+ if (btree->prefix_compression)
+ return (false);
/*
* Raw compression is also turned off during salvage: we can't allow
@@ -615,9 +613,9 @@ __rec_raw_compression_config(
* can't manipulate the page size.
*/
if (salvage != NULL)
- return (0);
+ return (false);
- return (1);
+ return (true);
}
/*
@@ -655,7 +653,7 @@ __rec_write_init(WT_SESSION_IMPL *session,
r->flags = flags;
/* Track if the page can be marked clean. */
- r->leave_dirty = 0;
+ r->leave_dirty = false;
/* Raw compression. */
r->raw_compression =
@@ -663,11 +661,11 @@ __rec_write_init(WT_SESSION_IMPL *session,
r->raw_destination.flags = WT_ITEM_ALIGNED;
/* Track overflow items. */
- r->ovfl_items = 0;
+ r->ovfl_items = false;
/* Track empty values. */
- r->all_empty_value = 1;
- r->any_empty_value = 0;
+ r->all_empty_value = true;
+ r->any_empty_value = false;
/* The list of cached, skipped updates. */
r->skip_next = 0;
@@ -687,6 +685,14 @@ __rec_write_init(WT_SESSION_IMPL *session,
__rec_dictionary_reset(r);
/*
+ * Prefix compression discards repeated prefix bytes from row-store leaf
+ * page keys.
+ */
+ r->key_pfx_compress_conf = false;
+ if (btree->prefix_compression && page->type == WT_PAGE_ROW_LEAF)
+ r->key_pfx_compress_conf = true;
+
+ /*
* Suffix compression shortens internal page keys by discarding trailing
* bytes that aren't necessary for tree navigation. We don't do suffix
* compression if there is a custom collator because we don't know what
@@ -700,18 +706,12 @@ __rec_write_init(WT_SESSION_IMPL *session,
* The raw compression routines don't even consider suffix compression,
* but it doesn't hurt to confirm that.
*/
- r->key_sfx_compress_conf = 0;
+ r->key_sfx_compress_conf = false;
if (btree->collator == NULL &&
btree->internal_key_truncate && !r->raw_compression)
- r->key_sfx_compress_conf = 1;
+ r->key_sfx_compress_conf = true;
- /*
- * Prefix compression discards repeated prefix bytes from row-store leaf
- * page keys.
- */
- r->key_pfx_compress_conf = 0;
- if (btree->prefix_compression && page->type == WT_PAGE_ROW_LEAF)
- r->key_pfx_compress_conf = 1;
+ r->is_bulk_load = false;
r->salvage = salvage;
@@ -747,7 +747,7 @@ __rec_destroy(WT_SESSION_IMPL *session, void *reconcilep)
__wt_free(session, r->raw_recnos);
__wt_buf_free(session, &r->raw_destination);
- __rec_bnd_cleanup(session, r, 1);
+ __rec_bnd_cleanup(session, r, true);
__wt_free(session, r->skip);
@@ -777,7 +777,7 @@ __rec_destroy_session(WT_SESSION_IMPL *session)
* Cleanup the boundary structure information.
*/
static void
-__rec_bnd_cleanup(WT_SESSION_IMPL *session, WT_RECONCILE *r, int destroy)
+__rec_bnd_cleanup(WT_SESSION_IMPL *session, WT_RECONCILE *r, bool destroy)
{
WT_BOUNDARY *bnd;
uint32_t i, last_used;
@@ -877,7 +877,7 @@ __rec_txn_read(WT_SESSION_IMPL *session, WT_RECONCILE *r,
WT_UPDATE *upd, *upd_list, *upd_ovfl;
size_t notused;
uint64_t max_txn, min_txn, txnid;
- int skipped;
+ bool skipped;
*updp = NULL;
@@ -888,7 +888,7 @@ __rec_txn_read(WT_SESSION_IMPL *session, WT_RECONCILE *r,
* list, else is an on-page row-store WT_UPDATE list.
*/
upd_list = ins == NULL ? WT_ROW_UPDATE(page, rip) : ins->upd;
- skipped = 0;
+ skipped = false;
for (max_txn = WT_TXN_NONE, min_txn = UINT64_MAX, upd = upd_list;
upd != NULL; upd = upd->next) {
@@ -896,11 +896,11 @@ __rec_txn_read(WT_SESSION_IMPL *session, WT_RECONCILE *r,
continue;
/* Track the largest/smallest transaction IDs on the list. */
- if (TXNID_LT(max_txn, txnid))
+ if (WT_TXNID_LT(max_txn, txnid))
max_txn = txnid;
- if (TXNID_LT(txnid, min_txn))
+ if (WT_TXNID_LT(txnid, min_txn))
min_txn = txnid;
- if (TXNID_LT(txnid, r->skipped_txn) &&
+ if (WT_TXNID_LT(txnid, r->skipped_txn) &&
!__wt_txn_visible_all(session, txnid))
r->skipped_txn = txnid;
@@ -928,7 +928,7 @@ __rec_txn_read(WT_SESSION_IMPL *session, WT_RECONCILE *r,
* used to avoid evicting clean pages from memory with changes required
* to satisfy a snapshot read.
*/
- if (TXNID_LT(r->max_txn, max_txn))
+ if (WT_TXNID_LT(r->max_txn, max_txn))
r->max_txn = max_txn;
/*
@@ -1034,42 +1034,169 @@ __rec_txn_read(WT_SESSION_IMPL *session, WT_RECONCILE *r,
}
/*
- * CHILD_RELEASE --
+ * WT_CHILD_RELEASE, WT_CHILD_RELEASE_ERR --
* Macros to clean up during internal-page reconciliation, releasing the
* hazard pointer we're holding on child pages.
*/
-#undef CHILD_RELEASE
-#define CHILD_RELEASE(session, hazard, ref) do { \
+#define WT_CHILD_RELEASE(session, hazard, ref) do { \
if (hazard) { \
- hazard = 0; \
+ hazard = false; \
WT_TRET( \
__wt_page_release(session, ref, WT_READ_NO_EVICT)); \
} \
} while (0)
-#undef CHILD_RELEASE_ERR
-#define CHILD_RELEASE_ERR(session, hazard, ref) do { \
- CHILD_RELEASE(session, hazard, ref); \
+#define WT_CHILD_RELEASE_ERR(session, hazard, ref) do { \
+ WT_CHILD_RELEASE(session, hazard, ref); \
WT_ERR(ret); \
} while (0)
+typedef enum {
+ WT_CHILD_IGNORE, /* Deleted child: ignore */
+ WT_CHILD_MODIFIED, /* Modified child */
+ WT_CHILD_ORIGINAL, /* Original child */
+ WT_CHILD_PROXY /* Deleted child: proxy */
+} WT_CHILD_STATE;
+
+/*
+ * __rec_child_deleted --
+ * Handle pages with leaf pages in the WT_REF_DELETED state.
+ */
+static int
+__rec_child_deleted(WT_SESSION_IMPL *session,
+ WT_RECONCILE *r, WT_REF *ref, WT_CHILD_STATE *statep)
+{
+ WT_BM *bm;
+ WT_PAGE_DELETED *page_del;
+ size_t addr_size;
+ const uint8_t *addr;
+
+ page_del = ref->page_del;
+
+ /*
+ * Internal pages with child leaf pages in the WT_REF_DELETED state are
+ * a special case during reconciliation. First, if the deletion was a
+ * result of a session truncate call, the deletion may not be visible to
+ * us. In that case, we proceed as with any change not visible during
+ * reconciliation by ignoring the change for the purposes of writing the
+ * internal page.
+ *
+ * In this case, there must be an associated page-deleted structure, and
+ * it holds the transaction ID we care about.
+ *
+ * In some cases, there had better not be any updates we can't see.
+ */
+ if (F_ISSET(r, WT_SKIP_UPDATE_ERR) &&
+ page_del != NULL && !__wt_txn_visible(session, page_del->txnid))
+ WT_PANIC_RET(session, EINVAL,
+ "reconciliation illegally skipped an update");
+
+ /*
+ * Deal with any underlying disk blocks.
+ *
+ * First, check to see if there is an address associated with this leaf:
+ * if there isn't, we're done, the underlying page is already gone. If
+ * the page still exists, check for any transactions in the system that
+ * might want to see the page's state before it's deleted.
+ *
+ * If any such transactions exist, we cannot discard the underlying leaf
+ * page to the block manager because the transaction may eventually read
+ * it. However, this write might be part of a checkpoint, and should we
+ * recover to that checkpoint, we'll need to delete the leaf page, else
+ * we'd leak it. The solution is to write a proxy cell on the internal
+ * page ensuring the leaf page is eventually discarded.
+ *
+ * If no such transactions exist, we can discard the leaf page to the
+ * block manager and no cell needs to be written at all. We do this
+ * outside of the underlying tracking routines because this action is
+ * permanent and irrevocable. (Clearing the address means we've lost
+ * track of the disk address in a permanent way. This is safe because
+ * there's no path to reading the leaf page again: if there's ever a
+ * read into this part of the name space again, the cache read function
+ * instantiates an entirely new page.)
+ */
+ if (ref->addr != NULL &&
+ (page_del == NULL ||
+ __wt_txn_visible_all(session, page_del->txnid))) {
+ WT_RET(__wt_ref_info(session, ref, &addr, &addr_size, NULL));
+ bm = S2BT(session)->bm;
+ WT_RET(bm->free(bm, session, addr, addr_size));
+
+ if (__wt_off_page(ref->home, ref->addr)) {
+ __wt_free(session, ((WT_ADDR *)ref->addr)->addr);
+ __wt_free(session, ref->addr);
+ }
+ ref->addr = NULL;
+ }
+
+ /*
+ * If the original page is gone, we can skip the slot on the internal
+ * page.
+ */
+ if (ref->addr == NULL) {
+ *statep = WT_CHILD_IGNORE;
+
+ /*
+ * Minor memory cleanup: if a truncate call deleted this page
+ * and we were ever forced to instantiate the page in memory,
+ * we would have built a list of updates in the page reference
+ * in order to be able to abort the truncate. It's a cheap
+ * test to make that memory go away, we do it here because
+ * there's really nowhere else we do the checks. In short, if
+ * we have such a list, and the backing address blocks are
+ * gone, there can't be any transaction that can abort.
+ */
+ if (page_del != NULL) {
+ __wt_free(session, ref->page_del->update_list);
+ __wt_free(session, ref->page_del);
+ }
+
+ return (0);
+ }
+
+ /*
+ * Internal pages with deletes that aren't stable cannot be evicted, we
+ * don't have sufficient information to restore the page's information
+ * if subsequently read (we wouldn't know which transactions should see
+ * the original page and which should see the deleted page).
+ */
+ if (F_ISSET(r, WT_EVICTING))
+ return (EBUSY);
+
+ /*
+ * If there are deleted child pages we can't discard immediately, keep
+ * the page dirty so they are eventually freed.
+ */
+ r->leave_dirty = 1;
+
+ /*
+ * If the original page cannot be freed, we need to keep a slot on the
+ * page to reference it from the parent page.
+ *
+ * If the delete is not visible in this checkpoint, write the original
+ * address normally. Otherwise, we have to write a proxy record.
+ */
+ if (__wt_txn_visible(session, page_del->txnid))
+ *statep = WT_CHILD_PROXY;
+
+ return (0);
+}
+
/*
* __rec_child_modify --
* Return if the internal page's child references any modifications.
*/
static int
__rec_child_modify(WT_SESSION_IMPL *session,
- WT_RECONCILE *r, WT_REF *ref, int *hazardp, int *statep)
+ WT_RECONCILE *r, WT_REF *ref, bool *hazardp, WT_CHILD_STATE *statep)
{
WT_DECL_RET;
WT_PAGE_MODIFY *mod;
/* We may acquire a hazard pointer our caller must release. */
- *hazardp = 0;
+ *hazardp = false;
-#define WT_CHILD_IGNORE 1 /* Deleted child: ignore */
-#define WT_CHILD_MODIFIED 2 /* Modified child */
-#define WT_CHILD_PROXY 3 /* Deleted child: proxy */
- *statep = 0;
+ /* Default to using the original child address. */
+ *statep = WT_CHILD_ORIGINAL;
/*
* This function is called when walking an internal page to decide how
@@ -1164,7 +1291,7 @@ __rec_child_modify(WT_SESSION_IMPL *session,
break;
}
WT_RET(ret);
- *hazardp = 1;
+ *hazardp = true;
goto in_memory;
case WT_REF_READING:
@@ -1211,11 +1338,11 @@ in_memory:
* reason to write the cell.
*/
mod = ref->page->modify;
- if (mod != NULL && mod->flags != 0)
+ if (mod != NULL && mod->rec_result != 0)
*statep = WT_CHILD_MODIFIED;
else if (ref->addr == NULL) {
*statep = WT_CHILD_IGNORE;
- CHILD_RELEASE(session, *hazardp, ref);
+ WT_CHILD_RELEASE(session, *hazardp, ref);
}
done: WT_DIAGNOSTIC_YIELD;
@@ -1223,114 +1350,6 @@ done: WT_DIAGNOSTIC_YIELD;
}
/*
- * __rec_child_deleted --
- * Handle pages with leaf pages in the WT_REF_DELETED state.
- */
-static int
-__rec_child_deleted(
- WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_REF *ref, int *statep)
-{
- WT_BM *bm;
- WT_PAGE_DELETED *page_del;
- size_t addr_size;
- const uint8_t *addr;
-
- bm = S2BT(session)->bm;
- page_del = ref->page_del;
-
- /*
- * Internal pages with child leaf pages in the WT_REF_DELETED state are
- * a special case during reconciliation. First, if the deletion was a
- * result of a session truncate call, the deletion may not be visible to
- * us. In that case, we proceed as with any change that's not visible
- * during reconciliation by setting the skipped flag and ignoring the
- * change for the purposes of writing the internal page.
- *
- * In this case, there must be an associated page-deleted structure, and
- * it holds the transaction ID we care about.
- */
- if (page_del != NULL && !__wt_txn_visible(session, page_del->txnid)) {
- /*
- * In some cases, there had better not be any updates we can't
- * write.
- */
- if (F_ISSET(r, WT_SKIP_UPDATE_ERR))
- WT_PANIC_RET(session, EINVAL,
- "reconciliation illegally skipped an update");
- }
-
- /*
- * The deletion is visible to us, deal with any underlying disk blocks.
- *
- * First, check to see if there is an address associated with this leaf:
- * if there isn't, we're done, the underlying page is already gone. If
- * the page still exists, check for any transactions in the system that
- * might want to see the page's state before it's deleted.
- *
- * If any such transactions exist, we cannot discard the underlying leaf
- * page to the block manager because the transaction may eventually read
- * it. However, this write might be part of a checkpoint, and should we
- * recover to that checkpoint, we'll need to delete the leaf page, else
- * we'd leak it. The solution is to write a proxy cell on the internal
- * page ensuring the leaf page is eventually discarded.
- *
- * If no such transactions exist, we can discard the leaf page to the
- * block manager and no cell needs to be written at all. We do this
- * outside of the underlying tracking routines because this action is
- * permanent and irrevocable. (Clearing the address means we've lost
- * track of the disk address in a permanent way. This is safe because
- * there's no path to reading the leaf page again: if there's ever a
- * read into this part of the name space again, the cache read function
- * instantiates an entirely new page.)
- */
- if (ref->addr != NULL &&
- (page_del == NULL ||
- __wt_txn_visible_all(session, page_del->txnid))) {
- WT_RET(__wt_ref_info(session, ref, &addr, &addr_size, NULL));
- WT_RET(bm->free(bm, session, addr, addr_size));
-
- if (__wt_off_page(ref->home, ref->addr)) {
- __wt_free(session, ((WT_ADDR *)ref->addr)->addr);
- __wt_free(session, ref->addr);
- }
- ref->addr = NULL;
- }
-
- /*
- * If there are deleted child pages that we can't discard immediately,
- * keep the page dirty so they are eventually freed.
- */
- if (ref->addr != NULL) {
- r->leave_dirty = 1;
-
- /* This page cannot be evicted, quit now. */
- if (F_ISSET(r, WT_EVICTING))
- return (EBUSY);
- }
-
- /*
- * Minor memory cleanup: if a truncate call deleted this page and we
- * were ever forced to instantiate the page in memory, we would have
- * built a list of updates in the page reference in order to be able
- * to abort the truncate. It's a cheap test to make that memory go
- * away, we do it here because there's really nowhere else we do the
- * checks. In short, if we have such a list, and the backing address
- * blocks are gone, there can't be any transaction that can abort.
- */
- if (ref->addr == NULL && page_del != NULL) {
- __wt_free(session, ref->page_del->update_list);
- __wt_free(session, ref->page_del);
- }
-
- /*
- * If there's still a disk address, then we have to write a proxy
- * record, otherwise, we can safely ignore this child page.
- */
- *statep = ref->addr == NULL ? WT_CHILD_IGNORE : WT_CHILD_PROXY;
- return (0);
-}
-
-/*
* __rec_incr --
* Update the memory tracking structure for a set of new entries.
*/
@@ -1435,7 +1454,7 @@ __rec_dict_replace(
* Update prefix and suffix compression based on the last key.
*/
static inline void
-__rec_key_state_update(WT_RECONCILE *r, int ovfl_key)
+__rec_key_state_update(WT_RECONCILE *r, bool ovfl_key)
{
WT_ITEM *a;
@@ -1465,7 +1484,7 @@ __rec_key_state_update(WT_RECONCILE *r, int ovfl_key)
* value and turn on both prefix and suffix compression.
*/
if (ovfl_key)
- r->key_sfx_compress = 0;
+ r->key_sfx_compress = false;
else {
a = r->cur;
r->cur = r->last;
@@ -1576,7 +1595,7 @@ __rec_split_bnd_init(WT_SESSION_IMPL *session, WT_BOUNDARY *bnd)
* reconciliation.
*/
- bnd->already_compressed = 0;
+ bnd->already_compressed = false;
}
/*
@@ -1762,7 +1781,7 @@ __rec_split_init(WT_SESSION_IMPL *session,
r->recno = recno;
/* New page, compression off. */
- r->key_pfx_compress = r->key_sfx_compress = 0;
+ r->key_pfx_compress = r->key_sfx_compress = false;
return (0);
}
@@ -1792,9 +1811,9 @@ __rec_is_checkpoint(WT_RECONCILE *r, WT_BOUNDARY *bnd)
bnd->addr.addr = NULL;
bnd->addr.size = 0;
bnd->addr.type = 0;
- return (1);
+ return (true);
}
- return (0);
+ return (false);
}
/*
@@ -1892,7 +1911,7 @@ __rec_split_row_promote(
skip = &r->skip[i - 1];
if (skip->ins == NULL)
WT_ERR(__wt_row_leaf_key(
- session, r->page, skip->rip, update, 0));
+ session, r->page, skip->rip, update, false));
else {
update->data = WT_INSERT_KEY(skip->ins);
update->size = WT_INSERT_KEY_SIZE(skip->ins);
@@ -2116,7 +2135,7 @@ __rec_split(WT_SESSION_IMPL *session, WT_RECONCILE *r, size_t next_len)
dsk->recno = last->recno;
dsk->u.entries = r->entries;
dsk->mem_size = r->dsk.size = WT_PTRDIFF32(r->first_free, dsk);
- WT_RET(__rec_split_write(session, r, last, &r->dsk, 0));
+ WT_RET(__rec_split_write(session, r, last, &r->dsk, false));
/*
* Set the caller's entry count and buffer information for the
@@ -2155,7 +2174,7 @@ __rec_split(WT_SESSION_IMPL *session, WT_RECONCILE *r, size_t next_len)
*/
static int
__rec_split_raw_worker(WT_SESSION_IMPL *session,
- WT_RECONCILE *r, size_t next_len, int no_more_rows)
+ WT_RECONCILE *r, size_t next_len, bool no_more_rows)
{
WT_BM *bm;
WT_BOUNDARY *last, *next;
@@ -2170,7 +2189,7 @@ __rec_split_raw_worker(WT_SESSION_IMPL *session,
size_t corrected_page_size, len, result_len;
uint64_t recno;
uint32_t entry, i, result_slots, slots;
- int last_block;
+ bool last_block;
uint8_t *dsk_start;
wt_session = (WT_SESSION *)session;
@@ -2387,7 +2406,7 @@ __rec_split_raw_worker(WT_SESSION_IMPL *session,
* Mark it as uncompressed so the standard compression
* function is called before the buffer is written.
*/
- last->already_compressed = 0;
+ last->already_compressed = false;
} else {
WT_STAT_FAST_DATA_INCR(session, compress_raw_ok);
@@ -2408,7 +2427,7 @@ __rec_split_raw_worker(WT_SESSION_IMPL *session,
if (result_slots == slots && !no_more_rows)
result_slots = 0;
else
- last->already_compressed = 1;
+ last->already_compressed = true;
}
break;
default:
@@ -2497,7 +2516,7 @@ no_slots:
r->space_avail = r->page_size - WT_PAGE_HEADER_BYTE_SIZE(btree);
write_ref = &r->dsk;
- last->already_compressed = 0;
+ last->already_compressed = false;
} else {
/*
* Compression failed, there are more rows to accumulate and the
@@ -2581,8 +2600,8 @@ __rec_raw_decompress(
WT_ERR(__wt_illegal_value(session, btree->dhandle->name));
WT_ERR(__wt_strndup(session, tmp->data, dsk->mem_size, retp));
- WT_ASSERT(session, __wt_verify_dsk_image(
- session, "[raw evict split]", tmp->data, dsk->mem_size, 0) == 0);
+ WT_ASSERT(session, __wt_verify_dsk_image(session,
+ "[raw evict split]", tmp->data, dsk->mem_size, false) == 0);
err: __wt_scr_free(session, &tmp);
return (ret);
@@ -2595,7 +2614,7 @@ err: __wt_scr_free(session, &tmp);
static inline int
__rec_split_raw(WT_SESSION_IMPL *session, WT_RECONCILE *r, size_t next_len)
{
- return (__rec_split_raw_worker(session, r, next_len, 0));
+ return (__rec_split_raw_worker(session, r, next_len, false));
}
/*
@@ -2658,7 +2677,7 @@ __rec_split_finish_std(WT_SESSION_IMPL *session, WT_RECONCILE *r)
/* If this is a checkpoint, we're done, otherwise write the page. */
return (
__rec_is_checkpoint(r, bnd) ? 0 :
- __rec_split_write(session, r, bnd, &r->dsk, 1));
+ __rec_split_write(session, r, bnd, &r->dsk, true));
}
/*
@@ -2671,7 +2690,7 @@ __rec_split_finish(WT_SESSION_IMPL *session, WT_RECONCILE *r)
/* We're done reconciling - write the final page */
if (r->raw_compression && r->entries != 0) {
while (r->entries != 0)
- WT_RET(__rec_split_raw_worker(session, r, 0, 1));
+ WT_RET(__rec_split_raw_worker(session, r, 0, true));
} else
WT_RET(__rec_split_finish_std(session, r));
@@ -2727,7 +2746,7 @@ __rec_split_fixup(WT_SESSION_IMPL *session, WT_RECONCILE *r)
dsk->u.entries = bnd->entries;
dsk->mem_size =
tmp->size = WT_PAGE_HEADER_BYTE_SIZE(btree) + len;
- WT_ERR(__rec_split_write(session, r, bnd, tmp, 0));
+ WT_ERR(__rec_split_write(session, r, bnd, tmp, false));
}
/*
@@ -2775,7 +2794,7 @@ err: __wt_scr_free(session, &tmp);
*/
static int
__rec_split_write(WT_SESSION_IMPL *session,
- WT_RECONCILE *r, WT_BOUNDARY *bnd, WT_ITEM *buf, int last_block)
+ WT_RECONCILE *r, WT_BOUNDARY *bnd, WT_ITEM *buf, bool last_block)
{
WT_BTREE *btree;
WT_DECL_ITEM(key);
@@ -2857,7 +2876,7 @@ __rec_split_write(WT_SESSION_IMPL *session,
case WT_PAGE_ROW_LEAF:
if (skip->ins == NULL)
WT_ERR(__wt_row_leaf_key(
- session, page, skip->rip, key, 0));
+ session, page, skip->rip, key, false));
else {
key->data = WT_INSERT_KEY(skip->ins);
key->size = WT_INSERT_KEY_SIZE(skip->ins);
@@ -2905,7 +2924,7 @@ skip_check_complete:
WT_ERR(__wt_strndup(
session, buf->data, buf->size, &bnd->dsk));
WT_ASSERT(session, __wt_verify_dsk_image(session,
- "[evict split]", buf->data, buf->size, 1) == 0);
+ "[evict split]", buf->data, buf->size, true) == 0);
}
goto done;
}
@@ -2922,7 +2941,8 @@ skip_check_complete:
*/
bnd_slot = (uint32_t)(bnd - r->bnd);
if (bnd_slot > 1 ||
- (F_ISSET(mod, WT_PM_REC_MULTIBLOCK) && mod->mod_multi != NULL)) {
+ (mod->rec_result == WT_PM_REC_MULTIBLOCK &&
+ mod->mod_multi != NULL)) {
/*
* There are page header fields which need to be cleared to get
* consistent checksums: specifically, the write generation and
@@ -2934,7 +2954,7 @@ skip_check_complete:
memset(WT_BLOCK_HEADER_REF(dsk), 0, btree->block_header);
bnd->cksum = __wt_cksum(buf->data, buf->size);
- if (F_ISSET(mod, WT_PM_REC_MULTIBLOCK) &&
+ if (mod->rec_result == WT_PM_REC_MULTIBLOCK &&
mod->mod_multi_entries > bnd_slot) {
multi = &mod->mod_multi[bnd_slot];
if (multi->size == bnd->size &&
@@ -2949,7 +2969,7 @@ skip_check_complete:
}
WT_ERR(__wt_bt_write(session,
- buf, addr, &addr_size, 0, bnd->already_compressed));
+ buf, addr, &addr_size, false, bnd->already_compressed));
WT_ERR(__wt_strndup(session, addr, addr_size, &bnd->addr.addr));
bnd->addr.size = (uint8_t)addr_size;
@@ -2987,7 +3007,7 @@ __wt_bulk_init(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk)
WT_RET(
__rec_write_init(session, cbulk->ref, 0, NULL, &cbulk->reconcile));
r = cbulk->reconcile;
- r->is_bulk_load = 1;
+ r->is_bulk_load = true;
switch (btree->type) {
case BTREE_COL_FIX:
@@ -3058,7 +3078,7 @@ __wt_bulk_insert_row(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk)
WT_CURSOR *cursor;
WT_KV *key, *val;
WT_RECONCILE *r;
- int ovfl_key;
+ bool ovfl_key;
r = cbulk->reconcile;
btree = S2BT(session);
@@ -3083,7 +3103,7 @@ __wt_bulk_insert_row(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk)
* overflow key), rebuild the key without compression.
*/
if (r->key_pfx_compress_conf) {
- r->key_pfx_compress = 0;
+ r->key_pfx_compress = false;
if (!ovfl_key)
WT_RET(__rec_cell_build_leaf_key(
session, r, NULL, 0, &ovfl_key));
@@ -3096,9 +3116,9 @@ __wt_bulk_insert_row(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk)
/* Copy the key/value pair onto the page. */
__rec_copy_incr(session, r, key);
if (val->len == 0)
- r->any_empty_value = 1;
+ r->any_empty_value = true;
else {
- r->all_empty_value = 0;
+ r->all_empty_value = false;
if (btree->dictionary)
WT_RET(__rec_dict_replace(session, r, 0, val));
__rec_copy_incr(session, r, val);
@@ -3256,15 +3276,16 @@ __rec_col_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
WT_ADDR *addr;
WT_BTREE *btree;
WT_CELL_UNPACK *vpack, _vpack;
+ WT_CHILD_STATE state;
WT_DECL_RET;
WT_KV *val;
WT_PAGE *child;
WT_REF *ref;
- int hazard, state;
+ bool hazard;
btree = S2BT(session);
child = NULL;
- hazard = 0;
+ hazard = false;
val = &r->v;
vpack = &_vpack;
@@ -3286,18 +3307,18 @@ __rec_col_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
addr = NULL;
child = ref->page;
- /* Deleted child we don't have to write. */
- if (state == WT_CHILD_IGNORE) {
- CHILD_RELEASE_ERR(session, hazard, ref);
+ switch (state) {
+ case WT_CHILD_IGNORE:
+ /* Deleted child we don't have to write. */
+ WT_CHILD_RELEASE_ERR(session, hazard, ref);
continue;
- }
- /*
- * Modified child. Empty pages are merged into the parent and
- * discarded.
- */
- if (state == WT_CHILD_MODIFIED) {
- switch (F_ISSET(child->modify, WT_PM_REC_MASK)) {
+ case WT_CHILD_MODIFIED:
+ /*
+ * Modified child. Empty pages are merged into the
+ * parent and discarded.
+ */
+ switch (child->modify->rec_result) {
case WT_PM_REC_EMPTY:
/*
* Column-store pages are almost never empty, as
@@ -3305,11 +3326,11 @@ __rec_col_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
* name space. The exceptions are pages created
* when the tree is created, and never filled.
*/
- CHILD_RELEASE_ERR(session, hazard, ref);
+ WT_CHILD_RELEASE_ERR(session, hazard, ref);
continue;
case WT_PM_REC_MULTIBLOCK:
WT_ERR(__rec_col_merge(session, r, child));
- CHILD_RELEASE_ERR(session, hazard, ref);
+ WT_CHILD_RELEASE_ERR(session, hazard, ref);
continue;
case WT_PM_REC_REPLACE:
addr = &child->modify->mod_replace;
@@ -3318,9 +3339,18 @@ __rec_col_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
break;
WT_ILLEGAL_VALUE_ERR(session);
}
- } else
- /* No other states are expected for column stores. */
- WT_ASSERT(session, state == 0);
+ break;
+ case WT_CHILD_ORIGINAL:
+ /* Original child. */
+ break;
+ case WT_CHILD_PROXY:
+ /*
+ * Deleted child where we write a proxy cell, not
+ * yet supported for column-store.
+ */
+ ret = __wt_illegal_value(session, NULL);
+ goto err;
+ }
/*
* Build the value cell. The child page address is in one of 3
@@ -3342,7 +3372,7 @@ __rec_col_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
} else
__rec_cell_build_addr(r, addr->addr, addr->size,
__rec_vtype(addr), ref->key.recno);
- CHILD_RELEASE_ERR(session, hazard, ref);
+ WT_CHILD_RELEASE_ERR(session, hazard, ref);
/* Boundary: split or write the page. */
if (val->len > r->space_avail)
@@ -3357,7 +3387,7 @@ __rec_col_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
/* Write the remnant page. */
return (__rec_split_finish(session, r));
-err: CHILD_RELEASE(session, hazard, ref);
+err: WT_CHILD_RELEASE(session, hazard, ref);
return (ret);
}
@@ -3558,7 +3588,7 @@ __rec_col_fix_slvg(WT_SESSION_IMPL *session,
static int
__rec_col_var_helper(WT_SESSION_IMPL *session, WT_RECONCILE *r,
WT_SALVAGE_COOKIE *salvage,
- WT_ITEM *value, int deleted, uint8_t overflow_type, uint64_t rle)
+ WT_ITEM *value, bool deleted, uint8_t overflow_type, uint64_t rle)
{
WT_BTREE *btree;
WT_KV *val;
@@ -3594,7 +3624,7 @@ __rec_col_var_helper(WT_SESSION_IMPL *session, WT_RECONCILE *r,
salvage->take = 0;
}
if (salvage->take == 0)
- salvage->done = 1;
+ salvage->done = true;
}
}
@@ -3650,7 +3680,7 @@ __rec_col_var(WT_SESSION_IMPL *session,
WT_UPDATE *upd;
uint64_t n, nrepeat, repeat_count, rle, src_recno;
uint32_t i, size;
- int deleted, last_deleted, orig_deleted, update_no_copy;
+ bool deleted, last_deleted, orig_deleted, update_no_copy;
const void *data;
btree = S2BT(session);
@@ -3677,11 +3707,11 @@ __rec_col_var(WT_SESSION_IMPL *session,
* helper function's assistance.)
*/
rle = 0;
- last_deleted = 0;
+ last_deleted = false;
if (salvage != NULL && salvage->missing != 0) {
if (salvage->skip == 0) {
rle = salvage->missing;
- last_deleted = 1;
+ last_deleted = true;
/*
* Correct the number of records we're going to "take",
@@ -3689,8 +3719,8 @@ __rec_col_var(WT_SESSION_IMPL *session,
*/
salvage->take += salvage->missing;
} else
- WT_ERR(__rec_col_var_helper(
- session, r, NULL, NULL, 1, 0, salvage->missing));
+ WT_ERR(__rec_col_var_helper(session,
+ r, NULL, NULL, true, false, salvage->missing));
}
/*
@@ -3712,7 +3742,7 @@ __rec_col_var(WT_SESSION_IMPL *session,
if ((cell = WT_COL_PTR(page, cip)) == NULL) {
nrepeat = 1;
ins = NULL;
- orig_deleted = 1;
+ orig_deleted = true;
} else {
__wt_cell_unpack(cell, vpack);
nrepeat = __wt_cell_rle(vpack);
@@ -3722,7 +3752,7 @@ __rec_col_var(WT_SESSION_IMPL *session,
* If the original value is "deleted", there's no value
* to compare, we're done.
*/
- orig_deleted = vpack->type == WT_CELL_DEL ? 1 : 0;
+ orig_deleted = vpack->type == WT_CELL_DEL;
if (orig_deleted)
goto record_loop;
@@ -3775,7 +3805,7 @@ record_loop: /*
ins = WT_SKIP_NEXT(ins);
}
if (upd != NULL) {
- update_no_copy = 1; /* No data copy */
+ update_no_copy = true; /* No data copy */
repeat_count = 1; /* Single record */
deleted = WT_UPDATE_DELETED_ISSET(upd);
@@ -3784,10 +3814,10 @@ record_loop: /*
size = upd->size;
}
} else if (vpack->raw == WT_CELL_VALUE_OVFL_RM) {
- update_no_copy = 1; /* No data copy */
+ update_no_copy = true; /* No data copy */
repeat_count = 1; /* Single record */
- deleted = 0;
+ deleted = false;
/*
* If doing update save and restore, there's an
@@ -3816,7 +3846,7 @@ record_loop: /*
data = "@";
size = 1;
} else {
- update_no_copy = 0; /* Maybe data copy */
+ update_no_copy = false; /* Maybe data copy */
/*
* The repeat count is the number of records up
@@ -3860,11 +3890,11 @@ record_loop: /*
last->data = vpack->data;
last->size = vpack->size;
WT_ERR(__rec_col_var_helper(
- session, r, salvage, last, 0,
+ session, r, salvage, last, false,
WT_CELL_VALUE_OVFL, repeat_count));
/* Track if page has overflow items. */
- r->ovfl_items = 1;
+ r->ovfl_items = true;
ovfl_state = OVFL_USED;
continue;
@@ -3966,7 +3996,7 @@ compare: /*
* gaps in the name space.
*/
if (src_recno < n)
- deleted = 1;
+ deleted = true;
else {
deleted = WT_UPDATE_DELETED_ISSET(upd);
if (!deleted) {
@@ -4030,6 +4060,7 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
WT_BTREE *btree;
WT_CELL *cell;
WT_CELL_UNPACK *kpack, _kpack, *vpack, _vpack;
+ WT_CHILD_STATE state;
WT_DECL_RET;
WT_IKEY *ikey;
WT_KV *key, *val;
@@ -4037,12 +4068,12 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
WT_REF *ref;
size_t size;
u_int vtype;
- int hazard, key_onpage_ovfl, ovfl_key, state;
+ bool hazard, key_onpage_ovfl, ovfl_key;
const void *p;
btree = S2BT(session);
child = NULL;
- hazard = 0;
+ hazard = false;
key = &r->k;
kpack = &_kpack;
@@ -4069,7 +4100,7 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
* have to special case transforming the page from its disk image to
* its in-memory version, for example).
*/
- r->cell_zero = 1;
+ r->cell_zero = true;
/* For each entry in the in-memory page... */
WT_INTL_FOREACH_BEGIN(session, page, ref) {
@@ -4085,7 +4116,7 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
ikey = __wt_ref_key_instantiated(ref);
if (ikey == NULL || ikey->cell_offset == 0) {
cell = NULL;
- key_onpage_ovfl = 0;
+ key_onpage_ovfl = false;
} else {
cell = WT_PAGE_REF_OFFSET(page, ikey->cell_offset);
__wt_cell_unpack(cell, kpack);
@@ -4097,9 +4128,11 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
addr = ref->addr;
child = ref->page;
- /* Deleted child we don't have to write. */
- if (state == WT_CHILD_IGNORE) {
+ switch (state) {
+ case WT_CHILD_IGNORE:
/*
+ * Deleted child we don't have to write.
+ *
* Overflow keys referencing discarded pages are no
* longer useful, schedule them for discard. Don't
* worry about instantiation, internal page keys are
@@ -4109,16 +4142,15 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
if (key_onpage_ovfl)
WT_ERR(__wt_ovfl_discard_add(
session, page, kpack->cell));
- CHILD_RELEASE_ERR(session, hazard, ref);
+ WT_CHILD_RELEASE_ERR(session, hazard, ref);
continue;
- }
- /*
- * Modified child. Empty pages are merged into the parent and
- * discarded.
- */
- if (state == WT_CHILD_MODIFIED)
- switch (F_ISSET(child->modify, WT_PM_REC_MASK)) {
+ case WT_CHILD_MODIFIED:
+ /*
+ * Modified child. Empty pages are merged into the
+ * parent and discarded.
+ */
+ switch (child->modify->rec_result) {
case WT_PM_REC_EMPTY:
/*
* Overflow keys referencing empty pages are no
@@ -4131,7 +4163,7 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
if (key_onpage_ovfl)
WT_ERR(__wt_ovfl_discard_add(
session, page, kpack->cell));
- CHILD_RELEASE_ERR(session, hazard, ref);
+ WT_CHILD_RELEASE_ERR(session, hazard, ref);
continue;
case WT_PM_REC_MULTIBLOCK:
/*
@@ -4148,7 +4180,7 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
session, page, kpack->cell));
WT_ERR(__rec_row_merge(session, r, child));
- CHILD_RELEASE_ERR(session, hazard, ref);
+ WT_CHILD_RELEASE_ERR(session, hazard, ref);
continue;
case WT_PM_REC_REPLACE:
/*
@@ -4159,6 +4191,14 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
break;
WT_ILLEGAL_VALUE_ERR(session);
}
+ break;
+ case WT_CHILD_ORIGINAL:
+ /* Original child. */
+ break;
+ case WT_CHILD_PROXY:
+ /* Deleted child where we write a proxy cell. */
+ break;
+ }
/*
* Build the value cell, the child page's address. Addr points
@@ -4180,7 +4220,7 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
WT_CELL_ADDR_DEL : (u_int)vpack->raw;
}
__rec_cell_build_addr(r, p, size, vtype, 0);
- CHILD_RELEASE_ERR(session, hazard, ref);
+ WT_CHILD_RELEASE_ERR(session, hazard, ref);
/*
* Build key cell.
@@ -4191,13 +4231,13 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
key->buf.size = __wt_cell_total_len(kpack);
key->cell_len = 0;
key->len = key->buf.size;
- ovfl_key = 1;
+ ovfl_key = true;
} else {
__wt_ref_key(page, ref, &p, &size);
WT_ERR(__rec_cell_build_int_key(
session, r, p, r->cell_zero ? 1 : size, &ovfl_key));
}
- r->cell_zero = 0;
+ r->cell_zero = false;
/* Boundary: split or write the page. */
if (key->len + val->len > r->space_avail) {
@@ -4214,7 +4254,7 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
if (key_onpage_ovfl) {
WT_ERR(__wt_buf_set(session, r->cur,
WT_IKEY_DATA(ikey), ikey->size));
- key_onpage_ovfl = 0;
+ key_onpage_ovfl = false;
}
WT_ERR(__rec_split(
session, r, key->len + val->len));
@@ -4232,7 +4272,7 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
/* Write the remnant page. */
return (__rec_split_finish(session, r));
-err: CHILD_RELEASE(session, hazard, ref);
+err: WT_CHILD_RELEASE(session, hazard, ref);
return (ret);
}
@@ -4248,7 +4288,7 @@ __rec_row_merge(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
WT_MULTI *multi;
WT_PAGE_MODIFY *mod;
uint32_t i;
- int ovfl_key;
+ bool ovfl_key;
mod = page->modify;
@@ -4262,7 +4302,7 @@ __rec_row_merge(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
WT_RET(__rec_cell_build_int_key(session, r,
WT_IKEY_DATA(multi->key.ikey),
r->cell_zero ? 1 : multi->key.ikey->size, &ovfl_key));
- r->cell_zero = 0;
+ r->cell_zero = false;
addr = &multi->addr;
__rec_cell_build_addr(
@@ -4306,7 +4346,7 @@ __rec_row_leaf(WT_SESSION_IMPL *session,
size_t size;
uint64_t slvg_skip;
uint32_t i;
- int dictionary, key_onpage_ovfl, ovfl_key;
+ bool dictionary, key_onpage_ovfl, ovfl_key;
const void *p;
void *copy;
@@ -4374,7 +4414,7 @@ __rec_row_leaf(WT_SESSION_IMPL *session,
WT_ERR(__rec_txn_read(session, r, NULL, rip, vpack, &upd));
/* Build value cell. */
- dictionary = 0;
+ dictionary = false;
if (upd == NULL) {
/*
* When the page was read into memory, there may not
@@ -4403,7 +4443,7 @@ __rec_row_leaf(WT_SESSION_IMPL *session,
}
WT_ERR(__rec_cell_build_val(
session, r, p, size, (uint64_t)0));
- dictionary = 1;
+ dictionary = true;
} else if (vpack->raw == WT_CELL_VALUE_OVFL_RM) {
/*
* If doing update save and restore in service
@@ -4459,7 +4499,7 @@ __rec_row_leaf(WT_SESSION_IMPL *session,
/* Track if page has overflow items. */
if (vpack->ovfl)
- r->ovfl_items = 1;
+ r->ovfl_items = true;
}
} else {
/*
@@ -4496,7 +4536,7 @@ __rec_row_leaf(WT_SESSION_IMPL *session,
if (ikey == NULL)
WT_ERR(__wt_row_leaf_key(
session,
- page, rip, tmpkey, 1));
+ page, rip, tmpkey, true));
WT_ERR(__wt_ovfl_discard_add(
session, page, kpack->cell));
@@ -4525,7 +4565,7 @@ __rec_row_leaf(WT_SESSION_IMPL *session,
WT_ERR(__rec_cell_build_val(session, r,
WT_UPDATE_DATA(upd), upd->size,
(uint64_t)0));
- dictionary = 1;
+ dictionary = true;
}
}
@@ -4542,7 +4582,7 @@ __rec_row_leaf(WT_SESSION_IMPL *session,
key->buf.size = __wt_cell_total_len(kpack);
key->cell_len = 0;
key->len = key->buf.size;
- ovfl_key = 1;
+ ovfl_key = true;
/*
* We aren't creating a key so we can't use this key as
@@ -4551,7 +4591,7 @@ __rec_row_leaf(WT_SESSION_IMPL *session,
tmpkey->size = 0;
/* Track if page has overflow items. */
- r->ovfl_items = 1;
+ r->ovfl_items = true;
} else {
/*
* Get the key from the page or an instantiated key, or
@@ -4615,7 +4655,7 @@ build:
if (key_onpage_ovfl) {
WT_ERR(__wt_dsk_cell_data_ref(session,
WT_PAGE_ROW_LEAF, kpack, r->cur));
- key_onpage_ovfl = 0;
+ key_onpage_ovfl = false;
}
/*
@@ -4625,7 +4665,7 @@ build:
* key without compression.
*/
if (r->key_pfx_compress_conf) {
- r->key_pfx_compress = 0;
+ r->key_pfx_compress = false;
if (!ovfl_key)
WT_ERR(
__rec_cell_build_leaf_key(
@@ -4641,9 +4681,9 @@ build:
/* Copy the key/value pair onto the page. */
__rec_copy_incr(session, r, key);
if (val->len == 0)
- r->any_empty_value = 1;
+ r->any_empty_value = true;
else {
- r->all_empty_value = 0;
+ r->all_empty_value = false;
if (dictionary && btree->dictionary)
WT_ERR(__rec_dict_replace(session, r, 0, val));
__rec_copy_incr(session, r, val);
@@ -4675,7 +4715,7 @@ __rec_row_leaf_insert(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins)
WT_BTREE *btree;
WT_KV *key, *val;
WT_UPDATE *upd;
- int ovfl_key;
+ bool ovfl_key;
btree = S2BT(session);
@@ -4711,7 +4751,7 @@ __rec_row_leaf_insert(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins)
* key without compression.
*/
if (r->key_pfx_compress_conf) {
- r->key_pfx_compress = 0;
+ r->key_pfx_compress = false;
if (!ovfl_key)
WT_RET(
__rec_cell_build_leaf_key(
@@ -4727,9 +4767,9 @@ __rec_row_leaf_insert(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins)
/* Copy the key/value pair onto the page. */
__rec_copy_incr(session, r, key);
if (val->len == 0)
- r->any_empty_value = 1;
+ r->any_empty_value = true;
else {
- r->all_empty_value = 0;
+ r->all_empty_value = false;
if (btree->dictionary)
WT_RET(__rec_dict_replace(session, r, 0, val));
__rec_copy_incr(session, r, val);
@@ -4835,7 +4875,7 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
* and clear the underlying modification information, we're creating a
* new reality.
*/
- switch (F_ISSET(mod, WT_PM_REC_MASK)) {
+ switch (mod->rec_result) {
case 0: /*
* The page has never been reconciled before, free the original
* address blocks (if any). The "if any" is for empty trees
@@ -4889,7 +4929,9 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
break;
WT_ILLEGAL_VALUE(session);
}
- F_CLR(mod, WT_PM_REC_MASK);
+
+ /* Reset the reconciliation state. */
+ mod->rec_result = 0;
/*
* Wrap up overflow tracking. If we are about to create a checkpoint,
@@ -4909,8 +4951,8 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
/* If this is the root page, we need to create a sync point. */
ref = r->ref;
if (__wt_ref_is_root(ref))
- WT_RET(
- bm->checkpoint(bm, session, NULL, btree->ckpt, 0));
+ WT_RET(bm->checkpoint(
+ bm, session, NULL, btree->ckpt, false));
/*
* If the page was empty, we want to discard it from the tree
@@ -4919,7 +4961,7 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
* page in memory. If the page is subsequently modified, that
* is OK, we'll just reconcile it again.
*/
- F_SET(mod, WT_PM_REC_EMPTY);
+ mod->rec_result = WT_PM_REC_EMPTY;
break;
case 1: /* 1-for-1 page swap */
/*
@@ -4945,7 +4987,7 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
bnd->dsk = NULL;
mod->mod_multi_entries = 1;
- F_SET(mod, WT_PM_REC_REWRITE);
+ mod->rec_result = WT_PM_REC_REWRITE;
break;
}
@@ -4955,14 +4997,14 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
* we were about to write the buffer so we know what to do here.
*/
if (bnd->addr.addr == NULL)
- WT_RET(__wt_bt_write(session,
- &r->dsk, NULL, NULL, 1, bnd->already_compressed));
+ WT_RET(__wt_bt_write(session, &r->dsk,
+ NULL, NULL, true, bnd->already_compressed));
else {
mod->mod_replace = bnd->addr;
bnd->addr.addr = NULL;
}
- F_SET(mod, WT_PM_REC_REPLACE);
+ mod->rec_result = WT_PM_REC_REPLACE;
break;
default: /* Page split */
WT_RET(__wt_verbose(session, WT_VERB_RECONCILE,
@@ -5037,7 +5079,7 @@ err: __wt_scr_free(session, &tkey);
break;
WT_ILLEGAL_VALUE(session);
}
- F_SET(mod, WT_PM_REC_MULTIBLOCK);
+ mod->rec_result = WT_PM_REC_MULTIBLOCK;
break;
}
@@ -5066,7 +5108,7 @@ err: __wt_scr_free(session, &tkey);
} else {
mod->rec_max_txn = r->max_txn;
if (!F_ISSET(r, WT_EVICTING) &&
- TXNID_LT(btree->rec_max_txn, r->max_txn))
+ WT_TXNID_LT(btree->rec_max_txn, r->max_txn))
btree->rec_max_txn = r->max_txn;
if (__wt_atomic_cas32(&mod->write_gen, r->orig_write_gen, 0))
@@ -5098,7 +5140,7 @@ __rec_write_wrapup_err(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
* information (otherwise we might think the backing block is being
* reused on a subsequent reconciliation where we want to free it).
*/
- switch (F_ISSET(mod, WT_PM_REC_MASK)) {
+ switch (mod->rec_result) {
case WT_PM_REC_MULTIBLOCK:
case WT_PM_REC_REWRITE:
for (multi = mod->mod_multi,
@@ -5230,12 +5272,12 @@ __rec_split_col(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
*/
static int
__rec_cell_build_int_key(WT_SESSION_IMPL *session,
- WT_RECONCILE *r, const void *data, size_t size, int *is_ovflp)
+ WT_RECONCILE *r, const void *data, size_t size, bool *is_ovflp)
{
WT_BTREE *btree;
WT_KV *key;
- *is_ovflp = 0;
+ *is_ovflp = false;
btree = S2BT(session);
@@ -5249,7 +5291,7 @@ __rec_cell_build_int_key(WT_SESSION_IMPL *session,
if (size > btree->maxintlkey) {
WT_STAT_FAST_DATA_INCR(session, rec_overflow_key_internal);
- *is_ovflp = 1;
+ *is_ovflp = true;
return (__rec_cell_build_ovfl(
session, r, key, WT_CELL_KEY_OVFL, (uint64_t)0));
}
@@ -5267,7 +5309,7 @@ __rec_cell_build_int_key(WT_SESSION_IMPL *session,
*/
static int
__rec_cell_build_leaf_key(WT_SESSION_IMPL *session,
- WT_RECONCILE *r, const void *data, size_t size, int *is_ovflp)
+ WT_RECONCILE *r, const void *data, size_t size, bool *is_ovflp)
{
WT_BTREE *btree;
WT_KV *key;
@@ -5275,7 +5317,7 @@ __rec_cell_build_leaf_key(WT_SESSION_IMPL *session,
uint8_t pfx;
const uint8_t *a, *b;
- *is_ovflp = 0;
+ *is_ovflp = false;
btree = S2BT(session);
@@ -5349,7 +5391,7 @@ __rec_cell_build_leaf_key(WT_SESSION_IMPL *session,
if (pfx == 0) {
WT_STAT_FAST_DATA_INCR(session, rec_overflow_key_leaf);
- *is_ovflp = 1;
+ *is_ovflp = true;
return (__rec_cell_build_ovfl(
session, r, key, WT_CELL_KEY_OVFL, (uint64_t)0));
}
@@ -5463,7 +5505,7 @@ __rec_cell_build_ovfl(WT_SESSION_IMPL *session,
page = r->page;
/* Track if page has overflow items. */
- r->ovfl_items = 1;
+ r->ovfl_items = true;
/*
* See if this overflow record has already been written and reuse it if
@@ -5488,7 +5530,7 @@ __rec_cell_build_ovfl(WT_SESSION_IMPL *session,
/* Write the buffer. */
addr = buf;
- WT_ERR(__wt_bt_write(session, tmp, addr, &size, 0, 0));
+ WT_ERR(__wt_bt_write(session, tmp, addr, &size, false, false));
/*
* Track the overflow record (unless it's a bulk load, which
@@ -5667,7 +5709,7 @@ __rec_dictionary_lookup(
{
WT_DICTIONARY *dp, *next;
uint64_t hash;
- int match;
+ bool match;
*dpp = NULL;
diff --git a/src/third_party/wiredtiger/src/schema/schema_create.c b/src/third_party/wiredtiger/src/schema/schema_create.c
index 80e443d8a21..28b1e2473ed 100644
--- a/src/third_party/wiredtiger/src/schema/schema_create.c
+++ b/src/third_party/wiredtiger/src/schema/schema_create.c
@@ -54,12 +54,12 @@ __wt_direct_io_size_check(WT_SESSION_IMPL *session,
*/
static int
__create_file(WT_SESSION_IMPL *session,
- const char *uri, int exclusive, const char *config)
+ const char *uri, bool exclusive, const char *config)
{
WT_DECL_ITEM(val);
WT_DECL_RET;
uint32_t allocsize;
- int is_metadata;
+ bool is_metadata;
const char *filename, **p, *filecfg[] =
{ WT_CONFIG_BASE(session, file_meta), config, NULL, NULL };
char *fileconf;
@@ -119,7 +119,7 @@ __create_file(WT_SESSION_IMPL *session,
WT_ERR(__wt_session_get_btree(
session, uri, NULL, NULL, WT_DHANDLE_EXCLUSIVE));
if (WT_META_TRACKING(session))
- WT_ERR(__wt_meta_track_handle_lock(session, 1));
+ WT_ERR(__wt_meta_track_handle_lock(session, true));
else
WT_ERR(__wt_session_release_btree(session));
@@ -170,7 +170,7 @@ __wt_schema_colgroup_source(WT_SESSION_IMPL *session,
*/
static int
__create_colgroup(WT_SESSION_IMPL *session,
- const char *name, int exclusive, const char *config)
+ const char *name, bool exclusive, const char *config)
{
WT_CONFIG_ITEM cval;
WT_DECL_RET;
@@ -199,7 +199,7 @@ __create_colgroup(WT_SESSION_IMPL *session,
tlen = strlen(tablename);
if ((ret =
- __wt_schema_get_table(session, tablename, tlen, 1, &table)) != 0)
+ __wt_schema_get_table(session, tablename, tlen, true, &table)) != 0)
WT_RET_MSG(session, (ret == WT_NOTFOUND) ? ENOENT : ret,
"Can't create '%s' for non-existent table '%.*s'",
name, (int)tlen, tablename);
@@ -241,7 +241,7 @@ __create_colgroup(WT_SESSION_IMPL *session,
"No 'columns' configuration for '%s'", name);
WT_ERR(__wt_buf_catfmt(session, &fmt, ",value_format="));
WT_ERR(__wt_struct_reformat(session,
- table, cval.str, cval.len, NULL, 1, &fmt));
+ table, cval.str, cval.len, NULL, true, &fmt));
}
sourcecfg[1] = fmt.data;
WT_ERR(__wt_config_concat(session, sourcecfg, &sourceconf));
@@ -310,7 +310,7 @@ __wt_schema_index_source(WT_SESSION_IMPL *session,
*/
static int
__create_index(WT_SESSION_IMPL *session,
- const char *name, int exclusive, const char *config)
+ const char *name, bool exclusive, const char *config)
{
WT_CONFIG kcols, pkcols;
WT_CONFIG_ITEM ckey, cval, icols, kval;
@@ -325,7 +325,7 @@ __create_index(WT_SESSION_IMPL *session,
const char *source, *idxname, *tablename;
char *sourceconf, *idxconf;
size_t tlen;
- int have_extractor;
+ bool have_extractor;
u_int i, npublic_cols;
idxconf = sourceconf = NULL;
@@ -333,7 +333,7 @@ __create_index(WT_SESSION_IMPL *session,
WT_CLEAR(fmt);
WT_CLEAR(extra_cols);
WT_CLEAR(namebuf);
- have_extractor = 0;
+ have_extractor = false;
tablename = name;
if (!WT_PREFIX_SKIP(tablename, "index:"))
@@ -345,7 +345,7 @@ __create_index(WT_SESSION_IMPL *session,
tlen = (size_t)(idxname++ - tablename);
if ((ret =
- __wt_schema_get_table(session, tablename, tlen, 1, &table)) != 0)
+ __wt_schema_get_table(session, tablename, tlen, true, &table)) != 0)
WT_RET_MSG(session, ret,
"Can't create an index for a non-existent table: %.*s",
(int)tlen, tablename);
@@ -370,7 +370,7 @@ __create_index(WT_SESSION_IMPL *session,
if (__wt_config_getones_none(
session, config, "extractor", &cval) == 0 && cval.len != 0) {
- have_extractor = 1;
+ have_extractor = true;
/* Custom extractors must supply a key format. */
if ((ret = __wt_config_getones(
session, config, "key_format", &kval)) != 0)
@@ -445,7 +445,7 @@ __create_index(WT_SESSION_IMPL *session,
* for custom extractors.
*/
WT_ERR(__wt_struct_reformat(session, table,
- icols.str, icols.len, (const char *)extra_cols.data, 0, &fmt));
+ icols.str, icols.len, (const char *)extra_cols.data, false, &fmt));
/* Check for a record number index key, which makes no sense. */
WT_ERR(__wt_config_getones(session, fmt.data, "key_format", &cval));
@@ -492,7 +492,7 @@ err: __wt_free(session, idxconf);
*/
static int
__create_table(WT_SESSION_IMPL *session,
- const char *name, int exclusive, const char *config)
+ const char *name, bool exclusive, const char *config)
{
WT_CONFIG conf;
WT_CONFIG_ITEM cgkey, cgval, cval;
@@ -514,7 +514,7 @@ __create_table(WT_SESSION_IMPL *session,
return (EINVAL);
if ((ret = __wt_schema_get_table(session,
- tablename, strlen(tablename), 0, &table)) == 0) {
+ tablename, strlen(tablename), false, &table)) == 0) {
__wt_schema_release_table(session, table);
return (exclusive ? EEXIST : 0);
}
@@ -541,7 +541,7 @@ __create_table(WT_SESSION_IMPL *session,
/* Attempt to open the table now to catch any errors. */
WT_ERR(__wt_schema_get_table(
- session, tablename, strlen(tablename), 1, &table));
+ session, tablename, strlen(tablename), true, &table));
if (ncolgroups == 0) {
cgsize = strlen("colgroup:") + strlen(tablename) + 1;
@@ -607,11 +607,11 @@ __wt_schema_create(
WT_CONFIG_ITEM cval;
WT_DATA_SOURCE *dsrc;
WT_DECL_RET;
- int exclusive;
+ bool exclusive;
- exclusive = (
+ exclusive =
__wt_config_getones(session, config, "exclusive", &cval) == 0 &&
- cval.val != 0);
+ cval.val != 0;
/*
* We track create operations: if we fail in the middle of creating a
@@ -637,7 +637,7 @@ __wt_schema_create(
ret = __wt_bad_object_type(session, uri);
session->dhandle = NULL;
- WT_TRET(__wt_meta_track_off(session, 1, ret != 0));
+ WT_TRET(__wt_meta_track_off(session, true, ret != 0));
return (ret);
}
diff --git a/src/third_party/wiredtiger/src/schema/schema_drop.c b/src/third_party/wiredtiger/src/schema/schema_drop.c
index 694d07c65bf..9b9f3a23961 100644
--- a/src/third_party/wiredtiger/src/schema/schema_drop.c
+++ b/src/third_party/wiredtiger/src/schema/schema_drop.c
@@ -14,22 +14,22 @@
*/
static int
__drop_file(
- WT_SESSION_IMPL *session, const char *uri, int force, const char *cfg[])
+ WT_SESSION_IMPL *session, const char *uri, bool force, const char *cfg[])
{
WT_CONFIG_ITEM cval;
WT_DECL_RET;
- int remove_files;
+ bool remove_files;
const char *filename;
WT_RET(__wt_config_gets(session, cfg, "remove_files", &cval));
- remove_files = (cval.val != 0);
+ remove_files = cval.val != 0;
filename = uri;
if (!WT_PREFIX_SKIP(filename, "file:"))
return (EINVAL);
/* Close all btree handles associated with this file. */
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_conn_dhandle_close_all(session, uri, force));
WT_RET(ret);
@@ -53,18 +53,18 @@ __drop_file(
*/
static int
__drop_colgroup(
- WT_SESSION_IMPL *session, const char *uri, int force, const char *cfg[])
+ WT_SESSION_IMPL *session, const char *uri, bool force, const char *cfg[])
{
WT_COLGROUP *colgroup;
WT_DECL_RET;
WT_TABLE *table;
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_TABLE_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_TABLE));
/* If we can get the colgroup, detach it from the table. */
if ((ret = __wt_schema_get_colgroup(
session, uri, force, &table, &colgroup)) == 0) {
- table->cg_complete = 0;
+ table->cg_complete = false;
WT_TRET(__wt_schema_drop(session, colgroup->source, cfg));
}
@@ -78,7 +78,7 @@ __drop_colgroup(
*/
static int
__drop_index(
- WT_SESSION_IMPL *session, const char *uri, int force, const char *cfg[])
+ WT_SESSION_IMPL *session, const char *uri, bool force, const char *cfg[])
{
WT_INDEX *idx;
WT_DECL_RET;
@@ -87,7 +87,7 @@ __drop_index(
/* If we can get the colgroup, detach it from the table. */
if ((ret = __wt_schema_get_index(
session, uri, force, &table, &idx)) == 0) {
- table->idx_complete = 0;
+ table->idx_complete = false;
WT_TRET(__wt_schema_drop(session, idx->source, cfg));
}
@@ -100,8 +100,7 @@ __drop_index(
* WT_SESSION::drop for a table.
*/
static int
-__drop_table(
- WT_SESSION_IMPL *session, const char *uri, const char *cfg[])
+__drop_table(WT_SESSION_IMPL *session, const char *uri, const char *cfg[])
{
WT_COLGROUP *colgroup;
WT_DECL_RET;
@@ -114,7 +113,8 @@ __drop_table(
(void)WT_PREFIX_SKIP(name, "table:");
table = NULL;
- WT_ERR(__wt_schema_get_table(session, name, strlen(name), 1, &table));
+ WT_ERR(__wt_schema_get_table(
+ session, name, strlen(name), true, &table));
/* Drop the column groups. */
for (i = 0; i < WT_COLGROUPS(table); i++) {
@@ -164,10 +164,10 @@ __wt_schema_drop(WT_SESSION_IMPL *session, const char *uri, const char *cfg[])
WT_CONFIG_ITEM cval;
WT_DATA_SOURCE *dsrc;
WT_DECL_RET;
- int force;
+ bool force;
WT_RET(__wt_config_gets_def(session, cfg, "force", 0, &cval));
- force = (cval.val != 0);
+ force = cval.val != 0;
WT_RET(__wt_meta_track_on(session));
@@ -202,7 +202,7 @@ __wt_schema_drop(WT_SESSION_IMPL *session, const char *uri, const char *cfg[])
/* Bump the schema generation so that stale data is ignored. */
++S2C(session)->schema_gen;
- WT_TRET(__wt_meta_track_off(session, 1, ret != 0));
+ WT_TRET(__wt_meta_track_off(session, true, ret != 0));
return (ret);
}
diff --git a/src/third_party/wiredtiger/src/schema/schema_list.c b/src/third_party/wiredtiger/src/schema/schema_list.c
index 5ab9f1c160e..3390c950e18 100644
--- a/src/third_party/wiredtiger/src/schema/schema_list.c
+++ b/src/third_party/wiredtiger/src/schema/schema_list.c
@@ -14,7 +14,7 @@
*/
static int
__schema_add_table(WT_SESSION_IMPL *session,
- const char *name, size_t namelen, int ok_incomplete, WT_TABLE **tablep)
+ const char *name, size_t namelen, bool ok_incomplete, WT_TABLE **tablep)
{
WT_DECL_RET;
WT_TABLE *table;
@@ -86,7 +86,7 @@ restart:
*/
int
__wt_schema_get_table(WT_SESSION_IMPL *session,
- const char *name, size_t namelen, int ok_incomplete, WT_TABLE **tablep)
+ const char *name, size_t namelen, bool ok_incomplete, WT_TABLE **tablep)
{
WT_DECL_RET;
WT_TABLE *table;
diff --git a/src/third_party/wiredtiger/src/schema/schema_open.c b/src/third_party/wiredtiger/src/schema/schema_open.c
index 414722652a0..b50ab566d08 100644
--- a/src/third_party/wiredtiger/src/schema/schema_open.c
+++ b/src/third_party/wiredtiger/src/schema/schema_open.c
@@ -44,7 +44,7 @@ __wt_schema_open_colgroups(WT_SESSION_IMPL *session, WT_TABLE *table)
char *cgconfig;
u_int i;
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_TABLE_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_TABLE));
if (table->cg_complete)
return (0);
@@ -107,12 +107,12 @@ __wt_schema_open_colgroups(WT_SESSION_IMPL *session, WT_TABLE *table)
WT_ERR(__wt_buf_init(session, buf, 0));
WT_ERR(__wt_struct_plan(session,
- table, table->colconf.str, table->colconf.len, 1, buf));
+ table, table->colconf.str, table->colconf.len, true, buf));
WT_ERR(__wt_strndup(
session, buf->data, buf->size, &table->plan));
}
- table->cg_complete = 1;
+ table->cg_complete = true;
err: __wt_scr_free(session, &buf);
if (colgroup != NULL)
@@ -231,7 +231,8 @@ __open_index(WT_SESSION_IMPL *session, WT_TABLE *table, WT_INDEX *idx)
goto err;
WT_ERR(__wt_scr_alloc(session, 0, &plan));
- WT_ERR(__wt_struct_plan(session, table, buf->data, buf->size, 0, plan));
+ WT_ERR(__wt_struct_plan(
+ session, table, buf->data, buf->size, false, plan));
WT_ERR(__wt_strndup(session, plan->data, plan->size, &idx->key_plan));
/* Set up the cursor key format (the visible columns). */
@@ -254,7 +255,7 @@ __open_index(WT_SESSION_IMPL *session, WT_TABLE *table, WT_INDEX *idx)
/* TODO Optimize to use index columns in preference to table lookups. */
WT_ERR(__wt_buf_init(session, plan, 0));
WT_ERR(__wt_struct_plan(session,
- table, table->colconf.str, table->colconf.len, 1, plan));
+ table, table->colconf.str, table->colconf.len, true, plan));
WT_ERR(__wt_strndup(session, plan->data, plan->size, &idx->value_plan));
err: __wt_scr_free(session, &buf);
@@ -275,7 +276,8 @@ __wt_schema_open_index(WT_SESSION_IMPL *session,
WT_DECL_RET;
WT_INDEX *idx;
u_int i;
- int cmp, match;
+ int cmp;
+ bool match;
const char *idxconf, *name, *tablename, *uri;
/* Check if we've already done the work. */
@@ -284,7 +286,7 @@ __wt_schema_open_index(WT_SESSION_IMPL *session,
cursor = NULL;
idx = NULL;
- match = 0;
+ match = false;
/* Build a search key. */
tablename = table->name;
@@ -365,7 +367,7 @@ __wt_schema_open_index(WT_SESSION_IMPL *session,
/* If we did a full pass, we won't need to do it again. */
if (idxname == NULL) {
table->nindices = i;
- table->idx_complete = 1;
+ table->idx_complete = true;
}
err: __wt_scr_free(session, &tmp);
@@ -392,7 +394,7 @@ __wt_schema_open_indices(WT_SESSION_IMPL *session, WT_TABLE *table)
*/
int
__wt_schema_open_table(WT_SESSION_IMPL *session,
- const char *name, size_t namelen, int ok_incomplete, WT_TABLE **tablep)
+ const char *name, size_t namelen, bool ok_incomplete, WT_TABLE **tablep)
{
WT_CONFIG cparser;
WT_CONFIG_ITEM ckey, cval;
@@ -407,7 +409,7 @@ __wt_schema_open_table(WT_SESSION_IMPL *session,
table = NULL;
tablename = NULL;
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_TABLE_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_TABLE));
WT_ERR(__wt_scr_alloc(session, 0, &buf));
WT_ERR(__wt_buf_fmt(session, buf, "table:%.*s", (int)namelen, name));
@@ -440,9 +442,9 @@ __wt_schema_open_table(WT_SESSION_IMPL *session,
* are not named.
*/
WT_ERR(__wt_config_subinit(session, &cparser, &table->colconf));
- table->is_simple = 1;
+ table->is_simple = true;
while ((ret = __wt_config_next(&cparser, &ckey, &cval)) == 0)
- table->is_simple = 0;
+ table->is_simple = false;
if (ret != WT_NOTFOUND)
goto err;
@@ -498,7 +500,7 @@ err: if (table != NULL)
*/
int
__wt_schema_get_colgroup(WT_SESSION_IMPL *session,
- const char *uri, int quiet, WT_TABLE **tablep, WT_COLGROUP **colgroupp)
+ const char *uri, bool quiet, WT_TABLE **tablep, WT_COLGROUP **colgroupp)
{
WT_COLGROUP *colgroup;
WT_TABLE *table;
@@ -515,7 +517,7 @@ __wt_schema_get_colgroup(WT_SESSION_IMPL *session,
tend = tablename + strlen(tablename);
WT_RET(__wt_schema_get_table(session,
- tablename, WT_PTRDIFF(tend, tablename), 0, &table));
+ tablename, WT_PTRDIFF(tend, tablename), false, &table));
for (i = 0; i < WT_COLGROUPS(table); i++) {
colgroup = table->cgroups[i];
@@ -541,7 +543,7 @@ __wt_schema_get_colgroup(WT_SESSION_IMPL *session,
*/
int
__wt_schema_get_index(WT_SESSION_IMPL *session,
- const char *uri, int quiet, WT_TABLE **tablep, WT_INDEX **indexp)
+ const char *uri, bool quiet, WT_TABLE **tablep, WT_INDEX **indexp)
{
WT_DECL_RET;
WT_INDEX *idx;
@@ -557,7 +559,7 @@ __wt_schema_get_index(WT_SESSION_IMPL *session,
return (__wt_bad_object_type(session, uri));
WT_RET(__wt_schema_get_table(session,
- tablename, WT_PTRDIFF(tend, tablename), 0, &table));
+ tablename, WT_PTRDIFF(tend, tablename), false, &table));
/* Try to find the index in the table. */
for (i = 0; i < table->nindices; i++) {
diff --git a/src/third_party/wiredtiger/src/schema/schema_plan.c b/src/third_party/wiredtiger/src/schema/schema_plan.c
index 918cbe68fcc..066e666190b 100644
--- a/src/third_party/wiredtiger/src/schema/schema_plan.c
+++ b/src/third_party/wiredtiger/src/schema/schema_plan.c
@@ -21,14 +21,14 @@ __find_next_col(WT_SESSION_IMPL *session, WT_TABLE *table,
WT_CONFIG_ITEM cval, k, v;
WT_DECL_RET;
u_int cg, col, foundcg, foundcol, matchcg, matchcol;
- int getnext;
+ bool getnext;
foundcg = foundcol = UINT_MAX;
matchcg = *cgnump;
matchcol = (*coltype == WT_PROJ_KEY) ?
*colnump : *colnump + table->nkey_columns;
- getnext = 1;
+ getnext = true;
for (colgroup = NULL, cg = 0; cg < WT_COLGROUPS(table); cg++) {
colgroup = table->cgroups[cg];
@@ -53,7 +53,7 @@ cgcols: cval = colgroup->colconf;
foundcg = cg;
foundcol = col;
}
- getnext = (cg == matchcg && col == matchcol);
+ getnext = cg == matchcg && col == matchcol;
}
if (cg == 0 && table->ncolgroups > 0 &&
col == table->nkey_columns - 1)
@@ -174,13 +174,13 @@ __wt_table_check(WT_SESSION_IMPL *session, WT_TABLE *table)
*/
int
__wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table,
- const char *columns, size_t len, int value_only, WT_ITEM *plan)
+ const char *columns, size_t len, bool value_only, WT_ITEM *plan)
{
WT_CONFIG conf;
WT_CONFIG_ITEM k, v;
WT_DECL_RET;
u_int cg, col, current_cg, current_col, i, start_cg, start_col;
- int have_it;
+ bool have_it;
char coltype, current_coltype;
start_cg = start_col = UINT_MAX; /* -Wuninitialized */
@@ -195,7 +195,7 @@ __wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table,
current_col = col = INT_MAX;
current_coltype = coltype = WT_PROJ_KEY; /* Keep lint quiet. */
for (i = 0; (ret = __wt_config_next(&conf, &k, &v)) == 0; i++) {
- have_it = 0;
+ have_it = false;
while ((ret = __find_next_col(session, table,
&k, &cg, &col, &coltype)) == 0 &&
@@ -242,7 +242,7 @@ __wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table,
start_cg = cg;
start_col = col;
- have_it = 1;
+ have_it = true;
} else
WT_RET(__wt_buf_catfmt(session,
plan, "%c", WT_PROJ_REUSE));
@@ -272,25 +272,25 @@ __wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table,
* Find the format of the named column.
*/
static int
-__find_column_format(WT_SESSION_IMPL *session,
- WT_TABLE *table, WT_CONFIG_ITEM *colname, int value_only, WT_PACK_VALUE *pv)
+__find_column_format(WT_SESSION_IMPL *session, WT_TABLE *table,
+ WT_CONFIG_ITEM *colname, bool value_only, WT_PACK_VALUE *pv)
{
WT_CONFIG conf;
WT_CONFIG_ITEM k, v;
WT_DECL_RET;
WT_PACK pack;
- int inkey;
+ bool inkey;
WT_RET(__wt_config_subinit(session, &conf, &table->colconf));
WT_RET(__pack_init(session, &pack, table->key_format));
- inkey = 1;
+ inkey = true;
while ((ret = __wt_config_next(&conf, &k, &v)) == 0) {
if ((ret = __pack_next(&pack, pv)) == WT_NOTFOUND && inkey) {
ret = __pack_init(session, &pack, table->value_format);
if (ret == 0)
ret = __pack_next(&pack, pv);
- inkey = 0;
+ inkey = false;
}
if (ret != 0)
return (ret);
@@ -314,14 +314,14 @@ __find_column_format(WT_SESSION_IMPL *session,
*/
int
__wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table,
- const char *columns, size_t len, const char *extra_cols, int value_only,
+ const char *columns, size_t len, const char *extra_cols, bool value_only,
WT_ITEM *format)
{
WT_CONFIG config;
WT_CONFIG_ITEM k, next_k, next_v;
WT_DECL_PACK_VALUE(pv);
WT_DECL_RET;
- int have_next;
+ bool have_next;
WT_RET(__wt_config_initn(session, &config, columns, len));
/*
@@ -344,12 +344,12 @@ __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table,
ret = __wt_config_next(&config, &next_k, &next_v);
if (ret != 0 && ret != WT_NOTFOUND)
return (ret);
- have_next = (ret == 0);
+ have_next = ret == 0;
if (!have_next && extra_cols != NULL) {
WT_RET(__wt_config_init(session, &config, extra_cols));
WT_RET(__wt_config_next(&config, &next_k, &next_v));
- have_next = 1;
+ have_next = true;
extra_cols = NULL;
}
diff --git a/src/third_party/wiredtiger/src/schema/schema_project.c b/src/third_party/wiredtiger/src/schema/schema_project.c
index c9b69b3c922..be5f73b48ed 100644
--- a/src/third_party/wiredtiger/src/schema/schema_project.c
+++ b/src/third_party/wiredtiger/src/schema/schema_project.c
@@ -220,7 +220,7 @@ __wt_schema_project_out(WT_SESSION_IMPL *session,
*/
int
__wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp,
- const char *proj_arg, int key_only, const char *vformat, WT_ITEM *value)
+ const char *proj_arg, bool key_only, const char *vformat, WT_ITEM *value)
{
WT_CURSOR *c;
WT_DECL_ITEM(buf);
@@ -233,7 +233,7 @@ __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp,
uint8_t *end, *p;
const uint8_t *next, *vp, *vend;
size_t len, offset, old_len;
- int skip;
+ bool skip;
p = end = NULL; /* -Wuninitialized */
@@ -259,7 +259,7 @@ __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp,
switch (*proj) {
case WT_PROJ_KEY:
- skip = 0;
+ skip = false;
c = cp[arg];
if (WT_CURSOR_RECNO(c)) {
c->key.data = &c->recno;
@@ -274,7 +274,8 @@ __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp,
continue;
case WT_PROJ_VALUE:
- if ((skip = key_only) != 0)
+ skip = key_only;
+ if (skip)
continue;
c = cp[arg];
WT_RET(__pack_init(session, &pack, c->value_format));
diff --git a/src/third_party/wiredtiger/src/schema/schema_rename.c b/src/third_party/wiredtiger/src/schema/schema_rename.c
index c00ffa7d61c..8a347f2c39f 100644
--- a/src/third_party/wiredtiger/src/schema/schema_rename.c
+++ b/src/third_party/wiredtiger/src/schema/schema_rename.c
@@ -17,7 +17,7 @@ __rename_file(
WT_SESSION_IMPL *session, const char *uri, const char *newuri)
{
WT_DECL_RET;
- int exist;
+ bool exist;
const char *filename, *newfile;
char *newvalue, *oldvalue;
@@ -30,8 +30,8 @@ __rename_file(
return (EINVAL);
/* Close any btree handles in the file. */
- WT_WITH_DHANDLE_LOCK(session,
- ret = __wt_conn_dhandle_close_all(session, uri, 0));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ ret = __wt_conn_dhandle_close_all(session, uri, false));
WT_ERR(ret);
/*
@@ -87,9 +87,9 @@ __rename_tree(WT_SESSION_IMPL *session,
WT_DECL_ITEM(nv);
WT_DECL_ITEM(os);
WT_DECL_RET;
+ bool is_colgroup;
const char *newname, *olduri, *suffix;
char *value;
- int is_colgroup;
olduri = table->name;
value = NULL;
@@ -211,7 +211,7 @@ __rename_table(WT_SESSION_IMPL *session,
(void)WT_PREFIX_SKIP(oldname, "table:");
WT_RET(__wt_schema_get_table(
- session, oldname, strlen(oldname), 0, &table));
+ session, oldname, strlen(oldname), false, &table));
/* Rename the column groups. */
for (i = 0; i < WT_COLGROUPS(table); i++)
@@ -277,7 +277,7 @@ __wt_schema_rename(WT_SESSION_IMPL *session,
/* Bump the schema generation so that stale data is ignored. */
++S2C(session)->schema_gen;
- WT_TRET(__wt_meta_track_off(session, 1, ret != 0));
+ WT_TRET(__wt_meta_track_off(session, true, ret != 0));
/* If we didn't find a metadata entry, map that error to ENOENT. */
return (ret == WT_NOTFOUND ? ENOENT : ret);
diff --git a/src/third_party/wiredtiger/src/schema/schema_stat.c b/src/third_party/wiredtiger/src/schema/schema_stat.c
index dea797f823d..df8e23eb604 100644
--- a/src/third_party/wiredtiger/src/schema/schema_stat.c
+++ b/src/third_party/wiredtiger/src/schema/schema_stat.c
@@ -20,7 +20,7 @@ __wt_curstat_colgroup_init(WT_SESSION_IMPL *session,
WT_DECL_ITEM(buf);
WT_DECL_RET;
- WT_RET(__wt_schema_get_colgroup(session, uri, 0, NULL, &colgroup));
+ WT_RET(__wt_schema_get_colgroup(session, uri, false, NULL, &colgroup));
WT_RET(__wt_scr_alloc(session, 0, &buf));
WT_ERR(__wt_buf_fmt(session, buf, "statistics:%s", colgroup->source));
@@ -42,7 +42,7 @@ __wt_curstat_index_init(WT_SESSION_IMPL *session,
WT_DECL_RET;
WT_INDEX *idx;
- WT_RET(__wt_schema_get_index(session, uri, 0, NULL, &idx));
+ WT_RET(__wt_schema_get_index(session, uri, false, NULL, &idx));
WT_RET(__wt_scr_alloc(session, 0, &buf));
WT_ERR(__wt_buf_fmt(session, buf, "statistics:%s", idx->source));
@@ -69,7 +69,8 @@ __wt_curstat_table_init(WT_SESSION_IMPL *session,
const char *name;
name = uri + strlen("table:");
- WT_RET(__wt_schema_get_table(session, name, strlen(name), 0, &table));
+ WT_RET(__wt_schema_get_table(
+ session, name, strlen(name), false, &table));
WT_ERR(__wt_scr_alloc(session, 0, &buf));
diff --git a/src/third_party/wiredtiger/src/schema/schema_truncate.c b/src/third_party/wiredtiger/src/schema/schema_truncate.c
index 1eb76226aad..4e9180cfe8f 100644
--- a/src/third_party/wiredtiger/src/schema/schema_truncate.c
+++ b/src/third_party/wiredtiger/src/schema/schema_truncate.c
@@ -33,8 +33,8 @@ __truncate_file(WT_SESSION_IMPL *session, const char *name)
WT_RET(__wt_session_release_btree(session));
/* Close any btree handles in the file. */
- WT_WITH_DHANDLE_LOCK(session,
- ret = __wt_conn_dhandle_close_all(session, name, 0));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ ret = __wt_conn_dhandle_close_all(session, name, false));
WT_RET(ret);
/* Delete the root address and truncate the file. */
@@ -55,7 +55,8 @@ __truncate_table(WT_SESSION_IMPL *session, const char *name, const char *cfg[])
WT_TABLE *table;
u_int i;
- WT_RET(__wt_schema_get_table(session, name, strlen(name), 0, &table));
+ WT_RET(
+ __wt_schema_get_table(session, name, strlen(name), false, &table));
/* Truncate the column groups. */
for (i = 0; i < WT_COLGROUPS(table); i++)
diff --git a/src/third_party/wiredtiger/src/schema/schema_worker.c b/src/third_party/wiredtiger/src/schema/schema_worker.c
index e913fcfe69d..e429327973e 100644
--- a/src/third_party/wiredtiger/src/schema/schema_worker.c
+++ b/src/third_party/wiredtiger/src/schema/schema_worker.c
@@ -17,7 +17,7 @@ int
__wt_schema_worker(WT_SESSION_IMPL *session,
const char *uri,
int (*file_func)(WT_SESSION_IMPL *, const char *[]),
- int (*name_func)(WT_SESSION_IMPL *, const char *, int *),
+ int (*name_func)(WT_SESSION_IMPL *, const char *, bool *),
const char *cfg[], uint32_t open_flags)
{
WT_COLGROUP *colgroup;
@@ -28,12 +28,12 @@ __wt_schema_worker(WT_SESSION_IMPL *session,
WT_TABLE *table;
const char *tablename;
u_int i;
- int skip;
+ bool skip;
table = NULL;
tablename = uri;
- skip = 0;
+ skip = false;
if (name_func != NULL)
WT_ERR(name_func(session, uri, &skip));
@@ -49,9 +49,9 @@ __wt_schema_worker(WT_SESSION_IMPL *session,
* any open file handles, including checkpoints.
*/
if (FLD_ISSET(open_flags, WT_DHANDLE_EXCLUSIVE)) {
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_conn_dhandle_close_all(
- session, uri, 0));
+ session, uri, false));
WT_ERR(ret);
}
@@ -62,19 +62,19 @@ __wt_schema_worker(WT_SESSION_IMPL *session,
WT_TRET(__wt_session_release_btree(session));
} else if (ret == EBUSY)
/* TODO: Decode checkpoint from cfg. */
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_conn_btree_apply_single_ckpt(
session, uri, file_func, cfg));
WT_ERR(ret);
}
} else if (WT_PREFIX_MATCH(uri, "colgroup:")) {
WT_ERR(__wt_schema_get_colgroup(
- session, uri, 0, NULL, &colgroup));
+ session, uri, false, NULL, &colgroup));
WT_ERR(__wt_schema_worker(session,
colgroup->source, file_func, name_func, cfg, open_flags));
} else if (WT_PREFIX_SKIP(tablename, "index:")) {
idx = NULL;
- WT_ERR(__wt_schema_get_index(session, uri, 0, NULL, &idx));
+ WT_ERR(__wt_schema_get_index(session, uri, false, NULL, &idx));
WT_ERR(__wt_schema_worker(session, idx->source,
file_func, name_func, cfg, open_flags));
} else if (WT_PREFIX_MATCH(uri, "lsm:")) {
@@ -87,7 +87,7 @@ __wt_schema_worker(WT_SESSION_IMPL *session,
uri, file_func, name_func, cfg, open_flags));
} else if (WT_PREFIX_SKIP(tablename, "table:")) {
WT_ERR(__wt_schema_get_table(session,
- tablename, strlen(tablename), 0, &table));
+ tablename, strlen(tablename), false, &table));
WT_ASSERT(session, session->dhandle == NULL);
/*
@@ -98,7 +98,7 @@ __wt_schema_worker(WT_SESSION_IMPL *session,
*/
for (i = 0; i < WT_COLGROUPS(table); i++) {
colgroup = table->cgroups[i];
- skip = 0;
+ skip = false;
if (name_func != NULL)
WT_ERR(name_func(
session, colgroup->name, &skip));
@@ -111,7 +111,7 @@ __wt_schema_worker(WT_SESSION_IMPL *session,
WT_ERR(__wt_schema_open_indices(session, table));
for (i = 0; i < table->nindices; i++) {
idx = table->indices[i];
- skip = 0;
+ skip = false;
if (name_func != NULL)
WT_ERR(name_func(session, idx->name, &skip));
if (!skip)
diff --git a/src/third_party/wiredtiger/src/session/session_api.c b/src/third_party/wiredtiger/src/session/session_api.c
index af30edb9251..f71ff8ea71c 100644
--- a/src/third_party/wiredtiger/src/session/session_api.c
+++ b/src/third_party/wiredtiger/src/session/session_api.c
@@ -95,7 +95,7 @@ __session_close(WT_SESSION *wt_session, const char *config)
WT_UNUSED(cfg);
/* Rollback any active transaction. */
- if (F_ISSET(&session->txn, TXN_RUNNING))
+ if (F_ISSET(&session->txn, WT_TXN_RUNNING))
WT_TRET(__session_rollback_transaction(wt_session, NULL));
/*
@@ -193,7 +193,7 @@ __session_reconfigure(WT_SESSION *wt_session, const char *config)
session = (WT_SESSION_IMPL *)wt_session;
SESSION_API_CALL(session, reconfigure, config, cfg);
- if (F_ISSET(&session->txn, TXN_RUNNING))
+ if (F_ISSET(&session->txn, WT_TXN_RUNNING))
WT_ERR_MSG(session, EINVAL, "transaction in progress");
WT_TRET(__wt_session_reset_cursors(session));
@@ -246,7 +246,7 @@ __wt_open_cursor(WT_SESSION_IMPL *session,
* the underlying data source.
*/
WT_RET(__wt_schema_get_colgroup(
- session, uri, 0, NULL, &colgroup));
+ session, uri, false, NULL, &colgroup));
WT_RET(__wt_open_cursor(
session, colgroup->source, owner, cfg, cursorp));
} else if (WT_PREFIX_MATCH(uri, "config:"))
@@ -602,9 +602,10 @@ __session_truncate(WT_SESSION *wt_session,
WT_DECL_RET;
WT_SESSION_IMPL *session;
WT_CURSOR *cursor;
- int cmp, local_start;
+ int cmp;
+ bool local_start;
- local_start = 0;
+ local_start = false;
session = (WT_SESSION_IMPL *)wt_session;
SESSION_TXN_API_CALL(session, truncate, config, cfg);
@@ -708,7 +709,7 @@ __session_truncate(WT_SESSION *wt_session,
if (start == NULL) {
WT_ERR(__session_open_cursor(
wt_session, stop->uri, NULL, NULL, &start));
- local_start = 1;
+ local_start = true;
WT_ERR(start->next(start));
}
@@ -798,7 +799,7 @@ __session_begin_transaction(WT_SESSION *wt_session, const char *config)
SESSION_API_CALL(session, begin_transaction, config, cfg);
WT_STAT_FAST_CONN_INCR(session, txn_begin);
- if (F_ISSET(&session->txn, TXN_RUNNING))
+ if (F_ISSET(&session->txn, WT_TXN_RUNNING))
WT_ERR_MSG(session, EINVAL, "Transaction already running");
ret = __wt_txn_begin(session, cfg);
@@ -822,7 +823,7 @@ __session_commit_transaction(WT_SESSION *wt_session, const char *config)
WT_STAT_FAST_CONN_INCR(session, txn_commit);
txn = &session->txn;
- if (F_ISSET(txn, TXN_ERROR)) {
+ if (F_ISSET(txn, WT_TXN_ERROR)) {
__wt_errx(session, "failed transaction requires rollback");
ret = EINVAL;
}
@@ -877,7 +878,7 @@ __session_transaction_pinned_range(WT_SESSION *wt_session, uint64_t *prange)
/* Assign pinned to the lesser of id or snap_min */
if (txn_state->id != WT_TXN_NONE &&
- TXNID_LT(txn_state->id, txn_state->snap_min))
+ WT_TXNID_LT(txn_state->id, txn_state->snap_min))
pinned = txn_state->id;
else
pinned = txn_state->snap_min;
@@ -921,7 +922,7 @@ __session_checkpoint(WT_SESSION *wt_session, const char *config)
* from evicting anything newer than this because we track the oldest
* transaction ID in the system that is not visible to all readers.
*/
- if (F_ISSET(txn, TXN_RUNNING))
+ if (F_ISSET(txn, WT_TXN_RUNNING))
WT_ERR_MSG(session, EINVAL,
"Checkpoint not permitted in a transaction");
@@ -982,7 +983,7 @@ __session_strerror(WT_SESSION *wt_session, int error)
*/
int
__wt_open_internal_session(WT_CONNECTION_IMPL *conn, const char *name,
- int uses_dhandles, int open_metadata, WT_SESSION_IMPL **sessionp)
+ bool uses_dhandles, bool open_metadata, WT_SESSION_IMPL **sessionp)
{
WT_SESSION_IMPL *session;
@@ -1015,7 +1016,7 @@ __wt_open_internal_session(WT_CONNECTION_IMPL *conn, const char *name,
* pool creates its sessions, let our caller decline this work.
*/
if (open_metadata) {
- WT_ASSERT(session, !F_ISSET(session, WT_SESSION_SCHEMA_LOCKED));
+ WT_ASSERT(session, !F_ISSET(session, WT_SESSION_LOCKED_SCHEMA));
WT_RET(__wt_metadata_open(session));
}
@@ -1097,7 +1098,7 @@ __wt_open_session(WT_CONNECTION_IMPL *conn,
session_ret->iface = stds;
session_ret->iface.connection = &conn->iface;
- WT_ERR(__wt_cond_alloc(session, "session", 0, &session_ret->cond));
+ WT_ERR(__wt_cond_alloc(session, "session", false, &session_ret->cond));
if (WT_SESSION_FIRST_USE(session_ret))
__wt_random_init(&session_ret->rnd);
diff --git a/src/third_party/wiredtiger/src/session/session_compact.c b/src/third_party/wiredtiger/src/session/session_compact.c
index 2a18eb3be93..58b6218b8c1 100644
--- a/src/third_party/wiredtiger/src/session/session_compact.c
+++ b/src/third_party/wiredtiger/src/session/session_compact.c
@@ -103,7 +103,7 @@
* Called via the schema_worker function.
*/
int
-__wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, int *skip)
+__wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, bool *skipp)
{
/*
* Add references to schema URI objects to the list of objects to be
@@ -112,7 +112,7 @@ __wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, int *skip)
*/
if (WT_PREFIX_MATCH(uri, "lsm:")) {
session->compact->lsm_count++;
- *skip = 1;
+ *skipp = true;
} else if (WT_PREFIX_MATCH(uri, "file:"))
session->compact->file_count++;
@@ -161,7 +161,8 @@ __compact_file(WT_SESSION_IMPL *session, const char *uri, const char *cfg[])
* transactional context. Check now so the error message isn't
* confusing.
*/
- if (session->compact->file_count != 0 && F_ISSET(txn, TXN_RUNNING))
+ if (session->compact->file_count != 0 &&
+ F_ISSET(txn, WT_TXN_RUNNING))
WT_ERR_MSG(session, EINVAL,
" File compaction not permitted in a transaction");
@@ -184,7 +185,7 @@ __compact_file(WT_SESSION_IMPL *session, const char *uri, const char *cfg[])
for (i = 0; i < 100; ++i) {
WT_ERR(wt_session->checkpoint(wt_session, t->data));
- session->compaction = 0;
+ session->compaction = false;
WT_WITH_SCHEMA_LOCK(session,
ret = __wt_schema_worker(
session, uri, __wt_compact, NULL, cfg, 0));
diff --git a/src/third_party/wiredtiger/src/session/session_dhandle.c b/src/third_party/wiredtiger/src/session/session_dhandle.c
index a087e7c896d..63635b54032 100644
--- a/src/third_party/wiredtiger/src/session/session_dhandle.c
+++ b/src/third_party/wiredtiger/src/session/session_dhandle.c
@@ -102,7 +102,8 @@ retry: TAILQ_FOREACH(dhandle_cache, &session->dhhash[bucket], hashq) {
* the schema lock.
*/
int
-__wt_session_lock_dhandle(WT_SESSION_IMPL *session, uint32_t flags, int *deadp)
+__wt_session_lock_dhandle(
+ WT_SESSION_IMPL *session, uint32_t flags, bool *is_deadp)
{
enum { NOLOCK, READLOCK, WRITELOCK } locked;
WT_BTREE *btree;
@@ -112,15 +113,15 @@ __wt_session_lock_dhandle(WT_SESSION_IMPL *session, uint32_t flags, int *deadp)
btree = S2BT(session);
dhandle = session->dhandle;
locked = NOLOCK;
- if (deadp != NULL)
- *deadp = 0;
+ if (is_deadp != NULL)
+ *is_deadp = false;
/*
* Special operation flags will cause the handle to be reopened.
* For example, a handle opened with WT_BTREE_BULK cannot use the same
* internal data structures as a handle opened for ordinary access.
*/
- special_flags = LF_ISSET(WT_BTREE_SPECIAL_FLAGS);
+ special_flags = LF_MASK(WT_BTREE_SPECIAL_FLAGS);
WT_ASSERT(session,
special_flags == 0 || LF_ISSET(WT_DHANDLE_EXCLUSIVE));
@@ -153,8 +154,8 @@ __wt_session_lock_dhandle(WT_SESSION_IMPL *session, uint32_t flags, int *deadp)
* that no special flags are required.
*/
if (F_ISSET(dhandle, WT_DHANDLE_DEAD)) {
- WT_ASSERT(session, deadp != NULL);
- *deadp = 1;
+ WT_ASSERT(session, is_deadp != NULL);
+ *is_deadp = 1;
} else if (LF_ISSET(WT_DHANDLE_LOCK_ONLY) ||
(F_ISSET(dhandle, WT_DHANDLE_OPEN) && special_flags == 0))
return (0);
@@ -208,13 +209,13 @@ __wt_session_release_btree(WT_SESSION_IMPL *session)
}
if (F_ISSET(dhandle, WT_DHANDLE_DISCARD_FORCE)) {
- WT_WITH_DHANDLE_LOCK(session,
- ret = __wt_conn_btree_sync_and_close(session, 0, 1));
+ WT_WITH_HANDLE_LIST_LOCK(session,
+ ret = __wt_conn_btree_sync_and_close(session, false, true));
F_CLR(dhandle, WT_DHANDLE_DISCARD_FORCE);
} else if (F_ISSET(dhandle, WT_DHANDLE_DISCARD) ||
F_ISSET(btree, WT_BTREE_SPECIAL_FLAGS)) {
WT_ASSERT(session, F_ISSET(dhandle, WT_DHANDLE_EXCLUSIVE));
- ret = __wt_conn_btree_sync_and_close(session, 0, 0);
+ ret = __wt_conn_btree_sync_and_close(session, false, false);
F_CLR(dhandle, WT_DHANDLE_DISCARD);
}
@@ -247,10 +248,10 @@ __wt_session_get_btree_ckpt(WT_SESSION_IMPL *session,
{
WT_CONFIG_ITEM cval;
WT_DECL_RET;
- int last_ckpt;
+ bool last_ckpt;
const char *checkpoint;
- last_ckpt = 0;
+ last_ckpt = false;
checkpoint = NULL;
/*
@@ -265,7 +266,7 @@ __wt_session_get_btree_ckpt(WT_SESSION_IMPL *session,
* unnamed checkpoint of the object.
*/
if (WT_STRING_MATCH(WT_CHECKPOINT, cval.str, cval.len)) {
- last_ckpt = 1;
+ last_ckpt = true;
retry: WT_RET(__wt_meta_checkpoint_last_name(
session, uri, &checkpoint));
} else
@@ -377,7 +378,7 @@ __wt_session_get_btree(WT_SESSION_IMPL *session,
WT_DATA_HANDLE *dhandle;
WT_DATA_HANDLE_CACHE *dhandle_cache;
WT_DECL_RET;
- int is_dead;
+ bool is_dead;
WT_ASSERT(session, !F_ISSET(session, WT_SESSION_NO_DATA_HANDLES));
WT_ASSERT(session, !LF_ISSET(WT_DHANDLE_HAVE_REF));
@@ -391,7 +392,7 @@ __wt_session_get_btree(WT_SESSION_IMPL *session,
* We didn't find a match in the session cache, now search the
* shared handle list and cache any handle we find.
*/
- WT_WITH_DHANDLE_LOCK(session, ret =
+ WT_WITH_HANDLE_LIST_LOCK(session, ret =
__session_find_shared_dhandle(
session, uri, checkpoint, flags));
dhandle = (ret == 0) ? session->dhandle : NULL;
@@ -414,9 +415,9 @@ __wt_session_get_btree(WT_SESSION_IMPL *session,
* lock - they do so on purpose and will handle error returns.
*/
if ((LF_ISSET(WT_DHANDLE_LOCK_ONLY) && ret == EBUSY) ||
- (!F_ISSET(session, WT_SESSION_SCHEMA_LOCKED) &&
+ (!F_ISSET(session, WT_SESSION_LOCKED_SCHEMA) &&
F_ISSET(session,
- WT_SESSION_HANDLE_LIST_LOCKED | WT_SESSION_TABLE_LOCKED)))
+ WT_SESSION_LOCKED_HANDLE_LIST | WT_SESSION_LOCKED_TABLE)))
return (ret);
/* If we found the handle and it isn't dead, reopen it. */
@@ -441,7 +442,7 @@ __wt_session_get_btree(WT_SESSION_IMPL *session,
*/
retry: is_dead = 0;
WT_WITH_SCHEMA_LOCK(session,
- WT_WITH_DHANDLE_LOCK(session, ret =
+ WT_WITH_HANDLE_LIST_LOCK(session, ret =
(is_dead = (dhandle != NULL &&
F_ISSET(dhandle, WT_DHANDLE_DEAD))) ?
0 : __wt_conn_btree_get(session, uri, checkpoint, cfg, flags)));
@@ -513,7 +514,7 @@ __wt_session_lock_checkpoint(WT_SESSION_IMPL *session, const char *checkpoint)
dhandle = session->dhandle;
F_SET(dhandle, WT_DHANDLE_DISCARD);
- WT_ERR(__wt_meta_track_handle_lock(session, 0));
+ WT_ERR(__wt_meta_track_handle_lock(session, false));
/* Restore the original btree in the session. */
err: session->dhandle = saved_dhandle;
diff --git a/src/third_party/wiredtiger/src/support/err.c b/src/third_party/wiredtiger/src/support/err.c
index fc6569cb81e..59a0a0ebd6b 100644
--- a/src/third_party/wiredtiger/src/support/err.c
+++ b/src/third_party/wiredtiger/src/support/err.c
@@ -91,7 +91,7 @@ static WT_EVENT_HANDLER __event_handler_default = {
*/
static void
__handler_failure(WT_SESSION_IMPL *session,
- int error, const char *which, int error_handler_failed)
+ int error, const char *which, bool error_handler_failed)
{
WT_EVENT_HANDLER *handler;
WT_SESSION *wt_session;
@@ -148,7 +148,7 @@ __wt_event_handler_set(WT_SESSION_IMPL *session, WT_EVENT_HANDLER *handler)
* Report a message to an event handler.
*/
int
-__wt_eventv(WT_SESSION_IMPL *session, int msg_event, int error,
+__wt_eventv(WT_SESSION_IMPL *session, bool msg_event, int error,
const char *file_name, int line_number, const char *fmt, va_list ap)
{
WT_EVENT_HANDLER *handler;
@@ -286,11 +286,11 @@ __wt_eventv(WT_SESSION_IMPL *session, int msg_event, int error,
if (msg_event) {
ret = handler->handle_message(handler, wt_session, s);
if (ret != 0)
- __handler_failure(session, ret, "message", 0);
+ __handler_failure(session, ret, "message", false);
} else {
ret = handler->handle_error(handler, wt_session, error, s);
if (ret != 0 && handler->handle_error != __handle_error_default)
- __handler_failure(session, ret, "error", 1);
+ __handler_failure(session, ret, "error", true);
}
return (ret);
@@ -311,7 +311,7 @@ __wt_err(WT_SESSION_IMPL *session, int error, const char *fmt, ...)
* an error value to return.
*/
va_start(ap, fmt);
- (void)__wt_eventv(session, 0, error, NULL, 0, fmt, ap);
+ (void)__wt_eventv(session, false, error, NULL, 0, fmt, ap);
va_end(ap);
}
@@ -330,7 +330,7 @@ __wt_errx(WT_SESSION_IMPL *session, const char *fmt, ...)
* an error value to return.
*/
va_start(ap, fmt);
- (void)__wt_eventv(session, 0, 0, NULL, 0, fmt, ap);
+ (void)__wt_eventv(session, false, 0, NULL, 0, fmt, ap);
va_end(ap);
}
@@ -351,7 +351,7 @@ __wt_ext_err_printf(
session = ((WT_CONNECTION_IMPL *)wt_api->conn)->default_session;
va_start(ap, fmt);
- ret = __wt_eventv(session, 0, 0, NULL, 0, fmt, ap);
+ ret = __wt_eventv(session, false, 0, NULL, 0, fmt, ap);
va_end(ap);
return (ret);
}
@@ -450,7 +450,7 @@ __wt_progress(WT_SESSION_IMPL *session, const char *s, uint64_t v)
if (handler != NULL && handler->handle_progress != NULL)
if ((ret = handler->handle_progress(handler,
wt_session, s == NULL ? session->name : s, v)) != 0)
- __handler_failure(session, ret, "progress", 0);
+ __handler_failure(session, ret, "progress", false);
return (0);
}
@@ -467,7 +467,8 @@ __wt_assert(WT_SESSION_IMPL *session,
va_list ap;
va_start(ap, fmt);
- (void)__wt_eventv(session, 0, error, file_name, line_number, fmt, ap);
+ (void)__wt_eventv(
+ session, false, error, file_name, line_number, fmt, ap);
va_end(ap);
#ifdef HAVE_DIAGNOSTIC
diff --git a/src/third_party/wiredtiger/src/support/filename.c b/src/third_party/wiredtiger/src/support/filename.c
index db466ed3bd4..e065d59151e 100644
--- a/src/third_party/wiredtiger/src/support/filename.c
+++ b/src/third_party/wiredtiger/src/support/filename.c
@@ -56,7 +56,7 @@ __wt_nfilename(
int
__wt_remove_if_exists(WT_SESSION_IMPL *session, const char *name)
{
- int exist;
+ bool exist;
WT_RET(__wt_exist(session, name, &exist));
if (exist)
diff --git a/src/third_party/wiredtiger/src/support/global.c b/src/third_party/wiredtiger/src/support/global.c
index 5ddd291c6d4..1e32f5b4453 100644
--- a/src/third_party/wiredtiger/src/support/global.c
+++ b/src/third_party/wiredtiger/src/support/global.c
@@ -19,10 +19,10 @@ static int
__system_is_little_endian(void)
{
uint64_t v;
- int little;
+ bool little;
v = 1;
- little = *((uint8_t *)&v) == 0 ? 0 : 1;
+ little = *((uint8_t *)&v) != 0;
if (little)
return (0);
@@ -74,7 +74,7 @@ __wt_global_once(void)
int
__wt_library_init(void)
{
- static int first = 1;
+ static bool first = true;
WT_DECL_RET;
/*
@@ -86,7 +86,7 @@ __wt_library_init(void)
if (first) {
if ((ret = __wt_once(__wt_global_once)) != 0)
__wt_pthread_once_failed = ret;
- first = 0;
+ first = false;
}
return (__wt_pthread_once_failed);
}
diff --git a/src/third_party/wiredtiger/src/support/hazard.c b/src/third_party/wiredtiger/src/support/hazard.c
index 37cb8bf6ce0..c004e4063f8 100644
--- a/src/third_party/wiredtiger/src/support/hazard.c
+++ b/src/third_party/wiredtiger/src/support/hazard.c
@@ -17,7 +17,7 @@ static void __hazard_dump(WT_SESSION_IMPL *);
* Set a hazard pointer.
*/
int
-__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp
+__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, bool *busyp
#ifdef HAVE_DIAGNOSTIC
, const char *file, int line
#endif
@@ -30,7 +30,7 @@ __wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp
btree = S2BT(session);
conn = S2C(session);
- *busyp = 0;
+ *busyp = false;
/* If a file can never be evicted, hazard pointers aren't required. */
if (F_ISSET(btree, WT_BTREE_IN_MEMORY))
@@ -117,7 +117,7 @@ __wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp
* prevent some random page from being evicted.
*/
hp->page = NULL;
- *busyp = 1;
+ *busyp = true;
return (0);
}
@@ -187,17 +187,17 @@ void
__wt_hazard_close(WT_SESSION_IMPL *session)
{
WT_HAZARD *hp;
- int found;
+ bool found;
/*
* Check for a set hazard pointer and complain if we find one. We could
* just check the session's hazard pointer count, but this is a useful
* diagnostic.
*/
- for (found = 0, hp = session->hazard;
+ for (found = false, hp = session->hazard;
hp < session->hazard + session->hazard_size; ++hp)
if (hp->page != NULL) {
- found = 1;
+ found = true;
break;
}
if (session->nhazard == 0 && !found)
diff --git a/src/third_party/wiredtiger/src/support/pow.c b/src/third_party/wiredtiger/src/support/pow.c
index 8e42113a2ee..0f50bfe56a1 100644
--- a/src/third_party/wiredtiger/src/support/pow.c
+++ b/src/third_party/wiredtiger/src/support/pow.c
@@ -100,7 +100,7 @@ __wt_log2_int(uint32_t n)
* __wt_ispo2 --
* Return if a number is a power-of-two.
*/
-int
+bool
__wt_ispo2(uint32_t v)
{
/*
diff --git a/src/third_party/wiredtiger/src/support/scratch.c b/src/third_party/wiredtiger/src/support/scratch.c
index 957101b8fae..ab29d0e99bd 100644
--- a/src/third_party/wiredtiger/src/support/scratch.c
+++ b/src/third_party/wiredtiger/src/support/scratch.c
@@ -17,7 +17,7 @@ int
__wt_buf_grow_worker(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size)
{
size_t offset;
- int copy_data;
+ bool copy_data;
/*
* Maintain the existing data: there are 3 cases:
@@ -30,10 +30,10 @@ __wt_buf_grow_worker(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size)
*/
if (WT_DATA_IN_ITEM(buf)) {
offset = WT_PTRDIFF(buf->data, buf->mem);
- copy_data = 0;
+ copy_data = false;
} else {
offset = 0;
- copy_data = buf->size ? 1 : 0;
+ copy_data = buf->size > 0;
}
/*
diff --git a/src/third_party/wiredtiger/src/txn/txn.c b/src/third_party/wiredtiger/src/txn/txn.c
index 45be0a15a32..eb2b621f315 100644
--- a/src/third_party/wiredtiger/src/txn/txn.c
+++ b/src/third_party/wiredtiger/src/txn/txn.c
@@ -20,7 +20,7 @@ __wt_txnid_cmp(const void *v1, const void *v2)
id1 = *(uint64_t *)v1;
id2 = *(uint64_t *)v2;
- return ((id1 == id2) ? 0 : TXNID_LT(id1, id2) ? -1 : 1);
+ return ((id1 == id2) ? 0 : WT_TXNID_LT(id1, id2) ? -1 : 1);
}
/*
@@ -38,9 +38,9 @@ __txn_sort_snapshot(WT_SESSION_IMPL *session, uint32_t n, uint64_t snap_max)
qsort(txn->snapshot, n, sizeof(uint64_t), __wt_txnid_cmp);
txn->snapshot_count = n;
txn->snap_max = snap_max;
- txn->snap_min = (n > 0 && TXNID_LE(txn->snapshot[0], snap_max)) ?
+ txn->snap_min = (n > 0 && WT_TXNID_LE(txn->snapshot[0], snap_max)) ?
txn->snapshot[0] : snap_max;
- F_SET(txn, TXN_HAS_SNAPSHOT);
+ F_SET(txn, WT_TXN_HAS_SNAPSHOT);
WT_ASSERT(session, n == 0 || txn->snap_min != WT_TXN_NONE);
}
@@ -63,7 +63,7 @@ __wt_txn_release_snapshot(WT_SESSION_IMPL *session)
!__wt_txn_visible_all(session, txn_state->snap_min));
txn_state->snap_min = WT_TXN_NONE;
- F_CLR(txn, TXN_HAS_SNAPSHOT);
+ F_CLR(txn, WT_TXN_HAS_SNAPSHOT);
}
/*
@@ -129,9 +129,9 @@ __wt_txn_get_snapshot(WT_SESSION_IMPL *session)
*/
if (s != txn_state &&
(id = s->id) != WT_TXN_NONE &&
- TXNID_LE(prev_oldest_id, id)) {
+ WT_TXNID_LE(prev_oldest_id, id)) {
txn->snapshot[n++] = id;
- if (TXNID_LT(id, snap_min))
+ if (WT_TXNID_LT(id, snap_min))
snap_min = id;
}
}
@@ -140,7 +140,7 @@ __wt_txn_get_snapshot(WT_SESSION_IMPL *session)
* If we got a new snapshot, update the published snap_min for this
* session.
*/
- WT_ASSERT(session, TXNID_LE(prev_oldest_id, snap_min));
+ WT_ASSERT(session, WT_TXNID_LE(prev_oldest_id, snap_min));
WT_ASSERT(session, prev_oldest_id == txn_global->oldest_id);
txn_state->snap_min = snap_min;
@@ -168,7 +168,7 @@ __wt_txn_get_snapshot(WT_SESSION_IMPL *session)
* past the last committed transaction.
*/
void
-__wt_txn_update_oldest(WT_SESSION_IMPL *session, int force)
+__wt_txn_update_oldest(WT_SESSION_IMPL *session, bool force)
{
WT_CONNECTION_IMPL *conn;
WT_SESSION_IMPL *oldest_session;
@@ -177,7 +177,7 @@ __wt_txn_update_oldest(WT_SESSION_IMPL *session, int force)
uint64_t current_id, id, oldest_id, prev_oldest_id, snap_min;
uint32_t i, session_cnt;
int32_t count;
- int last_running_moved;
+ bool last_running_moved;
conn = S2C(session);
txn_global = &conn->txn_global;
@@ -191,7 +191,7 @@ __wt_txn_update_oldest(WT_SESSION_IMPL *session, int force)
* oldest ID isn't too far behind, avoid scanning.
*/
if (prev_oldest_id == current_id ||
- (!force && TXNID_LT(current_id, prev_oldest_id + 100)))
+ (!force && WT_TXNID_LT(current_id, prev_oldest_id + 100)))
return;
/*
@@ -221,7 +221,8 @@ __wt_txn_update_oldest(WT_SESSION_IMPL *session, int force)
* it gets a valid one.
*/
if ((id = s->id) != WT_TXN_NONE &&
- TXNID_LE(prev_oldest_id, id) && TXNID_LT(id, snap_min))
+ WT_TXNID_LE(prev_oldest_id, id) &&
+ WT_TXNID_LT(id, snap_min))
snap_min = id;
/*
@@ -233,35 +234,35 @@ __wt_txn_update_oldest(WT_SESSION_IMPL *session, int force)
* more details.
*/
if ((id = s->snap_min) != WT_TXN_NONE &&
- TXNID_LT(id, oldest_id)) {
+ WT_TXNID_LT(id, oldest_id)) {
oldest_id = id;
oldest_session = &conn->sessions[i];
}
}
- if (TXNID_LT(snap_min, oldest_id))
+ if (WT_TXNID_LT(snap_min, oldest_id))
oldest_id = snap_min;
/* Update the last running ID. */
- if (TXNID_LT(txn_global->last_running, snap_min)) {
+ if (WT_TXNID_LT(txn_global->last_running, snap_min)) {
txn_global->last_running = snap_min;
last_running_moved = 1;
} else
last_running_moved = 0;
/* Update the oldest ID. */
- if (TXNID_LT(prev_oldest_id, oldest_id) &&
+ if (WT_TXNID_LT(prev_oldest_id, oldest_id) &&
__wt_atomic_casiv32(&txn_global->scan_count, 1, -1)) {
WT_ORDERED_READ(session_cnt, conn->session_cnt);
for (i = 0, s = txn_global->states; i < session_cnt; i++, s++) {
if ((id = s->id) != WT_TXN_NONE &&
- TXNID_LT(id, oldest_id))
+ WT_TXNID_LT(id, oldest_id))
oldest_id = id;
if ((id = s->snap_min) != WT_TXN_NONE &&
- TXNID_LT(id, oldest_id))
+ WT_TXNID_LT(id, oldest_id))
oldest_id = id;
}
- if (TXNID_LT(txn_global->oldest_id, oldest_id))
+ if (WT_TXNID_LT(txn_global->oldest_id, oldest_id))
txn_global->oldest_id = oldest_id;
txn_global->scan_count = 0;
} else {
@@ -349,7 +350,7 @@ __wt_txn_release(WT_SESSION_IMPL *session)
/* Clear the global checkpoint transaction IDs. */
txn_global->checkpoint_id = 0;
txn_global->checkpoint_pinned = WT_TXN_NONE;
- } else if (F_ISSET(txn, TXN_HAS_ID)) {
+ } else if (F_ISSET(txn, WT_TXN_HAS_ID)) {
WT_ASSERT(session, txn_state->id != WT_TXN_NONE &&
txn->id != WT_TXN_NONE);
WT_PUBLISH(txn_state->id, WT_TXN_NONE);
@@ -397,9 +398,9 @@ __wt_txn_commit(WT_SESSION_IMPL *session, const char *cfg[])
u_int i;
txn = &session->txn;
- WT_ASSERT(session, !F_ISSET(txn, TXN_ERROR));
+ WT_ASSERT(session, !F_ISSET(txn, WT_TXN_ERROR));
- if (!F_ISSET(txn, TXN_RUNNING))
+ if (!F_ISSET(txn, WT_TXN_RUNNING))
WT_RET_MSG(session, EINVAL, "No transaction is active");
/* Commit notification. */
@@ -418,7 +419,6 @@ __wt_txn_commit(WT_SESSION_IMPL *session, const char *cfg[])
*/
__wt_txn_release_snapshot(session);
ret = __wt_txn_log_commit(session, cfg);
- WT_ASSERT(session, ret == 0);
}
/*
@@ -464,7 +464,7 @@ __wt_txn_rollback(WT_SESSION_IMPL *session, const char *cfg[])
WT_UNUSED(cfg);
txn = &session->txn;
- if (!F_ISSET(txn, TXN_RUNNING))
+ if (!F_ISSET(txn, WT_TXN_RUNNING))
WT_RET_MSG(session, EINVAL, "No transaction is active");
/* Rollback notification. */
diff --git a/src/third_party/wiredtiger/src/txn/txn_ckpt.c b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
index 1ae99fb1c97..13597924c0c 100644
--- a/src/third_party/wiredtiger/src/txn/txn_ckpt.c
+++ b/src/third_party/wiredtiger/src/txn/txn_ckpt.c
@@ -90,15 +90,15 @@ err: if (cursor != NULL)
*/
static int
__checkpoint_apply_all(WT_SESSION_IMPL *session, const char *cfg[],
- int (*op)(WT_SESSION_IMPL *, const char *[]), int *fullp)
+ int (*op)(WT_SESSION_IMPL *, const char *[]), bool *fullp)
{
WT_CONFIG targetconf;
WT_CONFIG_ITEM cval, k, v;
WT_DECL_ITEM(tmp);
WT_DECL_RET;
- int ckpt_closed, named, target_list;
+ bool ckpt_closed, named, target_list;
- target_list = 0;
+ target_list = false;
/* Flag if this is a named checkpoint, and check if the name is OK. */
WT_RET(__wt_config_gets(session, cfg, "name", &cval));
@@ -112,7 +112,7 @@ __checkpoint_apply_all(WT_SESSION_IMPL *session, const char *cfg[],
while ((ret = __wt_config_next(&targetconf, &k, &v)) == 0) {
if (!target_list) {
WT_ERR(__wt_scr_alloc(session, 512, &tmp));
- target_list = 1;
+ target_list = true;
}
if (v.len != 0)
@@ -157,7 +157,7 @@ __checkpoint_apply_all(WT_SESSION_IMPL *session, const char *cfg[],
}
WT_ERR(ckpt_closed ?
__wt_meta_btree_apply(session, op, cfg) :
- __wt_conn_btree_apply(session, 0, NULL, op, cfg));
+ __wt_conn_btree_apply(session, false, NULL, op, cfg));
}
if (fullp != NULL)
@@ -185,7 +185,7 @@ __checkpoint_apply(WT_SESSION_IMPL *session, const char *cfg[],
session->ckpt_handle[i].dhandle,
ret = (*op)(session, cfg));
else
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_conn_btree_apply_single(session,
session->ckpt_handle[i].name, NULL, op, cfg));
WT_RET(ret);
@@ -354,15 +354,15 @@ __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
{ WT_CONFIG_BASE(session, session_begin_transaction),
"isolation=snapshot", NULL };
void *saved_meta_next;
- int full, idle, logging, tracking;
u_int i;
+ bool full, idle, logging, tracking;
conn = S2C(session);
txn = &session->txn;
txn_global = &conn->txn_global;
txn_state = WT_SESSION_TXN_STATE(session);
saved_isolation = session->isolation;
- full = idle = logging = tracking = 0;
+ full = idle = logging = tracking = false;
/* Ensure the metadata table is open before taking any locks. */
WT_RET(__wt_metadata_open(session));
@@ -382,7 +382,7 @@ __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
*/
WT_WITH_SCHEMA_LOCK(session,
WT_WITH_TABLE_LOCK(session,
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __checkpoint_apply_all(
session, cfg, __wt_checkpoint_list, NULL))));
WT_ERR(ret);
@@ -393,7 +393,7 @@ __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
* This is particularly important for compact, so that all dirty pages
* can be fully written.
*/
- __wt_txn_update_oldest(session, 1);
+ __wt_txn_update_oldest(session, true);
/* Flush data-sources before we start the checkpoint. */
WT_ERR(__checkpoint_data_source(session, cfg));
@@ -417,11 +417,11 @@ __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
WT_ERR(__checkpoint_apply(session, cfg, __wt_checkpoint_sync));
/* Acquire the schema lock. */
- F_SET(session, WT_SESSION_SCHEMA_LOCKED);
+ F_SET(session, WT_SESSION_LOCKED_SCHEMA);
__wt_spin_lock(session, &conn->schema_lock);
WT_ERR(__wt_meta_track_on(session));
- tracking = 1;
+ tracking = true;
/* Tell logging that we are about to start a database checkpoint. */
if (full && logging)
@@ -481,8 +481,8 @@ __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
* cleared our entry.
*/
WT_ASSERT(session,
- TXNID_LE(txn_global->oldest_id, txn_state->id) &&
- TXNID_LE(txn_global->oldest_id, txn_state->snap_min));
+ WT_TXNID_LE(txn_global->oldest_id, txn_state->id) &&
+ WT_TXNID_LE(txn_global->oldest_id, txn_state->snap_min));
/*
* Clear our entry from the global transaction session table. Any
@@ -553,8 +553,8 @@ __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
"metadata sync completed", &verb_timer));
} else
WT_WITH_DHANDLE(session, session->meta_dhandle,
- ret = __wt_txn_checkpoint_log(session,
- 0, WT_TXN_LOG_CKPT_SYNC, NULL));
+ ret = __wt_txn_checkpoint_log(
+ session, false, WT_TXN_LOG_CKPT_SYNC, NULL));
if (full) {
WT_ERR(__wt_epoch(session, &stop));
@@ -576,9 +576,9 @@ err: /*
*/
session->isolation = txn->isolation = WT_ISO_READ_UNCOMMITTED;
if (tracking)
- WT_TRET(__wt_meta_track_off(session, 0, ret != 0));
+ WT_TRET(__wt_meta_track_off(session, false, ret != 0));
- if (F_ISSET(txn, TXN_RUNNING)) {
+ if (F_ISSET(txn, WT_TXN_RUNNING)) {
/*
* Clear the dhandle so the visibility check doesn't get
* confused about the snap min. Don't bother restoring the
@@ -597,7 +597,7 @@ err: /*
if (ret == 0 &&
F_ISSET((WT_BTREE *)session->meta_dhandle->handle,
WT_BTREE_SKIP_CKPT))
- idle = 1;
+ idle = true;
WT_TRET(__wt_txn_checkpoint_log(session, full,
(ret == 0 && !idle) ?
WT_TXN_LOG_CKPT_STOP : WT_TXN_LOG_CKPT_CLEANUP, NULL));
@@ -615,8 +615,8 @@ err: /*
__wt_free(session, session->ckpt_handle);
session->ckpt_handle_allocated = session->ckpt_handle_next = 0;
- if (F_ISSET(session, WT_SESSION_SCHEMA_LOCKED)) {
- F_CLR(session, WT_SESSION_SCHEMA_LOCKED);
+ if (F_ISSET(session, WT_SESSION_LOCKED_SCHEMA)) {
+ F_CLR(session, WT_SESSION_LOCKED_SCHEMA);
__wt_spin_unlock(session, &conn->schema_lock);
}
@@ -659,7 +659,7 @@ static void
__drop_from(WT_CKPT *ckptbase, const char *name, size_t len)
{
WT_CKPT *ckpt;
- int matched;
+ bool matched;
/*
* There's a special case -- if the name is "all", then we delete all
@@ -676,12 +676,12 @@ __drop_from(WT_CKPT *ckptbase, const char *name, size_t len)
* checkpoints with the same name in the list, we'll delete from the
* first match to the end.
*/
- matched = 0;
+ matched = false;
WT_CKPT_FOREACH(ckptbase, ckpt) {
if (!matched && !WT_STRING_MATCH(ckpt->name, name, len))
continue;
- matched = 1;
+ matched = true;
F_SET(ckpt, WT_CKPT_DELETE);
}
}
@@ -722,7 +722,7 @@ __drop_to(WT_CKPT *ckptbase, const char *name, size_t len)
*/
static int
__checkpoint_worker(
- WT_SESSION_IMPL *session, const char *cfg[], int is_checkpoint)
+ WT_SESSION_IMPL *session, const char *cfg[], bool is_checkpoint)
{
WT_BM *bm;
WT_BTREE *btree;
@@ -733,8 +733,9 @@ __checkpoint_worker(
WT_DATA_HANDLE *dhandle;
WT_DECL_RET;
WT_LSN ckptlsn;
+ int deleted, was_modified;
+ bool fake_ckpt, force, hot_backup_locked;
const char *name;
- int deleted, fake_ckpt, force, hot_backup_locked, was_modified;
char *name_alloc;
btree = S2BT(session);
@@ -742,11 +743,9 @@ __checkpoint_worker(
conn = S2C(session);
ckpt = ckptbase = NULL;
dhandle = session->dhandle;
- name_alloc = NULL;
- hot_backup_locked = 0;
- name_alloc = NULL;
- fake_ckpt = 0;
was_modified = btree->modified;
+ fake_ckpt = hot_backup_locked = false;
+ name_alloc = NULL;
/*
* Set the checkpoint LSN to the maximum LSN so that if logging is
@@ -831,14 +830,14 @@ __checkpoint_worker(
* to open the checkpoint in a cursor after taking any checkpoint, which
* means it must exist.
*/
- force = 0;
+ force = false;
F_CLR(btree, WT_BTREE_SKIP_CKPT);
if (!btree->modified && cfg != NULL) {
ret = __wt_config_gets(session, cfg, "force", &cval);
if (ret != 0 && ret != WT_NOTFOUND)
WT_ERR(ret);
if (ret == 0 && cval.val != 0)
- force = 1;
+ force = true;
}
if (!btree->modified && !force) {
if (!is_checkpoint)
@@ -885,7 +884,7 @@ nockpt: F_SET(btree, WT_BTREE_SKIP_CKPT);
* we don't want to race with a future hot backup.
*/
__wt_spin_lock(session, &conn->hot_backup_lock);
- hot_backup_locked = 1;
+ hot_backup_locked = true;
if (conn->hot_backup)
WT_CKPT_FOREACH(ckptbase, ckpt) {
if (!F_ISSET(ckpt, WT_CKPT_DELETE))
@@ -956,7 +955,7 @@ nockpt: F_SET(btree, WT_BTREE_SKIP_CKPT);
* names with checkpoints.
*/
if (is_checkpoint)
- switch (F_ISSET(btree, WT_BTREE_SPECIAL_FLAGS)) {
+ switch (F_MASK(btree, WT_BTREE_SPECIAL_FLAGS)) {
case 0:
break;
case WT_BTREE_BULK:
@@ -971,7 +970,7 @@ nockpt: F_SET(btree, WT_BTREE_SKIP_CKPT);
WT_ERR_MSG(session, ret,
"block-manager checkpoint found "
"for a bulk-loaded file");
- fake_ckpt = 1;
+ fake_ckpt = true;
goto fake;
case WT_BTREE_SALVAGE:
case WT_BTREE_UPGRADE:
@@ -996,7 +995,7 @@ nockpt: F_SET(btree, WT_BTREE_SKIP_CKPT);
*/
if (is_checkpoint)
if (btree->bulk_load_ok) {
- fake_ckpt = 1;
+ fake_ckpt = true;
goto fake;
}
@@ -1029,7 +1028,7 @@ nockpt: F_SET(btree, WT_BTREE_SKIP_CKPT);
/* Tell logging that a file checkpoint is starting. */
if (FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED))
WT_ERR(__wt_txn_checkpoint_log(
- session, 0, WT_TXN_LOG_CKPT_START, &ckptlsn));
+ session, false, WT_TXN_LOG_CKPT_START, &ckptlsn));
/* Flush the file from the cache, creating the checkpoint. */
if (is_checkpoint)
@@ -1069,7 +1068,7 @@ fake: /*
*/
if (F_ISSET(conn, WT_CONN_CKPT_SYNC) &&
(WT_IS_METADATA(dhandle) ||
- !F_ISSET(&session->txn, TXN_RUNNING)))
+ !F_ISSET(&session->txn, WT_TXN_RUNNING)))
WT_ERR(__wt_checkpoint_sync(session, NULL));
WT_ERR(__wt_meta_ckptlist_set(
@@ -1092,7 +1091,7 @@ fake: /*
/* Tell logging that the checkpoint is complete. */
if (FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED))
WT_ERR(__wt_txn_checkpoint_log(
- session, 0, WT_TXN_LOG_CKPT_STOP, NULL));
+ session, false, WT_TXN_LOG_CKPT_STOP, NULL));
done:
err: /*
@@ -1122,9 +1121,9 @@ __wt_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
WT_ASSERT(session, session->dhandle->checkpoint == NULL);
/* Should be holding the schema lock. */
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_SCHEMA_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SCHEMA));
- return (__checkpoint_worker(session, cfg, 1));
+ return (__checkpoint_worker(session, cfg, true));
}
/*
@@ -1146,7 +1145,7 @@ __wt_checkpoint_sync(WT_SESSION_IMPL *session, const char *cfg[])
/* Should have an underlying block manager reference. */
WT_ASSERT(session, bm != NULL);
- return (bm->sync(bm, session, 0));
+ return (bm->sync(bm, session, false));
}
/*
@@ -1154,14 +1153,14 @@ __wt_checkpoint_sync(WT_SESSION_IMPL *session, const char *cfg[])
* Checkpoint a single file as part of closing the handle.
*/
int
-__wt_checkpoint_close(WT_SESSION_IMPL *session, int final)
+__wt_checkpoint_close(WT_SESSION_IMPL *session, bool final)
{
WT_BTREE *btree;
WT_DECL_RET;
- int bulk, need_tracking;
+ bool bulk, need_tracking;
btree = S2BT(session);
- bulk = F_ISSET(btree, WT_BTREE_BULK) ? 1 : 0;
+ bulk = F_ISSET(btree, WT_BTREE_BULK);
/* If the handle is already dead, force the discard. */
if (F_ISSET(session->dhandle, WT_DHANDLE_DEAD))
@@ -1172,7 +1171,7 @@ __wt_checkpoint_close(WT_SESSION_IMPL *session, int final)
* for active readers.
*/
if (!btree->modified && !bulk) {
- __wt_txn_update_oldest(session, 1);
+ __wt_txn_update_oldest(session, true);
return (__wt_txn_visible_all(session, btree->rec_max_txn) ?
__wt_cache_op(session, NULL, WT_SYNC_DISCARD) : EBUSY);
}
@@ -1183,7 +1182,7 @@ __wt_checkpoint_close(WT_SESSION_IMPL *session, int final)
* already checked for read-only trees.
*/
WT_ASSERT(session,
- final || bulk || F_ISSET(session, WT_SESSION_SCHEMA_LOCKED));
+ final || bulk || F_ISSET(session, WT_SESSION_LOCKED_SCHEMA));
/*
* Turn on metadata tracking if:
@@ -1196,10 +1195,10 @@ __wt_checkpoint_close(WT_SESSION_IMPL *session, int final)
if (need_tracking)
WT_RET(__wt_meta_track_on(session));
- WT_TRET(__checkpoint_worker(session, NULL, 0));
+ WT_TRET(__checkpoint_worker(session, NULL, false));
if (need_tracking)
- WT_RET(__wt_meta_track_off(session, 1, ret != 0));
+ WT_RET(__wt_meta_track_off(session, true, ret != 0));
return (ret);
}
diff --git a/src/third_party/wiredtiger/src/txn/txn_log.c b/src/third_party/wiredtiger/src/txn/txn_log.c
index 1f19dcfc3ac..5d739083995 100644
--- a/src/third_party/wiredtiger/src/txn/txn_log.c
+++ b/src/third_party/wiredtiger/src/txn/txn_log.c
@@ -67,9 +67,9 @@ static int
__txn_commit_printlog(
WT_SESSION_IMPL *session, const uint8_t **pp, const uint8_t *end, FILE *out)
{
- int firstrecord;
+ bool firstrecord;
- firstrecord = 1;
+ firstrecord = true;
fprintf(out, " \"ops\": [\n");
/* The logging subsystem zero-pads records. */
@@ -78,7 +78,7 @@ __txn_commit_printlog(
fprintf(out, ",\n");
fprintf(out, " {");
- firstrecord = 0;
+ firstrecord = false;
WT_RET(__wt_txn_op_printlog(session, pp, end, out));
fprintf(out, "\n }");
@@ -163,7 +163,7 @@ __wt_txn_log_op(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt)
/* We'd better have a transaction. */
WT_ASSERT(session,
- F_ISSET(txn, TXN_RUNNING) && F_ISSET(txn, TXN_HAS_ID));
+ F_ISSET(txn, WT_TXN_RUNNING) && F_ISSET(txn, WT_TXN_HAS_ID));
WT_ASSERT(session, txn->mod_count > 0);
op = txn->mod + txn->mod_count - 1;
@@ -221,7 +221,8 @@ __txn_log_file_sync(WT_SESSION_IMPL *session, uint32_t flags, WT_LSN *lsnp)
WT_DECL_RET;
size_t header_size;
uint32_t rectype = WT_LOGREC_FILE_SYNC;
- int start, need_sync;
+ int start;
+ bool need_sync;
const char *fmt = WT_UNCHECKED_STRING(III);
btree = S2BT(session);
@@ -271,7 +272,7 @@ __wt_txn_checkpoint_logread(
*/
int
__wt_txn_checkpoint_log(
- WT_SESSION_IMPL *session, int full, uint32_t flags, WT_LSN *lsnp)
+ WT_SESSION_IMPL *session, bool full, uint32_t flags, WT_LSN *lsnp)
{
WT_DECL_ITEM(logrec);
WT_DECL_RET;
@@ -301,7 +302,7 @@ __wt_txn_checkpoint_log(
switch (flags) {
case WT_TXN_LOG_CKPT_PREPARE:
- txn->full_ckpt = 1;
+ txn->full_ckpt = true;
*ckpt_lsn = S2C(session)->log->write_start_lsn;
/*
* We need to make sure that the log records in the checkpoint
@@ -355,9 +356,13 @@ __wt_txn_checkpoint_log(
/*
* If this full checkpoint completed successfully and there is
* no hot backup in progress, tell the logging subsystem the
- * checkpoint LSN so that it can archive.
+ * checkpoint LSN so that it can archive. Do not update the
+ * logging checkpoint LSN if this is during a clean connection
+ * close, only during a full checkpoint. A clean close may not
+ * update any metadata LSN and we do not want to archive in
+ * that case.
*/
- if (!S2C(session)->hot_backup)
+ if (!S2C(session)->hot_backup && txn->full_ckpt)
WT_ERR(__wt_log_ckpt(session, ckpt_lsn));
/* FALLTHROUGH */
@@ -366,7 +371,7 @@ __wt_txn_checkpoint_log(
WT_INIT_LSN(ckpt_lsn);
txn->ckpt_nsnapshot = 0;
__wt_scr_free(session, &txn->ckpt_snapshot);
- txn->full_ckpt = 0;
+ txn->full_ckpt = false;
break;
WT_ILLEGAL_VALUE_ERR(session);
@@ -452,12 +457,12 @@ __txn_printlog(WT_SESSION_IMPL *session,
FILE *out;
WT_LOG_RECORD *logrec;
WT_LSN ckpt_lsn;
- int compressed;
+ const uint8_t *end, *p;
+ const char *msg;
uint64_t txnid;
uint32_t fileid, rectype;
int32_t start;
- const uint8_t *end, *p;
- const char *msg;
+ bool compressed;
WT_UNUSED(next_lsnp);
out = cookie;
diff --git a/src/third_party/wiredtiger/src/txn/txn_nsnap.c b/src/third_party/wiredtiger/src/txn/txn_nsnap.c
index be736cc1c98..a5ec9cb9b82 100644
--- a/src/third_party/wiredtiger/src/txn/txn_nsnap.c
+++ b/src/third_party/wiredtiger/src/txn/txn_nsnap.c
@@ -57,7 +57,7 @@ __nsnap_drop_one(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name)
* dropped. The named snapshot lock must be held write locked.
*/
static int
-__nsnap_drop_to(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name, int inclusive)
+__nsnap_drop_to(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name, bool inclusive)
{
WT_DECL_RET;
WT_NAMED_SNAPSHOT *last, *nsnap, *prev;
@@ -135,9 +135,9 @@ __wt_txn_named_snapshot_begin(WT_SESSION_IMPL *session, const char *cfg[])
const char *txn_cfg[] =
{ WT_CONFIG_BASE(session, WT_SESSION_begin_transaction),
"isolation=snapshot", NULL };
- int started_txn;
+ bool started_txn;
- started_txn = 0;
+ started_txn = false;
nsnap_new = NULL;
txn_global = &S2C(session)->txn_global;
txn = &session->txn;
@@ -147,7 +147,7 @@ __wt_txn_named_snapshot_begin(WT_SESSION_IMPL *session, const char *cfg[])
if (!F_ISSET(txn, WT_TXN_RUNNING)) {
WT_RET(__wt_txn_begin(session, txn_cfg));
- started_txn = 1;
+ started_txn = true;
}
F_SET(txn, WT_TXN_READONLY);
@@ -208,11 +208,11 @@ __wt_txn_named_snapshot_drop(WT_SESSION_IMPL *session, const char *cfg[])
session, cfg, "drop.before", 0, &before_config));
if (all_config.val != 0)
- WT_RET(__nsnap_drop_to(session, NULL, 1));
+ WT_RET(__nsnap_drop_to(session, NULL, true));
else if (before_config.len != 0)
- WT_RET(__nsnap_drop_to(session, &before_config, 0));
+ WT_RET(__nsnap_drop_to(session, &before_config, false));
else if (to_config.len != 0)
- WT_RET(__nsnap_drop_to(session, &to_config, 1));
+ WT_RET(__nsnap_drop_to(session, &to_config, true));
/* We are done if there are no named drops */
@@ -284,14 +284,14 @@ __wt_txn_named_snapshot_get(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *nameval)
*/
int
__wt_txn_named_snapshot_config(WT_SESSION_IMPL *session,
- const char *cfg[], int *has_create, int *has_drops)
+ const char *cfg[], bool *has_create, bool *has_drops)
{
WT_CONFIG_ITEM cval;
WT_CONFIG_ITEM all_config, names_config, to_config, before_config;
WT_TXN *txn;
txn = &session->txn;
- *has_create = *has_drops = 0;
+ *has_create = *has_drops = false;
/* Verify that the name is legal. */
WT_RET(__wt_config_gets_def(session, cfg, "name", 0, &cval));
@@ -311,7 +311,7 @@ __wt_txn_named_snapshot_config(WT_SESSION_IMPL *session,
WT_RET_MSG(session, EINVAL,
"Can't create a named snapshot from a running "
"transaction that has made updates");
- *has_create = 1;
+ *has_create = true;
}
/* Verify that the drop configuration is sane. */
@@ -334,7 +334,7 @@ __wt_txn_named_snapshot_config(WT_SESSION_IMPL *session,
WT_RET_MSG(session, EINVAL,
"Illegal configuration; named snapshot drop can't "
"specify all and any other options");
- *has_drops = 1;
+ *has_drops = true;
}
if (!*has_create && !*has_drops)
diff --git a/src/third_party/wiredtiger/src/txn/txn_recover.c b/src/third_party/wiredtiger/src/txn/txn_recover.c
index 8c25c1685cf..5799bbc2a79 100644
--- a/src/third_party/wiredtiger/src/txn/txn_recover.c
+++ b/src/third_party/wiredtiger/src/txn/txn_recover.c
@@ -24,9 +24,8 @@ typedef struct {
WT_LSN ckpt_lsn; /* Start LSN for main recovery loop. */
- int missing; /* Were there missing files? */
- int modified; /* Did recovery make any changes? */
- int metadata_only; /*
+ bool missing; /* Were there missing files? */
+ bool metadata_only; /*
* Set during the first recovery pass,
* when only the metadata is recovered.
*/
@@ -38,12 +37,12 @@ typedef struct {
*/
static int
__recovery_cursor(WT_SESSION_IMPL *session, WT_RECOVERY *r,
- WT_LSN *lsnp, u_int id, int duplicate, WT_CURSOR **cp)
+ WT_LSN *lsnp, u_int id, bool duplicate, WT_CURSOR **cp)
{
WT_CURSOR *c;
const char *cfg[] = { WT_CONFIG_BASE(session, session_open_cursor),
"overwrite", NULL };
- int metadata_op;
+ bool metadata_op;
c = NULL;
@@ -55,7 +54,7 @@ __recovery_cursor(WT_SESSION_IMPL *session, WT_RECOVERY *r,
* is more recent than the last checkpoint. If there is no entry for a
* file, assume it was dropped or missing after a hot backup.
*/
- metadata_op = (id == WT_METAFILE_ID);
+ metadata_op = id == WT_METAFILE_ID;
if (r->metadata_only != metadata_op)
;
else if (id >= r->nfiles || r->files[id].uri == NULL) {
@@ -64,7 +63,7 @@ __recovery_cursor(WT_SESSION_IMPL *session, WT_RECOVERY *r,
WT_RET(__wt_verbose(session, WT_VERB_RECOVERY,
"No file found with ID %u (max %u)",
id, r->nfiles));
- r->missing = 1;
+ r->missing = true;
} else if (LOG_CMP(lsnp, &r->files[id].ckpt_lsn) >= 0) {
/*
* We're going to apply the operation. Get the cursor, opening
@@ -90,7 +89,7 @@ __recovery_cursor(WT_SESSION_IMPL *session, WT_RECOVERY *r,
*/
#define GET_RECOVERY_CURSOR(session, r, lsnp, fileid, cp) \
WT_ERR(__recovery_cursor( \
- (session), (r), (lsnp), (fileid), 0, (cp))); \
+ (session), (r), (lsnp), (fileid), false, (cp))); \
WT_ERR(__wt_verbose((session), WT_VERB_RECOVERY, \
"%s op %d to file %d at LSN %u/%" PRIuMAX, \
(cursor == NULL) ? "Skipping" : "Applying", \
@@ -153,7 +152,7 @@ __txn_op_apply(
} else {
start = cursor;
WT_ERR(__recovery_cursor(
- session, r, lsnp, fileid, 1, &stop));
+ session, r, lsnp, fileid, true, &stop));
}
/* Set the keys. */
@@ -200,7 +199,7 @@ __txn_op_apply(
case TXN_TRUNC_BOTH:
start = cursor;
WT_ERR(__recovery_cursor(
- session, r, lsnp, fileid, 1, &stop));
+ session, r, lsnp, fileid, true, &stop));
break;
case TXN_TRUNC_START:
start = cursor;
@@ -233,8 +232,6 @@ __txn_op_apply(
if (cursor != NULL)
WT_ERR(cursor->reset(cursor));
- r->modified = 1;
-
err: if (ret != 0)
__wt_err(session, ret, "Operation failed during recovery");
return (ret);
@@ -415,12 +412,12 @@ __wt_txn_recover(WT_SESSION_IMPL *session)
WT_RECOVERY r;
struct WT_RECOVERY_FILE *metafile;
char *config;
- int needs_rec, was_backup;
+ bool needs_rec, was_backup;
conn = S2C(session);
WT_CLEAR(r);
WT_INIT_LSN(&r.ckpt_lsn);
- was_backup = F_ISSET(conn, WT_CONN_WAS_BACKUP) ? 1 : 0;
+ was_backup = F_ISSET(conn, WT_CONN_WAS_BACKUP);
/* We need a real session for recovery. */
WT_RET(__wt_open_session(conn, NULL, NULL, &session));
@@ -451,7 +448,7 @@ __wt_txn_recover(WT_SESSION_IMPL *session)
* backup: we already have the correct metadata in that case.
*/
if (!was_backup) {
- r.metadata_only = 1;
+ r.metadata_only = true;
if (WT_IS_INIT_LSN(&metafile->ckpt_lsn))
WT_ERR(__wt_log_scan(session,
NULL, WT_LOGSCAN_FIRST, __txn_log_recover, &r));
@@ -485,7 +482,7 @@ __wt_txn_recover(WT_SESSION_IMPL *session)
* Now, recover all the files apart from the metadata.
* Pass WT_LOGSCAN_RECOVER so that old logs get truncated.
*/
- r.metadata_only = 0;
+ r.metadata_only = false;
WT_ERR(__wt_verbose(session, WT_VERB_RECOVERY,
"Main recovery loop: starting at %u/%" PRIuMAX,
r.ckpt_lsn.file, (uintmax_t)r.ckpt_lsn.offset));
diff --git a/src/third_party/wiredtiger/src/utilities/util.h b/src/third_party/wiredtiger/src/utilities/util.h
index 692b02e63f2..08d0537956f 100644
--- a/src/third_party/wiredtiger/src/utilities/util.h
+++ b/src/third_party/wiredtiger/src/utilities/util.h
@@ -16,7 +16,7 @@ typedef struct {
extern const char *home; /* Home directory */
extern const char *progname; /* Program name */
extern const char *usage_prefix; /* Global arguments */
-extern int verbose; /* Verbose flag */
+extern bool verbose; /* Verbose flag */
extern WT_EVENT_HANDLER *verbose_handler;
@@ -41,7 +41,7 @@ int util_loadtext(WT_SESSION *, int, char *[]);
char *util_name(WT_SESSION *, const char *, const char *);
int util_printlog(WT_SESSION *, int, char *[]);
int util_read(WT_SESSION *, int, char *[]);
-int util_read_line(WT_SESSION *, ULINE *, int, int *);
+int util_read_line(WT_SESSION *, ULINE *, bool, bool *);
int util_rename(WT_SESSION *, int, char *[]);
int util_salvage(WT_SESSION *, int, char *[]);
int util_stat(WT_SESSION *, int, char *[]);
diff --git a/src/third_party/wiredtiger/src/utilities/util_backup.c b/src/third_party/wiredtiger/src/utilities/util_backup.c
index cad91591a61..4170b141f58 100644
--- a/src/third_party/wiredtiger/src/utilities/util_backup.c
+++ b/src/third_party/wiredtiger/src/utilities/util_backup.c
@@ -21,7 +21,7 @@ static char *cbuf;
static int
append_target(WT_SESSION *session, const char *target, char **bufp)
{
- static int first = 1;
+ static bool first = true;
static size_t len = 0, remain = 0;
static char *buf = NULL;
@@ -34,7 +34,7 @@ append_target(WT_SESSION *session, const char *target, char **bufp)
*bufp = buf;
}
if (first) {
- first = 0;
+ first = false;
strcpy(buf, "target=(");
} else
buf[strlen(buf) - 1] = ','; /* overwrite previous ")" */
diff --git a/src/third_party/wiredtiger/src/utilities/util_dump.c b/src/third_party/wiredtiger/src/utilities/util_dump.c
index b02186cee75..dc909ad1a7e 100644
--- a/src/third_party/wiredtiger/src/utilities/util_dump.c
+++ b/src/third_party/wiredtiger/src/utilities/util_dump.c
@@ -8,7 +8,7 @@
#include "util.h"
-static int dump_config(WT_SESSION *, const char *, int);
+static int dump_config(WT_SESSION *, const char *, bool);
static int dump_json_begin(WT_SESSION *);
static int dump_json_end(WT_SESSION *);
static int dump_json_separator(WT_SESSION *);
@@ -18,8 +18,8 @@ static int dump_json_table_cg(
WT_SESSION *, WT_CURSOR *, const char *, const char *, const char *);
static int dump_json_table_config(WT_SESSION *, const char *);
static int dump_json_table_end(WT_SESSION *);
-static int dump_prefix(WT_SESSION *, int);
-static int dump_record(WT_CURSOR *, int, int);
+static int dump_prefix(WT_SESSION *, bool);
+static int dump_record(WT_CURSOR *, bool, bool);
static int dump_suffix(WT_SESSION *);
static int dump_table_config(WT_SESSION *, WT_CURSOR *, const char *);
static int dump_table_config_type(
@@ -34,10 +34,11 @@ util_dump(WT_SESSION *session, int argc, char *argv[])
WT_CURSOR *cursor;
WT_DECL_RET;
size_t len;
- int ch, hex, i, json, reverse;
+ int ch, i;
+ bool hex, json, reverse;
char *checkpoint, *config, *name;
- hex = json = reverse = 0;
+ hex = json = reverse = false;
checkpoint = config = name = NULL;
while ((ch = __wt_getopt(progname, argc, argv, "c:f:jrx")) != EOF)
switch (ch) {
@@ -50,13 +51,13 @@ util_dump(WT_SESSION *session, int argc, char *argv[])
session, errno, "%s: reopen", __wt_optarg));
break;
case 'j':
- json = 1;
+ json = true;
break;
case 'r':
- reverse = 1;
+ reverse = true;
break;
case 'x':
- hex = 1;
+ hex = true;
break;
case '?':
default:
@@ -144,7 +145,7 @@ err: ret = 1;
* Dump the config for the uri.
*/
static int
-dump_config(WT_SESSION *session, const char *uri, int hex)
+dump_config(WT_SESSION *session, const char *uri, bool hex)
{
WT_CURSOR *cursor;
WT_DECL_RET;
@@ -278,13 +279,14 @@ static int
dump_json_table_cg(WT_SESSION *session, WT_CURSOR *cursor,
const char *name, const char *entry, const char *header)
{
+ static const char * const indent = " ";
WT_DECL_RET;
+ int exact;
+ bool once;
const char *key, *skip, *value;
- int exact, once;
char *jsonconfig, *stripped;
- static const char * const indent = " ";
- once = 0;
+ once = false;
if (printf(" \"%s\" : [", header) < 0)
return (util_err(session, EIO, NULL));
@@ -341,15 +343,15 @@ match: if ((ret = cursor->get_key(cursor, &key)) != 0)
"%s \"uri\" : \"%s\",\n"
"%s \"config\" : \"%s\"\n"
"%s}",
- (once == 0 ? "" : ","),
+ once ? "," : "",
indent, indent, key, indent, jsonconfig, indent);
free(jsonconfig);
if (ret < 0)
return (util_err(session, EIO, NULL));
- once = 1;
+ once = true;
}
- if (printf("%s]", (once == 0 ? "" : "\n ")) < 0)
+ if (printf("%s]", once ? "\n " : "") < 0)
return (util_err(session, EIO, NULL));
if (ret == 0 || ret == WT_NOTFOUND)
return (0);
@@ -582,7 +584,7 @@ match: if ((ret = cursor->get_key(cursor, &key)) != 0)
* Output the dump file header prefix.
*/
static int
-dump_prefix(WT_SESSION *session, int hex)
+dump_prefix(WT_SESSION *session, bool hex)
{
int vmajor, vminor, vpatch;
@@ -603,16 +605,16 @@ dump_prefix(WT_SESSION *session, int hex)
* with JSON formatting if needed.
*/
static int
-dump_record(WT_CURSOR *cursor, int reverse, int json)
+dump_record(WT_CURSOR *cursor, bool reverse, bool json)
{
WT_DECL_RET;
WT_SESSION *session;
const char *infix, *key, *prefix, *suffix, *value;
- int once;
+ bool once;
session = cursor->session;
- once = 0;
+ once = false;
if (json) {
prefix = "\n{\n";
infix = ",\n";
@@ -628,10 +630,10 @@ dump_record(WT_CURSOR *cursor, int reverse, int json)
return (util_cerr(cursor, "get_key", ret));
if ((ret = cursor->get_value(cursor, &value)) != 0)
return (util_cerr(cursor, "get_value", ret));
- if (printf("%s%s%s%s%s%s", (json && once) ? "," : "",
+ if (printf("%s%s%s%s%s%s", json && once ? "," : "",
prefix, key, infix, value, suffix) < 0)
return (util_err(session, EIO, NULL));
- once = 1;
+ once = true;
}
if (json && once && printf("\n") < 0)
return (util_err(session, EIO, NULL));
@@ -665,14 +667,14 @@ dup_json_string(const char *str, char **result)
nchars = 0;
for (p = str; *p; p++, nchars++)
- nchars += __wt_json_unpack_char(*p, NULL, 0, 0);
+ nchars += __wt_json_unpack_char(*p, NULL, 0, false);
q = malloc(nchars + 1);
if (q == NULL)
return (1);
*result = q;
left = nchars;
for (p = str; *p; p++, nchars++) {
- nchars = __wt_json_unpack_char(*p, (u_char *)q, left, 0);
+ nchars = __wt_json_unpack_char(*p, (u_char *)q, left, false);
left -= nchars;
q += nchars;
}
diff --git a/src/third_party/wiredtiger/src/utilities/util_list.c b/src/third_party/wiredtiger/src/utilities/util_list.c
index 270f06666a2..729bac82fc5 100644
--- a/src/third_party/wiredtiger/src/utilities/util_list.c
+++ b/src/third_party/wiredtiger/src/utilities/util_list.c
@@ -8,7 +8,7 @@
#include "util.h"
-static int list_print(WT_SESSION *, const char *, int, int);
+static int list_print(WT_SESSION *, const char *, bool, bool);
static int list_print_checkpoint(WT_SESSION *, const char *);
static int usage(void);
@@ -16,18 +16,19 @@ int
util_list(WT_SESSION *session, int argc, char *argv[])
{
WT_DECL_RET;
- int cflag, ch, vflag;
+ int ch;
+ bool cflag, vflag;
char *name;
- cflag = vflag = 0;
+ cflag = vflag = false;
name = NULL;
while ((ch = __wt_getopt(progname, argc, argv, "cv")) != EOF)
switch (ch) {
case 'c':
- cflag = 1;
+ cflag = true;
break;
case 'v':
- vflag = 1;
+ vflag = true;
break;
case '?':
default:
@@ -60,11 +61,11 @@ util_list(WT_SESSION *session, int argc, char *argv[])
* List the high-level objects in the database.
*/
static int
-list_print(WT_SESSION *session, const char *name, int cflag, int vflag)
+list_print(WT_SESSION *session, const char *name, bool cflag, bool vflag)
{
WT_CURSOR *cursor;
WT_DECL_RET;
- int found;
+ bool found;
const char *key, *value;
/* Open the metadata file. */
@@ -94,7 +95,7 @@ list_print(WT_SESSION *session, const char *name, int cflag, int vflag)
if (name != NULL) {
if (!WT_PREFIX_MATCH(key, name))
continue;
- found = 1;
+ found = true;
}
/*
diff --git a/src/third_party/wiredtiger/src/utilities/util_load.c b/src/third_party/wiredtiger/src/utilities/util_load.c
index 994df10b70b..095ce55f835 100644
--- a/src/third_party/wiredtiger/src/utilities/util_load.c
+++ b/src/third_party/wiredtiger/src/utilities/util_load.c
@@ -9,7 +9,7 @@
#include "util.h"
#include "util_load.h"
-static int config_read(WT_SESSION *, char ***, int *);
+static int config_read(WT_SESSION *, char ***, bool *);
static int config_rename(WT_SESSION *, char **, const char *);
static void config_remove(char *, const char *);
static int format(WT_SESSION *);
@@ -17,18 +17,18 @@ static int insert(WT_CURSOR *, const char *);
static int load_dump(WT_SESSION *);
static int usage(void);
-static int append; /* -a append (ignore record number keys) */
-static char *cmdname; /* -r rename */
-static char **cmdconfig; /* configuration pairs */
-static int json; /* -j input is JSON format */
-static int no_overwrite; /* -n don't overwrite existing data */
+static bool append = false; /* -a append (ignore number keys) */
+static char *cmdname; /* -r rename */
+static char **cmdconfig; /* configuration pairs */
+static bool json = false; /* -j input is JSON format */
+static bool no_overwrite = false; /* -n don't overwrite existing data */
int
util_load(WT_SESSION *session, int argc, char *argv[])
{
+ uint32_t flags;
int ch;
const char *filename;
- uint32_t flags;
flags = 0;
@@ -36,7 +36,7 @@ util_load(WT_SESSION *session, int argc, char *argv[])
while ((ch = __wt_getopt(progname, argc, argv, "af:jnr:")) != EOF)
switch (ch) {
case 'a': /* append (ignore record number keys) */
- append = 1;
+ append = true;
break;
case 'f': /* input file */
if (freopen(__wt_optarg, "r", stdin) == NULL)
@@ -47,10 +47,10 @@ util_load(WT_SESSION *session, int argc, char *argv[])
filename = __wt_optarg;
break;
case 'j': /* input is JSON */
- json = 1;
+ json = true;
break;
case 'n': /* don't overwrite existing data */
- no_overwrite = 1;
+ no_overwrite = true;
break;
case 'r': /* rename */
cmdname = __wt_optarg;
@@ -63,7 +63,7 @@ util_load(WT_SESSION *session, int argc, char *argv[])
argv += __wt_optind;
/* -a and -o are mutually exclusive. */
- if (append == 1 && no_overwrite == 1)
+ if (append && no_overwrite)
return (util_err(session, EINVAL,
"the -a (append) and -n (no-overwrite) flags are mutually "
"exclusive"));
@@ -94,12 +94,13 @@ load_dump(WT_SESSION *session)
{
WT_CURSOR *cursor;
WT_DECL_RET;
- int hex, tret;
+ int tret;
+ bool hex;
char **list, **tlist, *uri, config[64];
cursor = NULL;
list = NULL; /* -Wuninitialized */
- hex = 0; /* -Wuninitialized */
+ hex = false; /* -Wuninitialized */
uri = NULL;
/* Read the metadata file. */
@@ -218,11 +219,12 @@ config_list_free(CONFIG_LIST *clp)
* Read the config lines and do some basic validation.
*/
static int
-config_read(WT_SESSION *session, char ***listp, int *hexp)
+config_read(WT_SESSION *session, char ***listp, bool *hexp)
{
ULINE l;
WT_DECL_RET;
- int entry, eof, max_entry;
+ int entry, max_entry;
+ bool eof;
const char *s;
char **list, **tlist;
@@ -230,31 +232,31 @@ config_read(WT_SESSION *session, char ***listp, int *hexp)
memset(&l, 0, sizeof(l));
/* Header line #1: "WiredTiger Dump" and a WiredTiger version. */
- if (util_read_line(session, &l, 0, &eof))
+ if (util_read_line(session, &l, false, &eof))
return (1);
s = "WiredTiger Dump ";
if (strncmp(l.mem, s, strlen(s)) != 0)
return (format(session));
/* Header line #2: "Format={hex,print}". */
- if (util_read_line(session, &l, 0, &eof))
+ if (util_read_line(session, &l, false, &eof))
return (1);
if (strcmp(l.mem, "Format=print") == 0)
- *hexp = 0;
+ *hexp = false;
else if (strcmp(l.mem, "Format=hex") == 0)
- *hexp = 1;
+ *hexp = true;
else
return (format(session));
/* Header line #3: "Header". */
- if (util_read_line(session, &l, 0, &eof))
+ if (util_read_line(session, &l, false, &eof))
return (1);
if (strcmp(l.mem, "Header") != 0)
return (format(session));
/* Now, read in lines until we get to the end of the headers. */
for (entry = max_entry = 0, list = NULL;; ++entry) {
- if ((ret = util_read_line(session, &l, 0, &eof)) != 0)
+ if ((ret = util_read_line(session, &l, false, &eof)) != 0)
goto err;
if (strcmp(l.mem, "Data") == 0)
break;
@@ -548,7 +550,7 @@ insert(WT_CURSOR *cursor, const char *name)
WT_DECL_RET;
WT_SESSION *session;
uint64_t insert_count;
- int eof;
+ bool eof;
session = cursor->session;
@@ -563,14 +565,14 @@ insert(WT_CURSOR *cursor, const char *name)
* and ignore it (a dump with "append" set), or not read it at
* all (flat-text load).
*/
- if (util_read_line(session, &key, 1, &eof))
+ if (util_read_line(session, &key, true, &eof))
return (1);
- if (eof == 1)
+ if (eof)
break;
if (!append)
cursor->set_key(cursor, key.mem);
- if (util_read_line(session, &value, 0, &eof))
+ if (util_read_line(session, &value, false, &eof))
return (1);
cursor->set_value(cursor, value.mem);
diff --git a/src/third_party/wiredtiger/src/utilities/util_load_json.c b/src/third_party/wiredtiger/src/utilities/util_load_json.c
index f498b821073..0fb118a0185 100644
--- a/src/third_party/wiredtiger/src/utilities/util_load_json.c
+++ b/src/third_party/wiredtiger/src/utilities/util_load_json.c
@@ -28,8 +28,8 @@ typedef struct {
WT_SESSION *session; /* associated session */
ULINE line; /* current line */
const char *p; /* points to cur position in line.mem */
- int ateof; /* current token is EOF */
- int peeking; /* peeking at next token */
+ bool ateof; /* current token is EOF */
+ bool peeking; /* peeking at next token */
int toktype; /* next token, defined by __wt_json_token() */
const char *tokstart; /* next token start (points into line.mem) */
size_t toklen; /* next token length */
@@ -71,8 +71,8 @@ json_column_group_index(WT_SESSION *session,
JSON_INPUT_STATE *ins, CONFIG_LIST *clp, int idx)
{
WT_DECL_RET;
+ bool isconfig;
char *config, *p, *uri;
- int isconfig;
uri = NULL;
config = NULL;
@@ -144,8 +144,8 @@ static int
json_kvraw_append(WT_SESSION *session,
JSON_INPUT_STATE *ins, const char *str, size_t len)
{
- char *tmp;
size_t needsize;
+ char *tmp;
if (len > 0) {
needsize = strlen(ins->kvraw) + len + 2;
@@ -214,12 +214,13 @@ json_data(WT_SESSION *session,
{
WT_CURSOR *cursor;
WT_DECL_RET;
- char config[64], *endp, *uri;
- const char *keyformat;
- int isrec, nfield, nkeys, toktype, tret;
size_t keystrlen;
ssize_t gotnolen;
uint64_t gotno, recno;
+ int nfield, nkeys, toktype, tret;
+ bool isrec;
+ char config[64], *endp, *uri;
+ const char *keyformat;
cursor = NULL;
uri = NULL;
@@ -247,7 +248,7 @@ json_data(WT_SESSION *session,
goto err;
}
keyformat = cursor->key_format;
- isrec = (strcmp(keyformat, "r") == 0);
+ isrec = strcmp(keyformat, "r") == 0;
for (nkeys = 0; *keyformat; keyformat++)
if (!isdigit(*keyformat))
nkeys++;
@@ -346,10 +347,10 @@ json_top_level(WT_SESSION *session, JSON_INPUT_STATE *ins, uint32_t flags)
{
CONFIG_LIST cl;
WT_DECL_RET;
- char *config, *tableuri;
int toktype;
static const char *json_markers[] = {
"\"config\"", "\"colgroups\"", "\"indices\"", "\"data\"", NULL };
+ char *config, *tableuri;
memset(&cl, 0, sizeof(cl));
tableuri = NULL;
@@ -464,7 +465,7 @@ json_peek(WT_SESSION *session, JSON_INPUT_STATE *ins)
ins->kvrawstart = 0;
}
if (util_read_line(
- session, &ins->line, 1, &ins->ateof)) {
+ session, &ins->line, true, &ins->ateof)) {
ins->toktype = -1;
ret = -1;
goto err;
@@ -478,7 +479,7 @@ json_peek(WT_SESSION *session, JSON_INPUT_STATE *ins)
&ins->toktype, &ins->tokstart,
&ins->toklen) != 0)
ins->toktype = -1;
- ins->peeking = 1;
+ ins->peeking = true;
}
if (0) {
err: if (ret == 0)
@@ -500,7 +501,7 @@ json_expect(WT_SESSION *session, JSON_INPUT_STATE *ins, int wanttok)
if (json_peek(session, ins) < 0)
return (1);
ins->p += ins->toklen;
- ins->peeking = 0;
+ ins->peeking = false;
if (ins->toktype != wanttok) {
fprintf(stderr,
"%s: %d: %" WT_SIZET_FMT ": expected %s, got %s\n",
@@ -534,7 +535,7 @@ json_skip(WT_SESSION *session, JSON_INPUT_STATE *ins, const char **matches)
for (match = matches; *match != NULL; match++)
if ((hit = strstr(ins->p, *match)) != NULL)
goto out;
- if (util_read_line(session, &ins->line, 1, &ins->ateof)) {
+ if (util_read_line(session, &ins->line, true, &ins->ateof)) {
ins->toktype = -1;
return (1);
}
@@ -547,7 +548,7 @@ out:
/* Set to this token. */
ins->p = hit;
- ins->peeking = 0;
+ ins->peeking = false;
ins->toktype = 0;
(void)json_peek(session, ins);
return (0);
@@ -565,7 +566,7 @@ util_load_json(WT_SESSION *session, const char *filename, uint32_t flags)
memset(&instate, 0, sizeof(instate));
instate.session = session;
- if (util_read_line(session, &instate.line, 0, &instate.ateof))
+ if (util_read_line(session, &instate.line, false, &instate.ateof))
return (1);
instate.p = (const char *)instate.line.mem;
instate.linenum = 1;
diff --git a/src/third_party/wiredtiger/src/utilities/util_loadtext.c b/src/third_party/wiredtiger/src/utilities/util_loadtext.c
index c200198a0a1..c6cd264c423 100644
--- a/src/third_party/wiredtiger/src/utilities/util_loadtext.c
+++ b/src/third_party/wiredtiger/src/utilities/util_loadtext.c
@@ -8,7 +8,7 @@
#include "util.h"
-static int insert(WT_CURSOR *, const char *, int);
+static int insert(WT_CURSOR *, const char *, bool);
static int text(WT_SESSION *, const char *);
static int usage(void);
@@ -50,7 +50,8 @@ text(WT_SESSION *session, const char *uri)
{
WT_CURSOR *cursor;
WT_DECL_RET;
- int readkey, tret;
+ int tret;
+ bool readkey;
/*
* Open the cursor, configured to append new records (in the case of
@@ -74,7 +75,7 @@ text(WT_SESSION *session, const char *uri)
return (util_err(session, EINVAL,
"the loadtext command can only load objects configured "
"for record number or string keys, and string values"));
- readkey = strcmp(cursor->key_format, "r") == 0 ? 0 : 1;
+ readkey = strcmp(cursor->key_format, "r") != 0;
/* Insert the records */
ret = insert(cursor, uri, readkey);
@@ -100,13 +101,13 @@ text(WT_SESSION *session, const char *uri)
* Read and insert data.
*/
static int
-insert(WT_CURSOR *cursor, const char *name, int readkey)
+insert(WT_CURSOR *cursor, const char *name, bool readkey)
{
ULINE key, value;
WT_DECL_RET;
WT_SESSION *session;
uint64_t insert_count;
- int eof;
+ bool eof;
session = cursor->session;
@@ -122,15 +123,15 @@ insert(WT_CURSOR *cursor, const char *name, int readkey)
* all (flat-text load).
*/
if (readkey) {
- if (util_read_line(session, &key, 1, &eof))
+ if (util_read_line(session, &key, true, &eof))
return (1);
- if (eof == 1)
+ if (eof)
break;
cursor->set_key(cursor, key.mem);
}
- if (util_read_line(session, &value, readkey ? 0 : 1, &eof))
+ if (util_read_line(session, &value, !readkey, &eof))
return (1);
- if (eof == 1)
+ if (eof)
break;
cursor->set_value(cursor, value.mem);
diff --git a/src/third_party/wiredtiger/src/utilities/util_main.c b/src/third_party/wiredtiger/src/utilities/util_main.c
index 79d768f5752..75b8a5cd9c4 100644
--- a/src/third_party/wiredtiger/src/utilities/util_main.c
+++ b/src/third_party/wiredtiger/src/utilities/util_main.c
@@ -12,7 +12,7 @@ const char *home = "."; /* Home directory */
const char *progname; /* Program name */
/* Global arguments */
const char *usage_prefix = "[-Vv] [-R] [-C config] [-h home]";
-int verbose; /* Verbose flag */
+bool verbose = false; /* Verbose flag */
static const char *command; /* Command name */
@@ -30,7 +30,7 @@ main(int argc, char *argv[])
WT_SESSION *session;
size_t len;
int ch, major_v, minor_v, tret, (*func)(WT_SESSION *, int, char *[]);
- int logoff, recover;
+ bool logoff, recover;
char *p;
const char *cmd_config, *config, *rec_config;
@@ -65,7 +65,7 @@ main(int argc, char *argv[])
* needed, the user can specify -R to run recovery.
*/
rec_config = REC_ERROR;
- logoff = recover = 0;
+ logoff = recover = false;
/* Check for standard options. */
while ((ch = __wt_getopt(progname, argc, argv, "C:h:LRVv")) != EOF)
switch (ch) {
@@ -77,17 +77,17 @@ main(int argc, char *argv[])
break;
case 'L': /* no logging */
rec_config = REC_LOGOFF;
- logoff = 1;
+ logoff = true;
break;
case 'R': /* recovery */
rec_config = REC_RECOVER;
- recover = 1;
+ recover = true;
break;
case 'V': /* version */
printf("%s\n", wiredtiger_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
case 'v': /* verbose */
- verbose = 1;
+ verbose = true;
break;
case '?':
default:
diff --git a/src/third_party/wiredtiger/src/utilities/util_misc.c b/src/third_party/wiredtiger/src/utilities/util_misc.c
index f14ad7119bd..76cb37b30dc 100644
--- a/src/third_party/wiredtiger/src/utilities/util_misc.c
+++ b/src/third_party/wiredtiger/src/utilities/util_misc.c
@@ -44,14 +44,14 @@ util_err(WT_SESSION *session, int e, const char *fmt, ...)
* Read a line from stdin into a ULINE.
*/
int
-util_read_line(WT_SESSION *session, ULINE *l, int eof_expected, int *eofp)
+util_read_line(WT_SESSION *session, ULINE *l, bool eof_expected, bool *eofp)
{
static uint64_t line = 0;
size_t len;
int ch;
++line;
- *eofp = 0;
+ *eofp = false;
if (l->memsize == 0) {
if ((l->mem = realloc(l->mem, l->memsize + 1024)) == NULL)
@@ -62,7 +62,7 @@ util_read_line(WT_SESSION *session, ULINE *l, int eof_expected, int *eofp)
if ((ch = getchar()) == EOF) {
if (len == 0) {
if (eof_expected) {
- *eofp = 1;
+ *eofp = true;
return (0);
}
return (util_err(session, 0,
diff --git a/src/third_party/wiredtiger/src/utilities/util_printlog.c b/src/third_party/wiredtiger/src/utilities/util_printlog.c
index 4ec2d0b7e1c..d202b09b228 100644
--- a/src/third_party/wiredtiger/src/utilities/util_printlog.c
+++ b/src/third_party/wiredtiger/src/utilities/util_printlog.c
@@ -14,9 +14,10 @@ int
util_printlog(WT_SESSION *session, int argc, char *argv[])
{
WT_DECL_RET;
- int ch, printable;
+ int ch;
+ bool printable;
- printable = 0;
+ printable = false;
while ((ch = __wt_getopt(progname, argc, argv, "f:p")) != EOF)
switch (ch) {
case 'f': /* output file */
@@ -27,7 +28,7 @@ util_printlog(WT_SESSION *session, int argc, char *argv[])
}
break;
case 'p':
- printable = 1;
+ printable = true;
break;
case '?':
default:
diff --git a/src/third_party/wiredtiger/src/utilities/util_read.c b/src/third_party/wiredtiger/src/utilities/util_read.c
index fe9f5541d6e..a2fcc330c7d 100644
--- a/src/third_party/wiredtiger/src/utilities/util_read.c
+++ b/src/third_party/wiredtiger/src/utilities/util_read.c
@@ -16,7 +16,8 @@ util_read(WT_SESSION *session, int argc, char *argv[])
WT_CURSOR *cursor;
WT_DECL_RET;
uint64_t recno;
- int ch, rkey, rval;
+ int ch;
+ bool rkey, rval;
const char *uri, *value;
while ((ch = __wt_getopt(progname, argc, argv, "")) != EOF)
@@ -51,7 +52,7 @@ util_read(WT_SESSION *session, int argc, char *argv[])
progname);
return (1);
}
- rkey = strcmp(cursor->key_format, "r") == 0 ? 1 : 0;
+ rkey = strcmp(cursor->key_format, "r") == 0;
if (strcmp(cursor->value_format, "S") != 0) {
fprintf(stderr,
"%s: read command only possible when the value format is "
@@ -64,7 +65,7 @@ util_read(WT_SESSION *session, int argc, char *argv[])
* Run through the keys, returning non-zero on error or if any requested
* key isn't found.
*/
- for (rval = 0; *++argv != NULL;) {
+ for (rval = false; *++argv != NULL;) {
if (rkey) {
if (util_str2recno(session, *argv, &recno))
return (1);
@@ -81,14 +82,14 @@ util_read(WT_SESSION *session, int argc, char *argv[])
break;
case WT_NOTFOUND:
(void)util_err(session, 0, "%s: not found", *argv);
- rval = 1;
+ rval = true;
break;
default:
return (util_cerr(cursor, "search", ret));
}
}
- return (rval);
+ return (rval ? 1 : 0);
}
static int
diff --git a/src/third_party/wiredtiger/src/utilities/util_stat.c b/src/third_party/wiredtiger/src/utilities/util_stat.c
index 77c420f8dee..b7558ee3be0 100644
--- a/src/third_party/wiredtiger/src/utilities/util_stat.c
+++ b/src/third_party/wiredtiger/src/utilities/util_stat.c
@@ -16,11 +16,12 @@ util_stat(WT_SESSION *session, int argc, char *argv[])
WT_CURSOR *cursor;
WT_DECL_RET;
size_t urilen;
- int ch, objname_free;
+ int ch;
+ bool objname_free;
const char *config, *pval, *desc;
char *objname, *uri;
- objname_free = 0;
+ objname_free = false;
objname = uri = NULL;
config = NULL;
while ((ch = __wt_getopt(progname, argc, argv, "af")) != EOF)
@@ -56,7 +57,7 @@ util_stat(WT_SESSION *session, int argc, char *argv[])
case 1:
if ((objname = util_name(session, *argv, "table")) == NULL)
return (1);
- objname_free = 1;
+ objname_free = true;
break;
default:
return (usage());
diff --git a/src/third_party/wiredtiger/src/utilities/util_verify.c b/src/third_party/wiredtiger/src/utilities/util_verify.c
index 20a7060f729..caac13be94c 100644
--- a/src/third_party/wiredtiger/src/utilities/util_verify.c
+++ b/src/third_party/wiredtiger/src/utilities/util_verify.c
@@ -15,18 +15,19 @@ util_verify(WT_SESSION *session, int argc, char *argv[])
{
WT_DECL_RET;
size_t size;
- int ch, dump_address, dump_blocks, dump_pages, dump_shape;
+ int ch;
+ bool dump_address, dump_blocks, dump_pages, dump_shape;
char *config, *dump_offsets, *name;
- dump_address = dump_blocks = dump_pages = dump_shape = 0;
+ dump_address = dump_blocks = dump_pages = dump_shape = false;
config = dump_offsets = name = NULL;
while ((ch = __wt_getopt(progname, argc, argv, "d:")) != EOF)
switch (ch) {
case 'd':
if (strcmp(__wt_optarg, "dump_address") == 0)
- dump_address = 1;
+ dump_address = true;
else if (strcmp(__wt_optarg, "dump_blocks") == 0)
- dump_blocks = 1;
+ dump_blocks = true;
else if (
WT_PREFIX_MATCH(__wt_optarg, "dump_offsets=")) {
if (dump_offsets != NULL) {
@@ -38,9 +39,9 @@ util_verify(WT_SESSION *session, int argc, char *argv[])
dump_offsets =
__wt_optarg + strlen("dump_offsets=");
} else if (strcmp(__wt_optarg, "dump_pages") == 0)
- dump_pages = 1;
+ dump_pages = true;
else if (strcmp(__wt_optarg, "dump_shape") == 0)
- dump_shape = 1;
+ dump_shape = true;
else
return (usage());
break;
diff --git a/src/third_party/wiredtiger/src/utilities/util_write.c b/src/third_party/wiredtiger/src/utilities/util_write.c
index e5eafa5ab25..7871040411b 100644
--- a/src/third_party/wiredtiger/src/utilities/util_write.c
+++ b/src/third_party/wiredtiger/src/utilities/util_write.c
@@ -16,18 +16,19 @@ util_write(WT_SESSION *session, int argc, char *argv[])
WT_CURSOR *cursor;
WT_DECL_RET;
uint64_t recno;
- int append, ch, overwrite, rkey;
+ int ch;
+ bool append, overwrite, rkey;
const char *uri;
char config[100];
- append = overwrite = 0;
+ append = overwrite = false;
while ((ch = __wt_getopt(progname, argc, argv, "ao")) != EOF)
switch (ch) {
case 'a':
- append = 1;
+ append = true;
break;
case 'o':
- overwrite = 1;
+ overwrite = true;
break;
case '?':
default:
@@ -68,7 +69,7 @@ util_write(WT_SESSION *session, int argc, char *argv[])
progname);
return (1);
}
- rkey = strcmp(cursor->key_format, "r") == 0 ? 1 : 0;
+ rkey = strcmp(cursor->key_format, "r") == 0;
if (strcmp(cursor->value_format, "S") != 0) {
fprintf(stderr,
"%s: write command only possible when the value format is "