summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-09-24 14:29:56 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-09-29 14:05:30 +1000
commit6f6281c978507312def82af8fa6dd020b9fcb1a6 (patch)
tree6a37d903ea8dbb121bc04d28b2e69a6c02f5da17
parentcd8ae463f0830e56ec66de73de78ca81041615b2 (diff)
downloadmongo-6f6281c978507312def82af8fa6dd020b9fcb1a6.tar.gz
Merge pull request #2209 from wiredtiger/more-bool-keith
WT-2122 more boolean conversion (cherry picked from commit 91deacba5a77db31216fccfb6bffdbe81375f0b4)
-rw-r--r--dist/flags.py6
-rw-r--r--src/block/block_addr.c2
-rw-r--r--src/block/block_ckpt.c46
-rw-r--r--src/block/block_compact.c4
-rw-r--r--src/block/block_ext.c35
-rw-r--r--src/block/block_mgr.c34
-rw-r--r--src/block/block_open.c16
-rw-r--r--src/block/block_read.c4
-rw-r--r--src/block/block_slvg.c6
-rw-r--r--src/block/block_vrfy.c22
-rw-r--r--src/block/block_write.c18
-rw-r--r--src/btree/bt_compact.c6
-rw-r--r--src/btree/bt_curnext.c22
-rw-r--r--src/btree/bt_curprev.c20
-rw-r--r--src/btree/bt_cursor.c130
-rw-r--r--src/btree/bt_debug.c28
-rw-r--r--src/btree/bt_discard.c8
-rw-r--r--src/btree/bt_handle.c44
-rw-r--r--src/btree/bt_huffman.c4
-rw-r--r--src/btree/bt_io.c19
-rw-r--r--src/btree/bt_ovfl.c2
-rw-r--r--src/btree/bt_page.c9
-rw-r--r--src/btree/bt_read.c2
-rw-r--r--src/btree/bt_ret.c2
-rw-r--r--src/btree/bt_slvg.c72
-rw-r--r--src/btree/bt_split.c64
-rw-r--r--src/btree/bt_stat.c8
-rw-r--r--src/btree/bt_sync.c6
-rw-r--r--src/btree/bt_vrfy.c33
-rw-r--r--src/btree/bt_vrfy_dsk.c19
-rw-r--r--src/btree/col_modify.c12
-rw-r--r--src/btree/row_key.c6
-rw-r--r--src/btree/row_modify.c10
-rw-r--r--src/btree/row_srch.c21
-rw-r--r--src/conn/conn_api.c367
-rw-r--r--src/conn/conn_cache.c6
-rw-r--r--src/conn/conn_cache_pool.c41
-rw-r--r--src/conn/conn_ckpt.c8
-rw-r--r--src/conn/conn_dhandle.c57
-rw-r--r--src/conn/conn_log.c22
-rw-r--r--src/conn/conn_open.c2
-rw-r--r--src/conn/conn_stat.c33
-rw-r--r--src/conn/conn_sweep.c12
-rw-r--r--src/cursor/cur_backup.c5
-rw-r--r--src/cursor/cur_file.c4
-rw-r--r--src/evict/evict_file.c2
-rw-r--r--src/evict/evict_lru.c69
-rw-r--r--src/evict/evict_page.c38
-rw-r--r--src/include/block.h16
-rw-r--r--src/include/btmem.h13
-rw-r--r--src/include/btree.h2
-rw-r--r--src/include/btree.i15
-rw-r--r--src/include/cache.i4
-rw-r--r--src/include/cursor.i4
-rw-r--r--src/include/extern.h84
-rw-r--r--src/include/flags.h24
-rw-r--r--src/include/schema.h38
-rw-r--r--src/include/txn.i1
-rw-r--r--src/log/log.c4
-rw-r--r--src/lsm/lsm_cursor.c6
-rw-r--r--src/lsm/lsm_manager.c6
-rw-r--r--src/lsm/lsm_stat.c2
-rw-r--r--src/lsm/lsm_tree.c32
-rw-r--r--src/lsm/lsm_work_unit.c4
-rw-r--r--src/meta/meta_turtle.c16
-rw-r--r--src/os_posix/os_exist.c6
-rw-r--r--src/os_posix/os_open.c2
-rw-r--r--src/os_win/os_exist.c6
-rw-r--r--src/os_win/os_open.c2
-rw-r--r--src/packing/pack_impl.c2
-rw-r--r--src/reconcile/rec_write.c153
-rw-r--r--src/schema/schema_drop.c17
-rw-r--r--src/schema/schema_open.c4
-rw-r--r--src/schema/schema_rename.c6
-rw-r--r--src/schema/schema_truncate.c4
-rw-r--r--src/schema/schema_worker.c6
-rw-r--r--src/session/session_api.c2
-rw-r--r--src/session/session_dhandle.c14
-rw-r--r--src/support/filename.c2
-rw-r--r--src/support/hazard.c6
-rw-r--r--src/txn/txn_ckpt.c18
-rw-r--r--test/utility/test_util.i148
82 files changed, 1134 insertions, 941 deletions
diff --git a/dist/flags.py b/dist/flags.py
index b8d9e5db469..394154fcb75 100644
--- a/dist/flags.py
+++ b/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/block/block_addr.c b/src/block/block_addr.c
index 6b5610eb17c..ccee83a7d5d 100644
--- a/src/block/block_addr.c
+++ b/src/block/block_addr.c
@@ -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/block/block_ckpt.c b/src/block/block_ckpt.c
index 40bba8184a1..987da4e8456 100644
--- a/src/block/block_ckpt.c
+++ b/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
/*
@@ -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;
diff --git a/src/block/block_compact.c b/src/block/block_compact.c
index 862bd62596a..6cd01e17eee 100644
--- a/src/block/block_compact.c
+++ b/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;
diff --git a/src/block/block_ext.c b/src/block/block_ext.c
index b368856bc1d..a7711d73941 100644
--- a/src/block/block_ext.c
+++ b/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;
@@ -102,7 +102,7 @@ __block_first_srch(WT_EXT **head, wt_off_t size, WT_EXT ***stack)
return (false);
/* Build a stack for the offset we want. */
- __block_off_srch(head, ext->off, stack, 0);
+ __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;
@@ -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/block/block_mgr.c b/src/block/block_mgr.c
index 558008ee7b0..84d065a0abe 100644
--- a/src/block/block_mgr.c
+++ b/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);
@@ -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;
@@ -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/block/block_open.c b/src/block/block_open.c
index 9223c1ad8e4..12c998c7853 100644
--- a/src/block/block_open.c
+++ b/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;
@@ -249,7 +251,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/block/block_read.c b/src/block/block_read.c
index 0d631396b41..c5e0e4d0146 100644
--- a/src/block/block_read.c
+++ b/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/block/block_slvg.c b/src/block/block_slvg.c
index 641bb8a42f7..9f3093c741d 100644
--- a/src/block/block_slvg.c
+++ b/src/block/block_slvg.c
@@ -66,7 +66,7 @@ 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));
}
/*
@@ -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/block/block_vrfy.c b/src/block/block_vrfy.c
index c9df768a624..6231685af38 100644
--- a/src/block/block_vrfy.c
+++ b/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 *);
@@ -97,7 +97,7 @@ __wt_block_verify_start(WT_SESSION_IMPL *session,
* 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;
@@ -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;
}
@@ -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/block/block_write.c b/src/block/block_write.c
index af31d82423c..3ebd2c22266 100644
--- a/src/block/block_write.c
+++ b/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;
diff --git a/src/btree/bt_compact.c b/src/btree/bt_compact.c
index 769423f7796..06cae2b7c37 100644
--- a/src/btree/bt_compact.c
+++ b/src/btree/bt_compact.c
@@ -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.
@@ -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
diff --git a/src/btree/bt_curnext.c b/src/btree/bt_curnext.c
index 5e866dc9233..0e3b7207edf 100644
--- a/src/btree/bt_curnext.c
+++ b/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;
@@ -423,14 +421,14 @@ __wt_btcur_next(WT_CURSOR_BTREE *cbt, int truncating)
* 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/btree/bt_curprev.c b/src/btree/bt_curprev.c
index 08388938080..661dd99558b 100644
--- a/src/btree/bt_curprev.c
+++ b/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;
@@ -510,14 +510,14 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating)
* 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/btree/bt_cursor.c b/src/btree/bt_cursor.c
index 2f907d978bd..5ebc8613516 100644
--- a/src/btree/bt_cursor.c
+++ b/src/btree/bt_cursor.c
@@ -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,8 +442,8 @@ __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));
@@ -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);
}
@@ -558,7 +559,7 @@ retry: WT_RET(__cursor_func_init(cbt, 1));
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.
@@ -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,8 +694,8 @@ __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));
@@ -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);
}
@@ -787,8 +788,11 @@ __wt_btcur_next_random(WT_CURSOR_BTREE *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));
@@ -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/btree/bt_debug.c b/src/btree/bt_debug.c
index 041398d4e43..4affc9c243e 100644
--- a/src/btree/bt_debug.c
+++ b/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/btree/bt_discard.c b/src/btree/bt_discard.c
index a05c6217338..c876da6309c 100644
--- a/src/btree/bt_discard.c
+++ b/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/btree/bt_handle.c b/src/btree/bt_handle.c
index e249f997d87..ec33300fefd 100644
--- a/src/btree/bt_handle.c
+++ b/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);
@@ -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/btree/bt_huffman.c b/src/btree/bt_huffman.c
index c75e9dfed83..2d59a9ac977 100644
--- a/src/btree/bt_huffman.c
+++ b/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/btree/bt_io.c b/src/btree/bt_io.c
index 3ff395dbbfd..226f9827f51 100644
--- a/src/btree/bt_io.c
+++ b/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/btree/bt_ovfl.c b/src/btree/bt_ovfl.c
index 7104e702418..651cbc8d4ad 100644
--- a/src/btree/bt_ovfl.c
+++ b/src/btree/bt_ovfl.c
@@ -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/btree/bt_page.c b/src/btree/bt_page.c
index 9d84a76132e..41cc8f9398c 100644
--- a/src/btree/bt_page.c
+++ b/src/btree/bt_page.c
@@ -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/btree/bt_read.c b/src/btree/bt_read.c
index a3ce39b7758..0d2422727d0 100644
--- a/src/btree/bt_read.c
+++ b/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/btree/bt_ret.c b/src/btree/bt_ret.c
index c37ff6dc809..cc92b1e02e3 100644
--- a/src/btree/bt_ret.c
+++ b/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/btree/bt_slvg.c b/src/btree/bt_slvg.c
index e493a84679a..89355baeb5c 100644
--- a/src/btree/bt_slvg.c
+++ b/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/btree/bt_split.c b/src/btree/bt_split.c
index 4661212c05e..390d6544014 100644
--- a/src/btree/bt_split.c
+++ b/src/btree/bt_split.c
@@ -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,13 @@ __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_INTL_FOREACH_BEGIN(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 +388,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 +447,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 +523,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 +602,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 +671,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 +681,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 +691,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);
}
@@ -802,14 +804,14 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
uint64_t split_gen;
uint32_t children, i, j;
uint32_t deleted_entries, parent_entries, result_entries;
- int complete, hazard;
+ bool complete, hazard;
parent = NULL; /* -Wconditional-uninitialized */
alloc_index = pindex = NULL;
parent_ref = NULL;
parent_decr = 0;
parent_entries = 0;
- complete = hazard = 0;
+ complete = hazard = false;
/*
* Get a page-level lock on the parent to single-thread splits into the
@@ -849,7 +851,7 @@ __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;
+ hazard = true;
}
pindex = WT_INTL_INDEX_GET_SAFE(parent);
@@ -938,7 +940,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
@@ -1047,7 +1049,7 @@ err: if (!complete)
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,
@@ -1083,16 +1085,16 @@ __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref, int *splitp)
right = NULL;
page_decr = parent_incr = right_incr = 0;
- /*
- * 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.
- *
- * Note this page has already been through an in-memory split.
- */
- 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);
+ /*
+ * 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.
+ *
+ * Note this page has already been through an in-memory split.
+ */
+ 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);
/* Find the last item in the insert list. */
ins_head = page->pg_row_entries == 0 ?
@@ -1136,7 +1138,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);
@@ -1144,7 +1146,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);
@@ -1445,7 +1447,7 @@ 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);
}
diff --git a/src/btree/bt_stat.c b/src/btree/bt_stat.c
index 6285edde217..6775636dd40 100644
--- a/src/btree/bt_stat.c
+++ b/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/btree/bt_sync.c b/src/btree/bt_sync.c
index 1b5c182577b..939d8f808b1 100644
--- a/src/btree/bt_sync.c
+++ b/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);
@@ -151,7 +151,7 @@ __sync_file(WT_SESSION_IMPL *session, int syncop)
if (!WT_PAGE_IS_INTERNAL(page) &&
F_ISSET(txn, WT_TXN_HAS_SNAPSHOT) &&
WT_TXNID_LT(txn->snap_max, mod->first_dirty_txn) &&
- !F_ISSET(mod, WT_PM_REC_REWRITE)) {
+ 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/btree/bt_vrfy.c b/src/btree/bt_vrfy.c
index 93d1ddad8c6..841d28c0806 100644
--- a/src/btree/bt_vrfy.c
+++ b/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/btree/bt_vrfy_dsk.c b/src/btree/bt_vrfy_dsk.c
index dbaf18c69f2..5d9d7b2d6c4 100644
--- a/src/btree/bt_vrfy_dsk.c
+++ b/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/btree/col_modify.c b/src/btree/col_modify.c
index 01db31057fc..23cebde6973 100644
--- a/src/btree/col_modify.c
+++ b/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/btree/row_key.c b/src/btree/row_key.c
index 4affa7fa62a..6d24708e59c 100644
--- a/src/btree/row_key.c
+++ b/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/btree/row_modify.c b/src/btree/row_modify.c
index 6a9ad1c78b9..25ea19ee5d2 100644
--- a/src/btree/row_modify.c
+++ b/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/btree/row_srch.c b/src/btree/row_srch.c
index 6a8ca5f401c..9ec90d72a3b 100644
--- a/src/btree/row_srch.c
+++ b/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/conn/conn_api.c b/src/conn/conn_api.c
index 98ff56290be..7188ff8b0b4 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -133,179 +133,6 @@ __wt_collator_config(WT_SESSION_IMPL *session, const char *uri,
}
/*
- * __conn_get_extension_api --
- * WT_CONNECTION.get_extension_api method.
- */
-static WT_EXTENSION_API *
-__conn_get_extension_api(WT_CONNECTION *wt_conn)
-{
- WT_CONNECTION_IMPL *conn;
-
- conn = (WT_CONNECTION_IMPL *)wt_conn;
-
- conn->extension_api.conn = wt_conn;
- conn->extension_api.err_printf = __wt_ext_err_printf;
- conn->extension_api.msg_printf = __wt_ext_msg_printf;
- conn->extension_api.strerror = __wt_ext_strerror;
- conn->extension_api.scr_alloc = __wt_ext_scr_alloc;
- conn->extension_api.scr_free = __wt_ext_scr_free;
- conn->extension_api.collator_config = ext_collator_config;
- conn->extension_api.collate = ext_collate;
- conn->extension_api.config_parser_open = __wt_ext_config_parser_open;
- conn->extension_api.config_get = __wt_ext_config_get;
- conn->extension_api.metadata_insert = __wt_ext_metadata_insert;
- conn->extension_api.metadata_remove = __wt_ext_metadata_remove;
- conn->extension_api.metadata_search = __wt_ext_metadata_search;
- conn->extension_api.metadata_update = __wt_ext_metadata_update;
- conn->extension_api.struct_pack = __wt_ext_struct_pack;
- conn->extension_api.struct_size = __wt_ext_struct_size;
- conn->extension_api.struct_unpack = __wt_ext_struct_unpack;
- conn->extension_api.transaction_id = __wt_ext_transaction_id;
- conn->extension_api.transaction_isolation_level =
- __wt_ext_transaction_isolation_level;
- conn->extension_api.transaction_notify = __wt_ext_transaction_notify;
- conn->extension_api.transaction_oldest = __wt_ext_transaction_oldest;
- conn->extension_api.transaction_visible = __wt_ext_transaction_visible;
- conn->extension_api.version = wiredtiger_version;
-
- return (&conn->extension_api);
-}
-
-#ifdef HAVE_BUILTIN_EXTENSION_SNAPPY
- extern int snappy_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
-#endif
-#ifdef HAVE_BUILTIN_EXTENSION_ZLIB
- extern int zlib_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
-#endif
-#ifdef HAVE_BUILTIN_EXTENSION_LZ4
- extern int lz4_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
-#endif
-
-/*
- * __conn_load_default_extensions --
- * Load extensions that are enabled via --with-builtins
- */
-static int
-__conn_load_default_extensions(WT_CONNECTION_IMPL *conn)
-{
- WT_UNUSED(conn);
-#ifdef HAVE_BUILTIN_EXTENSION_SNAPPY
- WT_RET(snappy_extension_init(&conn->iface, NULL));
-#endif
-#ifdef HAVE_BUILTIN_EXTENSION_ZLIB
- WT_RET(zlib_extension_init(&conn->iface, NULL));
-#endif
-#ifdef HAVE_BUILTIN_EXTENSION_LZ4
- WT_RET(lz4_extension_init(&conn->iface, NULL));
-#endif
- return (0);
-}
-
-/*
- * __conn_load_extension --
- * WT_CONNECTION->load_extension method.
- */
-static int
-__conn_load_extension(
- WT_CONNECTION *wt_conn, const char *path, const char *config)
-{
- WT_CONFIG_ITEM cval;
- WT_CONNECTION_IMPL *conn;
- WT_DECL_RET;
- WT_DLH *dlh;
- WT_SESSION_IMPL *session;
- int (*load)(WT_CONNECTION *, WT_CONFIG_ARG *);
- int is_local;
- const char *init_name, *terminate_name;
-
- dlh = NULL;
- init_name = terminate_name = NULL;
- is_local = (strcmp(path, "local") == 0);
-
- conn = (WT_CONNECTION_IMPL *)wt_conn;
- CONNECTION_API_CALL(conn, session, load_extension, config, cfg);
-
- /*
- * This assumes the underlying shared libraries are reference counted,
- * that is, that re-opening a shared library simply increments a ref
- * count, and closing it simply decrements the ref count, and the last
- * close discards the reference entirely -- in other words, we do not
- * check to see if we've already opened this shared library.
- */
- WT_ERR(__wt_dlopen(session, is_local ? NULL : path, &dlh));
-
- /*
- * Find the load function, remember the unload function for when we
- * close.
- */
- WT_ERR(__wt_config_gets(session, cfg, "entry", &cval));
- WT_ERR(__wt_strndup(session, cval.str, cval.len, &init_name));
- WT_ERR(__wt_dlsym(session, dlh, init_name, 1, &load));
-
- WT_ERR(__wt_config_gets(session, cfg, "terminate", &cval));
- WT_ERR(__wt_strndup(session, cval.str, cval.len, &terminate_name));
- WT_ERR(__wt_dlsym(session, dlh, terminate_name, 0, &dlh->terminate));
-
- /* Call the load function last, it simplifies error handling. */
- WT_ERR(load(wt_conn, (WT_CONFIG_ARG *)cfg));
-
- /* Link onto the environment's list of open libraries. */
- __wt_spin_lock(session, &conn->api_lock);
- TAILQ_INSERT_TAIL(&conn->dlhqh, dlh, q);
- __wt_spin_unlock(session, &conn->api_lock);
- dlh = NULL;
-
-err: if (dlh != NULL)
- WT_TRET(__wt_dlclose(session, dlh));
- __wt_free(session, init_name);
- __wt_free(session, terminate_name);
-
- API_END_RET_NOTFOUND_MAP(session, ret);
-}
-
-/*
- * __conn_load_extensions --
- * Load the list of application-configured extensions.
- */
-static int
-__conn_load_extensions(WT_SESSION_IMPL *session, const char *cfg[])
-{
- WT_CONFIG subconfig;
- WT_CONFIG_ITEM cval, skey, sval;
- WT_CONNECTION_IMPL *conn;
- WT_DECL_ITEM(exconfig);
- WT_DECL_ITEM(expath);
- WT_DECL_RET;
-
- conn = S2C(session);
-
- WT_ERR(__conn_load_default_extensions(conn));
-
- WT_ERR(__wt_config_gets(session, cfg, "extensions", &cval));
- WT_ERR(__wt_config_subinit(session, &subconfig, &cval));
- while ((ret = __wt_config_next(&subconfig, &skey, &sval)) == 0) {
- if (expath == NULL)
- WT_ERR(__wt_scr_alloc(session, 0, &expath));
- WT_ERR(__wt_buf_fmt(
- session, expath, "%.*s", (int)skey.len, skey.str));
- if (sval.len > 0) {
- if (exconfig == NULL)
- WT_ERR(__wt_scr_alloc(session, 0, &exconfig));
- WT_ERR(__wt_buf_fmt(session,
- exconfig, "%.*s", (int)sval.len, sval.str));
- }
- WT_ERR(conn->iface.load_extension(&conn->iface,
- expath->data, (sval.len > 0) ? exconfig->data : NULL));
- }
- WT_ERR_NOTFOUND_OK(ret);
-
-err: __wt_scr_free(session, &expath);
- __wt_scr_free(session, &exconfig);
-
- return (ret);
-}
-
-/*
* __conn_add_collator --
* WT_CONNECTION->add_collator method.
*/
@@ -745,6 +572,179 @@ err: API_END_RET_NOTFOUND_MAP(session, ret);
}
/*
+ * __conn_get_extension_api --
+ * WT_CONNECTION.get_extension_api method.
+ */
+static WT_EXTENSION_API *
+__conn_get_extension_api(WT_CONNECTION *wt_conn)
+{
+ WT_CONNECTION_IMPL *conn;
+
+ conn = (WT_CONNECTION_IMPL *)wt_conn;
+
+ conn->extension_api.conn = wt_conn;
+ conn->extension_api.err_printf = __wt_ext_err_printf;
+ conn->extension_api.msg_printf = __wt_ext_msg_printf;
+ conn->extension_api.strerror = __wt_ext_strerror;
+ conn->extension_api.scr_alloc = __wt_ext_scr_alloc;
+ conn->extension_api.scr_free = __wt_ext_scr_free;
+ conn->extension_api.collator_config = ext_collator_config;
+ conn->extension_api.collate = ext_collate;
+ conn->extension_api.config_parser_open = __wt_ext_config_parser_open;
+ conn->extension_api.config_get = __wt_ext_config_get;
+ conn->extension_api.metadata_insert = __wt_ext_metadata_insert;
+ conn->extension_api.metadata_remove = __wt_ext_metadata_remove;
+ conn->extension_api.metadata_search = __wt_ext_metadata_search;
+ conn->extension_api.metadata_update = __wt_ext_metadata_update;
+ conn->extension_api.struct_pack = __wt_ext_struct_pack;
+ conn->extension_api.struct_size = __wt_ext_struct_size;
+ conn->extension_api.struct_unpack = __wt_ext_struct_unpack;
+ conn->extension_api.transaction_id = __wt_ext_transaction_id;
+ conn->extension_api.transaction_isolation_level =
+ __wt_ext_transaction_isolation_level;
+ conn->extension_api.transaction_notify = __wt_ext_transaction_notify;
+ conn->extension_api.transaction_oldest = __wt_ext_transaction_oldest;
+ conn->extension_api.transaction_visible = __wt_ext_transaction_visible;
+ conn->extension_api.version = wiredtiger_version;
+
+ return (&conn->extension_api);
+}
+
+#ifdef HAVE_BUILTIN_EXTENSION_SNAPPY
+ extern int snappy_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
+#endif
+#ifdef HAVE_BUILTIN_EXTENSION_ZLIB
+ extern int zlib_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
+#endif
+#ifdef HAVE_BUILTIN_EXTENSION_LZ4
+ extern int lz4_extension_init(WT_CONNECTION *, WT_CONFIG_ARG *);
+#endif
+
+/*
+ * __conn_load_default_extensions --
+ * Load extensions that are enabled via --with-builtins
+ */
+static int
+__conn_load_default_extensions(WT_CONNECTION_IMPL *conn)
+{
+ WT_UNUSED(conn);
+#ifdef HAVE_BUILTIN_EXTENSION_SNAPPY
+ WT_RET(snappy_extension_init(&conn->iface, NULL));
+#endif
+#ifdef HAVE_BUILTIN_EXTENSION_ZLIB
+ WT_RET(zlib_extension_init(&conn->iface, NULL));
+#endif
+#ifdef HAVE_BUILTIN_EXTENSION_LZ4
+ WT_RET(lz4_extension_init(&conn->iface, NULL));
+#endif
+ return (0);
+}
+
+/*
+ * __conn_load_extension --
+ * WT_CONNECTION->load_extension method.
+ */
+static int
+__conn_load_extension(
+ WT_CONNECTION *wt_conn, const char *path, const char *config)
+{
+ WT_CONFIG_ITEM cval;
+ WT_CONNECTION_IMPL *conn;
+ WT_DECL_RET;
+ WT_DLH *dlh;
+ WT_SESSION_IMPL *session;
+ int (*load)(WT_CONNECTION *, WT_CONFIG_ARG *);
+ bool is_local;
+ const char *init_name, *terminate_name;
+
+ dlh = NULL;
+ init_name = terminate_name = NULL;
+ is_local = strcmp(path, "local") == 0;
+
+ conn = (WT_CONNECTION_IMPL *)wt_conn;
+ CONNECTION_API_CALL(conn, session, load_extension, config, cfg);
+
+ /*
+ * This assumes the underlying shared libraries are reference counted,
+ * that is, that re-opening a shared library simply increments a ref
+ * count, and closing it simply decrements the ref count, and the last
+ * close discards the reference entirely -- in other words, we do not
+ * check to see if we've already opened this shared library.
+ */
+ WT_ERR(__wt_dlopen(session, is_local ? NULL : path, &dlh));
+
+ /*
+ * Find the load function, remember the unload function for when we
+ * close.
+ */
+ WT_ERR(__wt_config_gets(session, cfg, "entry", &cval));
+ WT_ERR(__wt_strndup(session, cval.str, cval.len, &init_name));
+ WT_ERR(__wt_dlsym(session, dlh, init_name, 1, &load));
+
+ WT_ERR(__wt_config_gets(session, cfg, "terminate", &cval));
+ WT_ERR(__wt_strndup(session, cval.str, cval.len, &terminate_name));
+ WT_ERR(__wt_dlsym(session, dlh, terminate_name, 0, &dlh->terminate));
+
+ /* Call the load function last, it simplifies error handling. */
+ WT_ERR(load(wt_conn, (WT_CONFIG_ARG *)cfg));
+
+ /* Link onto the environment's list of open libraries. */
+ __wt_spin_lock(session, &conn->api_lock);
+ TAILQ_INSERT_TAIL(&conn->dlhqh, dlh, q);
+ __wt_spin_unlock(session, &conn->api_lock);
+ dlh = NULL;
+
+err: if (dlh != NULL)
+ WT_TRET(__wt_dlclose(session, dlh));
+ __wt_free(session, init_name);
+ __wt_free(session, terminate_name);
+
+ API_END_RET_NOTFOUND_MAP(session, ret);
+}
+
+/*
+ * __conn_load_extensions --
+ * Load the list of application-configured extensions.
+ */
+static int
+__conn_load_extensions(WT_SESSION_IMPL *session, const char *cfg[])
+{
+ WT_CONFIG subconfig;
+ WT_CONFIG_ITEM cval, skey, sval;
+ WT_CONNECTION_IMPL *conn;
+ WT_DECL_ITEM(exconfig);
+ WT_DECL_ITEM(expath);
+ WT_DECL_RET;
+
+ conn = S2C(session);
+
+ WT_ERR(__conn_load_default_extensions(conn));
+
+ WT_ERR(__wt_config_gets(session, cfg, "extensions", &cval));
+ WT_ERR(__wt_config_subinit(session, &subconfig, &cval));
+ while ((ret = __wt_config_next(&subconfig, &skey, &sval)) == 0) {
+ if (expath == NULL)
+ WT_ERR(__wt_scr_alloc(session, 0, &expath));
+ WT_ERR(__wt_buf_fmt(
+ session, expath, "%.*s", (int)skey.len, skey.str));
+ if (sval.len > 0) {
+ if (exconfig == NULL)
+ WT_ERR(__wt_scr_alloc(session, 0, &exconfig));
+ WT_ERR(__wt_buf_fmt(session,
+ exconfig, "%.*s", (int)sval.len, sval.str));
+ }
+ WT_ERR(conn->iface.load_extension(&conn->iface,
+ expath->data, (sval.len > 0) ? exconfig->data : NULL));
+ }
+ WT_ERR_NOTFOUND_OK(ret);
+
+err: __wt_scr_free(session, &expath);
+ __wt_scr_free(session, &exconfig);
+
+ return (ret);
+}
+
+/*
* __conn_get_home --
* WT_CONNECTION.get_home method.
*/
@@ -876,7 +876,7 @@ __conn_reconfigure(WT_CONNECTION *wt_conn, const char *config)
WT_ERR(__conn_statistics_config(session, config_cfg));
WT_ERR(__wt_async_reconfig(session, config_cfg));
- WT_ERR(__wt_cache_config(session, 1, config_cfg));
+ WT_ERR(__wt_cache_config(session, true, config_cfg));
WT_ERR(__wt_checkpoint_server_create(session, config_cfg));
WT_ERR(__wt_lsm_manager_reconfig(session, config_cfg));
WT_ERR(__wt_statlog_create(session, config_cfg));
@@ -967,13 +967,13 @@ __conn_config_check_version(WT_SESSION_IMPL *session, const char *config)
*/
static int
__conn_config_file(WT_SESSION_IMPL *session,
- const char *filename, int is_user, const char **cfg, WT_ITEM *cbuf)
+ const char *filename, bool is_user, const char **cfg, WT_ITEM *cbuf)
{
WT_DECL_RET;
WT_FH *fh;
size_t len;
wt_off_t size;
- int exist, quoted;
+ bool exist, quoted;
char *p, *t;
fh = NULL;
@@ -984,7 +984,7 @@ __conn_config_file(WT_SESSION_IMPL *session,
return (0);
/* Open the configuration file. */
- WT_RET(__wt_open(session, filename, 0, 0, 0, &fh));
+ WT_RET(__wt_open(session, filename, false, false, 0, &fh));
WT_ERR(__wt_filesize(session, fh, &size));
if (size == 0)
goto err;
@@ -1021,7 +1021,7 @@ __conn_config_file(WT_SESSION_IMPL *session,
* escaped. Comment lines (an unescaped newline where the next non-
* white-space character is a hash), are discarded.
*/
- for (quoted = 0, p = t = cbuf->mem; len > 0;) {
+ for (quoted = false, p = t = cbuf->mem; len > 0;) {
/*
* Backslash pairs pass through untouched, unless immediately
* preceding a newline, in which case both the backslash and
@@ -1257,7 +1257,8 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[])
* isn't simple to detect that case, and there's no risk other than a
* useless file being left in the directory.)
*/
- WT_ERR(__wt_open(session, WT_SINGLETHREAD, 1, 0, 0, &conn->lock_fh));
+ WT_ERR(__wt_open(
+ session, WT_SINGLETHREAD, true, false, 0, &conn->lock_fh));
/*
* Lock a byte of the file: if we don't get the lock, some other process
@@ -1285,7 +1286,7 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[])
/* We own the lock file, optionally create the WiredTiger file. */
WT_ERR(__wt_config_gets(session, cfg, "create", &cval));
WT_ERR(__wt_open(session,
- WT_WIREDTIGER, cval.val == 0 ? 0 : 1, 0, 0, &fh));
+ WT_WIREDTIGER, cval.val != 0, false, 0, &fh));
/*
* Lock the WiredTiger file (for backward compatibility reasons as
@@ -1466,7 +1467,7 @@ __conn_write_base_config(WT_SESSION_IMPL *session, const char *cfg[])
WT_CONFIG parser;
WT_CONFIG_ITEM cval, k, v;
WT_DECL_RET;
- int exist;
+ bool exist;
fp = NULL;
@@ -1669,9 +1670,9 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
*/
cfg[0] = WT_CONFIG_BASE(session, wiredtiger_open_all);
cfg[1] = NULL;
- WT_ERR(__conn_config_file(session, WT_BASECONFIG, 0, cfg, &i1));
+ WT_ERR(__conn_config_file(session, WT_BASECONFIG, false, cfg, &i1));
__conn_config_append(cfg, config);
- WT_ERR(__conn_config_file(session, WT_USERCONFIG, 1, cfg, &i2));
+ WT_ERR(__conn_config_file(session, WT_USERCONFIG, true, cfg, &i2));
WT_ERR(__conn_config_env(session, cfg, &i3));
/*
diff --git a/src/conn/conn_cache.c b/src/conn/conn_cache.c
index 8de8cd3f8bc..e00466d6bc5 100644
--- a/src/conn/conn_cache.c
+++ b/src/conn/conn_cache.c
@@ -13,7 +13,7 @@
* Configure the underlying cache.
*/
static int
-__cache_config_local(WT_SESSION_IMPL *session, int shared, const char *cfg[])
+__cache_config_local(WT_SESSION_IMPL *session, bool shared, const char *cfg[])
{
WT_CACHE *cache;
WT_CONFIG_ITEM cval;
@@ -73,7 +73,7 @@ __cache_config_local(WT_SESSION_IMPL *session, int shared, const char *cfg[])
* Configure or reconfigure the current cache and shared cache.
*/
int
-__wt_cache_config(WT_SESSION_IMPL *session, int reconfigure, const char *cfg[])
+__wt_cache_config(WT_SESSION_IMPL *session, bool reconfigure, const char *cfg[])
{
WT_CONFIG_ITEM cval;
WT_CONNECTION_IMPL *conn;
@@ -134,7 +134,7 @@ __wt_cache_create(WT_SESSION_IMPL *session, const char *cfg[])
cache = conn->cache;
/* Use a common routine for run-time configuration options. */
- WT_RET(__wt_cache_config(session, 0, cfg));
+ WT_RET(__wt_cache_config(session, false, cfg));
/*
* The target size must be lower than the trigger size or we will never
diff --git a/src/conn/conn_cache_pool.c b/src/conn/conn_cache_pool.c
index 488864ce351..c0656004df2 100644
--- a/src/conn/conn_cache_pool.c
+++ b/src/conn/conn_cache_pool.c
@@ -20,7 +20,8 @@
/* Balancing passes after a reduction before a connection is a candidate. */
#define WT_CACHE_POOL_REDUCE_SKIPS 5
-static int __cache_pool_adjust(WT_SESSION_IMPL *, uint64_t, uint64_t, int *);
+static int __cache_pool_adjust(
+ WT_SESSION_IMPL *, uint64_t, uint64_t, bool *);
static int __cache_pool_assess(WT_SESSION_IMPL *, uint64_t *);
static int __cache_pool_balance(WT_SESSION_IMPL *);
@@ -36,17 +37,17 @@ __wt_cache_pool_config(WT_SESSION_IMPL *session, const char **cfg)
WT_CONNECTION_IMPL *conn, *entry;
WT_DECL_RET;
char *pool_name;
- int created, updating;
+ bool created, updating;
uint64_t chunk, reserve, size, used_cache;
conn = S2C(session);
- created = updating = 0;
+ created = updating = false;
pool_name = NULL;
cp = NULL;
size = 0;
if (F_ISSET(conn, WT_CONN_CACHE_POOL))
- updating = 1;
+ updating = true;
else {
WT_RET(__wt_config_gets_none(
session, cfg, "shared_cache.name", &cval));
@@ -84,7 +85,7 @@ __wt_cache_pool_config(WT_SESSION_IMPL *session, const char **cfg)
WT_ASSERT(session, !updating);
/* Create a cache pool. */
WT_ERR(__wt_calloc_one(session, &cp));
- created = 1;
+ created = true;
cp->name = pool_name;
pool_name = NULL; /* Belongs to the cache pool now. */
TAILQ_INIT(&cp->cache_pool_qh);
@@ -274,21 +275,21 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session)
WT_CONNECTION_IMPL *conn, *entry;
WT_DECL_RET;
WT_SESSION *wt_session;
- int cp_locked, found;
+ bool cp_locked, found;
conn = S2C(session);
cache = conn->cache;
- cp_locked = found = 0;
+ cp_locked = found = false;
cp = __wt_process.cache_pool;
if (!F_ISSET(conn, WT_CONN_CACHE_POOL))
return (0);
__wt_spin_lock(session, &cp->cache_pool_lock);
- cp_locked = 1;
+ cp_locked = true;
TAILQ_FOREACH(entry, &cp->cache_pool_qh, cpq)
if (entry == conn) {
- found = 1;
+ found = true;
break;
}
@@ -311,7 +312,7 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session)
* operation.
*/
__wt_spin_unlock(session, &cp->cache_pool_lock);
- cp_locked = 0;
+ cp_locked = false;
F_CLR(cache, WT_CACHE_POOL_RUN);
WT_TRET(__wt_cond_signal(session, cp->cache_pool_cond));
@@ -326,7 +327,7 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session)
* participant.
*/
__wt_spin_lock(session, &cp->cache_pool_lock);
- cp_locked = 1;
+ cp_locked = true;
}
/*
@@ -358,7 +359,7 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session)
__wt_process.cache_pool = NULL;
__wt_spin_unlock(session, &__wt_process.spinlock);
__wt_spin_unlock(session, &cp->cache_pool_lock);
- cp_locked = 0;
+ cp_locked = false;
/* Now free the pool. */
__wt_free(session, cp->name);
@@ -392,8 +393,8 @@ __cache_pool_balance(WT_SESSION_IMPL *session)
{
WT_CACHE_POOL *cp;
WT_DECL_RET;
- int adjusted;
uint64_t bump_threshold, highest;
+ bool adjusted;
cp = __wt_process.cache_pool;
adjusted = 0;
@@ -482,18 +483,18 @@ __cache_pool_assess(WT_SESSION_IMPL *session, uint64_t *phighest)
*/
static int
__cache_pool_adjust(WT_SESSION_IMPL *session,
- uint64_t highest, uint64_t bump_threshold, int *adjustedp)
+ uint64_t highest, uint64_t bump_threshold, bool *adjustedp)
{
WT_CACHE_POOL *cp;
WT_CACHE *cache;
WT_CONNECTION_IMPL *entry;
uint64_t adjusted, reserved, read_pressure;
- int force, grew;
+ bool force, grew;
- *adjustedp = 0;
+ *adjustedp = false;
cp = __wt_process.cache_pool;
force = (cp->currently_used > cp->size);
- grew = 0;
+ grew = false;
if (WT_VERBOSE_ISSET(session, WT_VERB_SHARED_CACHE)) {
WT_RET(__wt_verbose(session,
WT_VERB_SHARED_CACHE, "Cache pool distribution: "));
@@ -521,7 +522,7 @@ __cache_pool_adjust(WT_SESSION_IMPL *session,
* - The reserved size has been adjusted
*/
if (entry->cache_size < reserved) {
- grew = 1;
+ grew = true;
adjusted = reserved - entry->cache_size;
/*
* Conditions for reducing the amount of resources for an
@@ -537,7 +538,7 @@ __cache_pool_adjust(WT_SESSION_IMPL *session,
(read_pressure < WT_CACHE_POOL_REDUCE_THRESHOLD &&
highest > 1 && entry->cache_size > reserved &&
cp->currently_used >= cp->size)) {
- grew = 0;
+ grew = false;
/*
* Shrink by a chunk size if that doesn't drop us
* below the reserved size.
@@ -561,7 +562,7 @@ __cache_pool_adjust(WT_SESSION_IMPL *session,
(entry->cache_size * cache->eviction_target) / 100 &&
cp->currently_used < cp->size &&
read_pressure > bump_threshold) {
- grew = 1;
+ grew = true;
adjusted = WT_MIN(cp->chunk,
cp->size - cp->currently_used);
}
diff --git a/src/conn/conn_ckpt.c b/src/conn/conn_ckpt.c
index 74f27d8bd18..a2e985ee1ea 100644
--- a/src/conn/conn_ckpt.c
+++ b/src/conn/conn_ckpt.c
@@ -15,7 +15,7 @@ static int __ckpt_server_start(WT_CONNECTION_IMPL *);
* Parse and setup the checkpoint server options.
*/
static int
-__ckpt_server_config(WT_SESSION_IMPL *session, const char **cfg, int *startp)
+__ckpt_server_config(WT_SESSION_IMPL *session, const char **cfg, bool *startp)
{
WT_CONFIG_ITEM cval;
WT_CONNECTION_IMPL *conn;
@@ -38,10 +38,10 @@ __ckpt_server_config(WT_SESSION_IMPL *session, const char **cfg, int *startp)
if ((conn->ckpt_usecs == 0 && conn->ckpt_logsize == 0) ||
(conn->ckpt_logsize && conn->ckpt_usecs == 0 &&
!FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED))) {
- *startp = 0;
+ *startp = false;
return (0);
}
- *startp = 1;
+ *startp = true;
/*
* The application can specify a checkpoint name, which we ignore if
@@ -161,7 +161,7 @@ int
__wt_checkpoint_server_create(WT_SESSION_IMPL *session, const char *cfg[])
{
WT_CONNECTION_IMPL *conn;
- int start;
+ bool start;
conn = S2C(session);
start = 0;
diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c
index 54cc1308537..f68004bbe03 100644
--- a/src/conn/conn_dhandle.c
+++ b/src/conn/conn_dhandle.c
@@ -140,7 +140,7 @@ __wt_conn_dhandle_find(WT_SESSION_IMPL *session,
conn = S2C(session);
/* We must be holding the handle list lock at a higher level. */
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED) &&
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST) &&
!LF_ISSET(WT_DHANDLE_HAVE_REF));
/* Increment the reference count if we already have the btree open. */
@@ -229,7 +229,7 @@ __conn_dhandle_get(WT_SESSION_IMPL *session,
* need new files again soon, until they are cached by all sessions.
* Find the right hash bucket to insert into as well.
*/
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
bucket = dhandle->name_hash % WT_HASH_ARRAY_SIZE;
WT_CONN_DHANDLE_INSERT(conn, dhandle, bucket);
@@ -253,9 +253,9 @@ err: WT_TRET(__wt_rwlock_destroy(session, &dhandle->rwlock));
static int
__conn_dhandle_mark_dead(WT_SESSION_IMPL *session)
{
- int evict_reset;
+ bool evict_reset;
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
/*
* Handle forced discard (e.g., when dropping a file).
@@ -275,12 +275,12 @@ __conn_dhandle_mark_dead(WT_SESSION_IMPL *session)
* Sync and close the underlying btree handle.
*/
int
-__wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, int final, int force)
+__wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, bool final, bool force)
{
WT_BTREE *btree;
WT_DATA_HANDLE *dhandle;
WT_DECL_RET;
- int no_schema_lock;
+ bool no_schema_lock;
dhandle = session->dhandle;
btree = S2BT(session);
@@ -295,9 +295,9 @@ __wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session, int final, int force)
* we might deadlock with a thread that has the schema lock and wants
* a handle lock (specifically, checkpoint).
*/
- no_schema_lock = 0;
- if (!F_ISSET(session, WT_SESSION_SCHEMA_LOCKED)) {
- no_schema_lock = 1;
+ no_schema_lock = false;
+ if (!F_ISSET(session, WT_SESSION_LOCKED_SCHEMA)) {
+ no_schema_lock = true;
F_SET(session, WT_SESSION_NO_SCHEMA_LOCK);
}
@@ -420,7 +420,7 @@ __conn_btree_open(WT_SESSION_IMPL *session, const char *cfg[], uint32_t flags)
dhandle = session->dhandle;
btree = S2BT(session);
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_SCHEMA_LOCKED) &&
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SCHEMA) &&
F_ISSET(dhandle, WT_DHANDLE_EXCLUSIVE) &&
!LF_ISSET(WT_DHANDLE_LOCK_ONLY));
@@ -441,7 +441,7 @@ __conn_btree_open(WT_SESSION_IMPL *session, const char *cfg[], uint32_t flags)
* in the tree that can block the close.
*/
if (F_ISSET(dhandle, WT_DHANDLE_OPEN))
- WT_RET(__wt_conn_btree_sync_and_close(session, 0, 0));
+ WT_RET(__wt_conn_btree_sync_and_close(session, false, false));
/* Discard any previous configuration, set up the new configuration. */
__conn_btree_config_clear(session);
@@ -494,7 +494,7 @@ __wt_conn_btree_get(WT_SESSION_IMPL *session,
WT_RET(
__conn_dhandle_open_lock(session, session->dhandle, flags));
else {
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __conn_dhandle_get(session, name, ckpt, flags));
WT_RET(ret);
}
@@ -551,7 +551,7 @@ __conn_btree_apply_internal(WT_SESSION_IMPL *session, WT_DATA_HANDLE *dhandle,
*/
int
__wt_conn_btree_apply(WT_SESSION_IMPL *session,
- int apply_checkpoints, const char *uri,
+ bool apply_checkpoints, const char *uri,
int (*func)(WT_SESSION_IMPL *, const char *[]), const char *cfg[])
{
WT_CONNECTION_IMPL *conn;
@@ -560,7 +560,7 @@ __wt_conn_btree_apply(WT_SESSION_IMPL *session,
conn = S2C(session);
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
/*
* If we're given a URI, then we walk only the hash list for that
@@ -650,7 +650,7 @@ __wt_conn_btree_apply_single(WT_SESSION_IMPL *session,
conn = S2C(session);
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
hash = __wt_hash_city64(uri, strlen(uri));
bucket = hash % WT_HASH_ARRAY_SIZE;
@@ -690,7 +690,7 @@ __wt_conn_btree_apply_single(WT_SESSION_IMPL *session,
*/
int
__wt_conn_dhandle_close_all(
- WT_SESSION_IMPL *session, const char *name, int force)
+ WT_SESSION_IMPL *session, const char *uri, bool force)
{
WT_CONNECTION_IMPL *conn;
WT_DATA_HANDLE *dhandle;
@@ -699,12 +699,12 @@ __wt_conn_dhandle_close_all(
conn = S2C(session);
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
WT_ASSERT(session, session->dhandle == NULL);
- bucket = __wt_hash_city64(name, strlen(name)) % WT_HASH_ARRAY_SIZE;
+ bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE;
TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) {
- if (strcmp(dhandle->name, name) != 0 ||
+ if (strcmp(dhandle->name, uri) != 0 ||
F_ISSET(dhandle, WT_DHANDLE_DEAD))
continue;
@@ -724,7 +724,7 @@ __wt_conn_dhandle_close_all(
if (F_ISSET(dhandle, WT_DHANDLE_OPEN)) {
if ((ret = __wt_meta_track_sub_on(session)) == 0)
ret = __wt_conn_btree_sync_and_close(
- session, 0, force);
+ session, false, force);
/*
* If the close succeeded, drop any locks it acquired.
@@ -750,7 +750,7 @@ err: session->dhandle = NULL;
* Remove a handle from the shared list.
*/
static int
-__conn_dhandle_remove(WT_SESSION_IMPL *session, int final)
+__conn_dhandle_remove(WT_SESSION_IMPL *session, bool final)
{
WT_CONNECTION_IMPL *conn;
WT_DATA_HANDLE *dhandle;
@@ -760,7 +760,7 @@ __conn_dhandle_remove(WT_SESSION_IMPL *session, int final)
dhandle = session->dhandle;
bucket = dhandle->name_hash % WT_HASH_ARRAY_SIZE;
- WT_ASSERT(session, F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED));
+ WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));
WT_ASSERT(session, dhandle != conn->cache->evict_file_next);
/* Check if the handle was reacquired by a session while we waited. */
@@ -778,7 +778,8 @@ __conn_dhandle_remove(WT_SESSION_IMPL *session, int final)
* Close/discard a single data handle.
*/
int
-__wt_conn_dhandle_discard_single(WT_SESSION_IMPL *session, int final, int force)
+__wt_conn_dhandle_discard_single(
+ WT_SESSION_IMPL *session, bool final, bool force)
{
WT_DATA_HANDLE *dhandle;
WT_DECL_RET;
@@ -801,11 +802,11 @@ __wt_conn_dhandle_discard_single(WT_SESSION_IMPL *session, int final, int force)
* Kludge: interrupt the eviction server in case it is holding the
* handle list lock.
*/
- if (!F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED))
+ if (!F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST))
F_SET(S2C(session)->cache, WT_CACHE_CLEAR_WALKS);
/* Try to remove the handle, protected by the data handle lock. */
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
WT_TRET(__conn_dhandle_remove(session, final)));
/*
@@ -852,7 +853,8 @@ restart:
continue;
WT_WITH_DHANDLE(session, dhandle,
- WT_TRET(__wt_conn_dhandle_discard_single(session, 1, 0)));
+ WT_TRET(__wt_conn_dhandle_discard_single(
+ session, true, false)));
goto restart;
}
@@ -868,7 +870,8 @@ restart:
/* Close the metadata file handle. */
while ((dhandle = TAILQ_FIRST(&conn->dhqh)) != NULL)
WT_WITH_DHANDLE(session, dhandle,
- WT_TRET(__wt_conn_dhandle_discard_single(session, 1, 0)));
+ WT_TRET(__wt_conn_dhandle_discard_single(
+ session, true, false)));
return (ret);
}
diff --git a/src/conn/conn_log.c b/src/conn/conn_log.c
index 65e0f684382..f9c26a86b92 100644
--- a/src/conn/conn_log.c
+++ b/src/conn/conn_log.c
@@ -42,7 +42,7 @@ __logmgr_sync_cfg(WT_SESSION_IMPL *session, const char **cfg)
* Parse and setup the logging server options.
*/
static int
-__logmgr_config(WT_SESSION_IMPL *session, const char **cfg, int *runp)
+__logmgr_config(WT_SESSION_IMPL *session, const char **cfg, bool *runp)
{
WT_CONFIG_ITEM cval;
WT_CONNECTION_IMPL *conn;
@@ -67,7 +67,7 @@ __logmgr_config(WT_SESSION_IMPL *session, const char **cfg, int *runp)
WT_RET(__wt_strndup(session, cval.str, cval.len, &conn->log_path));
/* We are done if logging isn't enabled. */
- if (*runp == 0)
+ if (!*runp)
return (0);
WT_RET(__wt_config_gets(session, cfg, "log.archive", &cval));
@@ -281,12 +281,12 @@ __log_file_server(void *arg)
WT_LOG *log;
WT_LSN close_end_lsn, close_lsn;
WT_SESSION_IMPL *session;
- int locked;
+ bool locked;
session = arg;
conn = S2C(session);
log = conn->log;
- locked = 0;
+ locked = false;
while (F_ISSET(conn, WT_CONN_LOG_SERVER_RUN)) {
/*
* If there is a log file to close, make sure any outstanding
@@ -314,13 +314,13 @@ __log_file_server(void *arg)
close_end_lsn.file++;
WT_ERR(__wt_fsync(session, close_fh));
__wt_spin_lock(session, &log->log_sync_lock);
- locked = 1;
+ locked = true;
WT_ERR(__wt_close(session, &close_fh));
WT_ASSERT(session,
LOG_CMP(&close_end_lsn, &log->sync_lsn) >= 0);
log->sync_lsn = close_end_lsn;
WT_ERR(__wt_cond_signal(session, log->log_sync_cond));
- locked = 0;
+ locked = false;
__wt_spin_unlock(session, &log->log_sync_lock);
} else
/* Wait until the next event. */
@@ -466,12 +466,12 @@ __log_server(void *arg)
WT_DECL_RET;
WT_LOG *log;
WT_SESSION_IMPL *session;
- u_int locked;
+ bool locked;
session = arg;
conn = S2C(session);
log = conn->log;
- locked = 0;
+ locked = false;
while (F_ISSET(conn, WT_CONN_LOG_SERVER_RUN)) {
/*
* Perform log pre-allocation.
@@ -485,11 +485,11 @@ __log_server(void *arg)
if (FLD_ISSET(conn->log_flags, WT_CONN_LOG_ARCHIVE)) {
if (__wt_try_writelock(
session, log->log_archive_lock) == 0) {
- locked = 1;
+ locked = true;
WT_ERR(__log_archive_once(session, 0));
WT_ERR( __wt_writeunlock(
session, log->log_archive_lock));
- locked = 0;
+ locked = false;
} else
WT_ERR(__wt_verbose(session, WT_VERB_LOG,
"log_archive: Blocked due to open log "
@@ -516,7 +516,7 @@ __wt_logmgr_create(WT_SESSION_IMPL *session, const char *cfg[])
{
WT_CONNECTION_IMPL *conn;
WT_LOG *log;
- int run;
+ bool run;
conn = S2C(session);
diff --git a/src/conn/conn_open.c b/src/conn/conn_open.c
index a140a06628d..1f34da7e7c5 100644
--- a/src/conn/conn_open.c
+++ b/src/conn/conn_open.c
@@ -114,7 +114,7 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn)
F_SET(conn, WT_CONN_CLOSING);
WT_TRET(__wt_checkpoint_server_destroy(session));
- WT_TRET(__wt_statlog_destroy(session, 1));
+ WT_TRET(__wt_statlog_destroy(session, true));
WT_TRET(__wt_sweep_destroy(session));
WT_TRET(__wt_evict_destroy(session));
diff --git a/src/conn/conn_stat.c b/src/conn/conn_stat.c
index 07ebfacface..9668b906686 100644
--- a/src/conn/conn_stat.c
+++ b/src/conn/conn_stat.c
@@ -56,7 +56,7 @@ __wt_conn_stat_init(WT_SESSION_IMPL *session)
* Parse and setup the statistics server options.
*/
static int
-__statlog_config(WT_SESSION_IMPL *session, const char **cfg, int *runp)
+__statlog_config(WT_SESSION_IMPL *session, const char **cfg, bool *runp)
{
WT_CONFIG objectconf;
WT_CONFIG_ITEM cval, k, v;
@@ -70,7 +70,7 @@ __statlog_config(WT_SESSION_IMPL *session, const char **cfg, int *runp)
WT_RET(__wt_config_gets(session, cfg, "statistics_log.wait", &cval));
/* Only start the server if wait time is non-zero */
- *runp = (cval.val == 0) ? 0 : 1;
+ *runp = cval.val != 0;
conn->stat_usecs = (uint64_t)cval.val * 1000000;
WT_RET(__wt_config_gets(
@@ -82,7 +82,7 @@ __statlog_config(WT_SESSION_IMPL *session, const char **cfg, int *runp)
* Statistics logging configuration requires either a wait time or an
* on-close setting.
*/
- if (*runp == 0 && !FLD_ISSET(conn->stat_flags, WT_CONN_STAT_ON_CLOSE))
+ if (!*runp && !FLD_ISSET(conn->stat_flags, WT_CONN_STAT_ON_CLOSE))
return (0);
WT_RET(__wt_config_gets(session, cfg, "statistics_log.sources", &cval));
@@ -133,7 +133,7 @@ err: __stat_sources_free(session, &sources);
* Dump out handle/connection statistics.
*/
static int
-__statlog_dump(WT_SESSION_IMPL *session, const char *name, int conn_stats)
+__statlog_dump(WT_SESSION_IMPL *session, const char *name, bool conn_stats)
{
WT_CONNECTION_IMPL *conn;
WT_CURSOR *cursor;
@@ -207,8 +207,8 @@ __statlog_apply(WT_SESSION_IMPL *session, const char *cfg[])
/* Check for a match on the set of sources. */
for (p = S2C(session)->stat_sources; *p != NULL; ++p)
if (WT_PREFIX_MATCH(dhandle->name, *p)) {
- WT_WITHOUT_DHANDLE(session,
- ret = __statlog_dump(session, dhandle->name, 0));
+ WT_WITHOUT_DHANDLE(session, ret =
+ __statlog_dump(session, dhandle->name, false));
return (ret);
}
return (0);
@@ -227,7 +227,8 @@ __statlog_lsm_apply(WT_SESSION_IMPL *session)
#define WT_LSM_TREE_LIST_SLOTS 100
WT_LSM_TREE *lsm_tree, *list[WT_LSM_TREE_LIST_SLOTS];
WT_DECL_RET;
- int cnt, locked;
+ int cnt;
+ bool locked;
char **p;
cnt = locked = 0;
@@ -247,7 +248,7 @@ __statlog_lsm_apply(WT_SESSION_IMPL *session)
* will bump a reference count, so the tree won't go away.
*/
__wt_spin_lock(session, &S2C(session)->schema_lock);
- locked = 1;
+ locked = true;
TAILQ_FOREACH(lsm_tree, &S2C(session)->lsmqh, q) {
if (cnt == WT_LSM_TREE_LIST_SLOTS)
break;
@@ -259,11 +260,11 @@ __statlog_lsm_apply(WT_SESSION_IMPL *session)
}
}
__wt_spin_unlock(session, &S2C(session)->schema_lock);
- locked = 0;
+ locked = false;
while (cnt > 0) {
--cnt;
- WT_TRET(__statlog_dump(session, list[cnt]->name, 0));
+ WT_TRET(__statlog_dump(session, list[cnt]->name, false));
__wt_lsm_tree_release(session, list[cnt]);
}
@@ -318,7 +319,7 @@ __statlog_log_one(WT_SESSION_IMPL *session, WT_ITEM *path, WT_ITEM *tmp)
conn->stat_stamp = tmp->mem;
/* Dump the connection statistics. */
- WT_RET(__statlog_dump(session, conn->home, 1));
+ WT_RET(__statlog_dump(session, conn->home, true));
#if SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_LOGGING
/* Dump the spinlock statistics. */
@@ -330,9 +331,9 @@ __statlog_log_one(WT_SESSION_IMPL *session, WT_ITEM *path, WT_ITEM *tmp)
* any that match the list of object sources.
*/
if (conn->stat_sources != NULL) {
- WT_WITH_DHANDLE_LOCK(session, ret =
+ WT_WITH_HANDLE_LIST_LOCK(session, ret =
__wt_conn_btree_apply(
- session, 0, NULL, __statlog_apply, NULL));
+ session, false, NULL, __statlog_apply, NULL));
WT_RET(ret);
}
@@ -473,7 +474,7 @@ int
__wt_statlog_create(WT_SESSION_IMPL *session, const char *cfg[])
{
WT_CONNECTION_IMPL *conn;
- int start;
+ bool start;
conn = S2C(session);
start = 0;
@@ -484,7 +485,7 @@ __wt_statlog_create(WT_SESSION_IMPL *session, const char *cfg[])
* configuration changes - but that makes our lives easier.
*/
if (conn->stat_session != NULL)
- WT_RET(__wt_statlog_destroy(session, 0));
+ WT_RET(__wt_statlog_destroy(session, false));
WT_RET(__statlog_config(session, cfg, &start));
if (start)
@@ -498,7 +499,7 @@ __wt_statlog_create(WT_SESSION_IMPL *session, const char *cfg[])
* Destroy the statistics server thread.
*/
int
-__wt_statlog_destroy(WT_SESSION_IMPL *session, int is_close)
+__wt_statlog_destroy(WT_SESSION_IMPL *session, bool is_close)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c
index 061d70221c7..c220d1cf604 100644
--- a/src/conn/conn_sweep.c
+++ b/src/conn/conn_sweep.c
@@ -64,7 +64,7 @@ __sweep_expire_one(WT_SESSION_IMPL *session)
WT_BTREE *btree;
WT_DATA_HANDLE *dhandle;
WT_DECL_RET;
- int evict_reset;
+ bool evict_reset;
btree = S2BT(session);
dhandle = session->dhandle;
@@ -100,7 +100,7 @@ __sweep_expire_one(WT_SESSION_IMPL *session)
* handle. Closing the handle decrements the open file count,
* meaning the close loop won't overrun the configured minimum.
*/
- ret = __wt_conn_btree_sync_and_close(session, 0, 1);
+ ret = __wt_conn_btree_sync_and_close(session, false, true);
if (evict_reset)
__wt_evict_file_exclusive_off(session);
@@ -139,7 +139,7 @@ __sweep_expire(WT_SESSION_IMPL *session, time_t now)
now <= dhandle->timeofdeath + conn->sweep_idle_time)
continue;
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
WT_WITH_DHANDLE(session, dhandle,
ret = __sweep_expire_one(session)));
WT_RET_BUSY_OK(ret);
@@ -173,7 +173,7 @@ __sweep_discard_trees(WT_SESSION_IMPL *session, u_int *dead_handlesp)
/* If the handle is marked "dead", flush it from cache. */
WT_WITH_DHANDLE(session, dhandle, ret =
- __wt_conn_btree_sync_and_close(session, 0, 0));
+ __wt_conn_btree_sync_and_close(session, false, false));
/* We closed the btree handle. */
if (ret == 0) {
@@ -208,7 +208,7 @@ __sweep_remove_one(WT_SESSION_IMPL *session, WT_DATA_HANDLE *dhandle)
WT_ERR(EBUSY);
WT_WITH_DHANDLE(session, dhandle,
- ret = __wt_conn_dhandle_discard_single(session, 0, 1));
+ ret = __wt_conn_dhandle_discard_single(session, false, true));
/*
* If the handle was not successfully discarded, unlock it and
@@ -243,7 +243,7 @@ __sweep_remove_handles(WT_SESSION_IMPL *session)
if (!WT_DHANDLE_CAN_DISCARD(dhandle))
continue;
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __sweep_remove_one(session, dhandle));
if (ret == 0)
WT_STAT_FAST_CONN_INCR(session, dh_sweep_remove);
diff --git a/src/cursor/cur_backup.c b/src/cursor/cur_backup.c
index 5b47c2c1a73..4232270c406 100644
--- a/src/cursor/cur_backup.c
+++ b/src/cursor/cur_backup.c
@@ -191,7 +191,8 @@ __backup_start(
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
- int exist, log_only, target_list;
+ bool exist;
+ int log_only, target_list;
conn = S2C(session);
@@ -376,7 +377,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));
diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c
index 10ff18df0e0..cf6c988464a 100644
--- a/src/cursor/cur_file.c
+++ b/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);
diff --git a/src/evict/evict_file.c b/src/evict/evict_file.c
index 795833d3b25..8bfa5c89ff3 100644
--- a/src/evict/evict_file.c
+++ b/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
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c
index 1f8260e54e1..2fbfa796c1f 100644
--- a/src/evict/evict_lru.c
+++ b/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 *);
@@ -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
@@ -721,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;
@@ -735,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
@@ -795,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;
@@ -925,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);
}
@@ -943,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)
@@ -988,7 +988,7 @@ retry: while (slot < max_entries && ret == 0) {
}
if (ret != 0)
break;
- dhandle_locked = 1;
+ dhandle_locked = true;
}
if (dhandle == NULL) {
@@ -1006,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);
}
@@ -1050,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);
@@ -1085,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;
}
/*
@@ -1154,7 +1154,8 @@ __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;
@@ -1162,6 +1163,8 @@ __evict_walk_file(WT_SESSION_IMPL *session, u_int *slotp, uint32_t flags)
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;
@@ -1185,7 +1188,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;
@@ -1309,7 +1312,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;
@@ -1392,7 +1395,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;
@@ -1461,13 +1464,14 @@ __wt_evict_lru_page(WT_SESSION_IMPL *session, int is_server)
* Wait for space in the cache.
*/
int
-__wt_cache_wait(WT_SESSION_IMPL *session, int full)
+__wt_cache_wait(WT_SESSION_IMPL *session, bool full)
{
WT_CACHE *cache;
WT_DECL_RET;
WT_TXN_GLOBAL *txn_global;
WT_TXN_STATE *txn_state;
- int busy, count;
+ int count;
+ bool busy;
cache = S2C(session)->cache;
@@ -1527,10 +1531,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/evict/evict_page.c b/src/evict/evict_page.c
index 9fb6c5e396a..dee89b41e71 100644
--- a/src/evict/evict_page.c
+++ b/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,7 +314,7 @@ __evict_review(
}
/* Check if the page can be evicted. */
- if (!exclusive) {
+ if (!closing) {
/*
* Update the oldest ID to avoid wasted effort should it have
* fallen behind current.
@@ -363,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)
@@ -378,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/include/block.h b/src/include/block.h
index 8dd8e12a5c1..6e0de069b3f 100644
--- a/src/include/block.h
+++ b/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,9 +160,9 @@ 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 *);
@@ -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 */
};
/*
diff --git a/src/include/btmem.h b/src/include/btmem.h
index 2933add6201..9910cad0ae7 100644
--- a/src/include/btmem.h
+++ b/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/include/btree.h b/src/include/btree.h
index 264ebdefc39..d92324db560 100644
--- a/src/include/btree.h
+++ b/src/include/btree.h
@@ -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 */
diff --git a/src/include/btree.i b/src/include/btree.i
index 2eae1c5e1f4..07f11b0c06c 100644
--- a/src/include/btree.i
+++ b/src/include/btree.i
@@ -24,7 +24,7 @@ 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);
}
/*
@@ -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);
@@ -1001,12 +1001,15 @@ __wt_page_can_split(WT_SESSION_IMPL *session, WT_PAGE *page)
*/
static inline bool
__wt_page_can_evict(WT_SESSION_IMPL *session,
- WT_PAGE *page, int check_splits, int *inmem_splitp)
+ WT_PAGE *page, int 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;
@@ -1022,7 +1025,7 @@ __wt_page_can_evict(WT_SESSION_IMPL *session,
*/
if (__wt_page_can_split(session, page)) {
if (inmem_splitp != NULL)
- *inmem_splitp = 1;
+ *inmem_splitp = true;
return (true);
}
@@ -1047,7 +1050,7 @@ __wt_page_can_evict(WT_SESSION_IMPL *session,
*/
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 (false);
diff --git a/src/include/cache.i b/src/include/cache.i
index 3af454775b2..f63a07de44e 100644
--- a/src/include/cache.i
+++ b/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);
@@ -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/include/cursor.i b/src/include/cursor.i
index 97739c83b8f..9b07c3b1676 100644
--- a/src/include/cursor.i
+++ b/src/include/cursor.i
@@ -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/include/extern.h b/src/include/extern.h
index b66954566a9..80028817a5c 100644
--- a/src/include/extern.h
+++ b/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_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);
@@ -64,8 +64,8 @@ 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 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, 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 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);
@@ -87,9 +87,9 @@ 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 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);
@@ -118,19 +118,19 @@ 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);
@@ -159,25 +159,25 @@ 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,7 +247,7 @@ 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);
@@ -309,12 +309,12 @@ 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_cache_wait(WT_SESSION_IMPL *session, int full);
+extern int __wt_evict_lru_page(WT_SESSION_IMPL *session, bool is_server);
+extern int __wt_cache_wait(WT_SESSION_IMPL *session, bool 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);
@@ -458,7 +458,7 @@ extern int __wt_dlsym(WT_SESSION_IMPL *session, WT_DLH *dlh, const char *name, i
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);
@@ -489,7 +489,7 @@ 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 bool __wt_absolute_path(const char *path);
extern const char *__wt_path_separator(void);
@@ -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, ...);
@@ -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
diff --git a/src/include/flags.h b/src/include/flags.h
index 1d7173743e5..71fc54f9eac 100644
--- a/src/include/flags.h
+++ b/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/include/schema.h b/src/include/schema.h
index 50d8e37800b..e590089e607 100644
--- a/src/include/schema.h
+++ b/src/include/schema.h
@@ -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)
/*
@@ -124,35 +124,35 @@ struct __wt_table {
#define WT_WITHOUT_LOCKS(session, op) do { \
WT_CONNECTION_IMPL *__conn = S2C(session); \
int __handle_locked = \
- F_ISSET(session, WT_SESSION_HANDLE_LIST_LOCKED);\
+ F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST);\
int __table_locked = \
- F_ISSET(session, WT_SESSION_TABLE_LOCKED); \
+ F_ISSET(session, WT_SESSION_LOCKED_TABLE); \
int __schema_locked = \
- F_ISSET(session, WT_SESSION_SCHEMA_LOCKED); \
+ F_ISSET(session, WT_SESSION_LOCKED_SCHEMA); \
if (__handle_locked) { \
- F_CLR(session, WT_SESSION_HANDLE_LIST_LOCKED); \
+ F_CLR(session, WT_SESSION_LOCKED_HANDLE_LIST); \
__wt_spin_unlock(session, &__conn->dhandle_lock);\
} \
if (__table_locked) { \
- F_CLR(session, WT_SESSION_TABLE_LOCKED); \
+ F_CLR(session, WT_SESSION_LOCKED_TABLE); \
__wt_spin_unlock(session, &__conn->table_lock);\
} \
if (__schema_locked) { \
- F_CLR(session, WT_SESSION_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_SCHEMA_LOCKED); \
+ F_SET(session, WT_SESSION_LOCKED_SCHEMA); \
} \
if (__table_locked) { \
__wt_spin_lock(session, &__conn->table_lock); \
- F_SET(session, WT_SESSION_TABLE_LOCKED); \
+ F_SET(session, WT_SESSION_LOCKED_TABLE); \
} \
if (__handle_locked) { \
__wt_spin_lock(session, &__conn->dhandle_lock); \
- F_SET(session, WT_SESSION_HANDLE_LIST_LOCKED); \
+ 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/include/txn.i b/src/include/txn.i
index 8b414e80eef..3152ff6bdd5 100644
--- a/src/include/txn.i
+++ b/src/include/txn.i
@@ -234,6 +234,7 @@ __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);
}
diff --git a/src/log/log.c b/src/log/log.c
index 9b1da4b0b35..659e3556df9 100644
--- a/src/log/log.c
+++ b/src/log/log.c
@@ -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.
@@ -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.
diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c
index ebbeeed8649..86209eb3dc1 100644
--- a/src/lsm/lsm_cursor.c
+++ b/src/lsm/lsm_cursor.c
@@ -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));
}
}
@@ -1525,7 +1525,7 @@ __wt_clsm_open(WT_SESSION_IMPL *session,
bulk = 1;
/* 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/lsm/lsm_manager.c b/src/lsm/lsm_manager.c
index 0e22af3b623..2309b55670f 100644
--- a/src/lsm/lsm_manager.c
+++ b/src/lsm/lsm_manager.c
@@ -418,7 +418,7 @@ __lsm_manager_run_server(WT_SESSION_IMPL *session)
if (TAILQ_EMPTY(&conn->lsmqh))
continue;
__wt_spin_lock(session, &conn->dhandle_lock);
- F_SET(session, WT_SESSION_HANDLE_LIST_LOCKED);
+ F_SET(session, WT_SESSION_LOCKED_HANDLE_LIST);
dhandle_locked = 1;
TAILQ_FOREACH(lsm_tree, &S2C(session)->lsmqh, q) {
if (!F_ISSET(lsm_tree, WT_LSM_TREE_ACTIVE))
@@ -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);
+ F_CLR(session, WT_SESSION_LOCKED_HANDLE_LIST);
dhandle_locked = 0;
}
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/lsm/lsm_stat.c b/src/lsm/lsm_stat.c
index 656e43c978d..b704226b345 100644
--- a/src/lsm/lsm_stat.c
+++ b/src/lsm/lsm_stat.c
@@ -32,7 +32,7 @@ __curstat_lsm_init(
"checkpoint=" WT_CHECKPOINT, NULL, NULL };
locked = 0;
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, uri, 0, &lsm_tree));
WT_RET(ret);
WT_ERR(__wt_scr_alloc(session, 0, &uribuf));
diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c
index 3c8f4d5750a..f2eb580f471 100644
--- a/src/lsm/lsm_tree.c
+++ b/src/lsm/lsm_tree.c
@@ -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);
}
@@ -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(
@@ -308,7 +308,7 @@ __wt_lsm_tree_create(WT_SESSION_IMPL *session,
char *tmpconfig;
/* If the tree is open, it already exists. */
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, uri, 0, &lsm_tree));
if (ret == 0) {
__wt_lsm_tree_release(session, lsm_tree);
@@ -430,7 +430,7 @@ __wt_lsm_tree_create(WT_SESSION_IMPL *session,
* tracking macros handle cleaning up on failure.
*/
if (ret == 0)
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __lsm_tree_open(session, uri, 1, &lsm_tree));
if (ret == 0)
__wt_lsm_tree_release(session, lsm_tree);
@@ -455,7 +455,7 @@ __lsm_tree_find(WT_SESSION_IMPL *session,
{
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)
@@ -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))
@@ -614,7 +614,7 @@ __wt_lsm_tree_get(WT_SESSION_IMPL *session,
{
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)
@@ -941,7 +941,7 @@ __wt_lsm_tree_drop(
locked = 0;
/* Get the LSM tree. */
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, name, 1, &lsm_tree));
WT_RET(ret);
@@ -977,7 +977,7 @@ __wt_lsm_tree_drop(
err: if (locked)
WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree));
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
WT_TRET(__lsm_tree_discard(session, lsm_tree, 0)));
return (ret);
}
@@ -1001,7 +1001,7 @@ __wt_lsm_tree_rename(WT_SESSION_IMPL *session,
locked = 0;
/* Get the LSM tree. */
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, olduri, 1, &lsm_tree));
WT_RET(ret);
@@ -1051,7 +1051,7 @@ 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_WITH_HANDLE_LIST_LOCK(session,
WT_TRET(__lsm_tree_discard(session, lsm_tree, 0)));
return (ret);
}
@@ -1074,7 +1074,7 @@ __wt_lsm_tree_truncate(
locked = 0;
/* Get the LSM tree. */
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, name, 1, &lsm_tree));
WT_RET(ret);
@@ -1113,7 +1113,7 @@ 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_WITH_HANDLE_LIST_LOCK(session,
WT_TRET(__lsm_tree_discard(session, lsm_tree, 0)));
}
return (ret);
@@ -1212,7 +1212,7 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
/* Tell __wt_schema_worker not to look inside the LSM tree. */
*skip = 1;
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, name, 0, &lsm_tree));
WT_RET(ret);
@@ -1398,7 +1398,7 @@ __wt_lsm_tree_worker(WT_SESSION_IMPL *session,
locked = 0;
exclusive = FLD_ISSET(open_flags, WT_DHANDLE_EXCLUSIVE) ? 1 : 0;
- WT_WITH_DHANDLE_LOCK(session,
+ WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, uri, exclusive, &lsm_tree));
WT_RET(ret);
diff --git a/src/lsm/lsm_work_unit.c b/src/lsm/lsm_work_unit.c
index 3e0fd43d404..08c02467517 100644
--- a/src/lsm/lsm_work_unit.c
+++ b/src/lsm/lsm_work_unit.c
@@ -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);
diff --git a/src/meta/meta_turtle.c b/src/meta/meta_turtle.c
index 7e3ac3530f8..0378d8a410c 100644
--- a/src/meta/meta_turtle.c
+++ b/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/os_posix/os_exist.c b/src/os_posix/os_exist.c
index 173021e6100..644a27dca9a 100644
--- a/src/os_posix/os_exist.c
+++ b/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/os_posix/os_open.c b/src/os_posix/os_open.c
index 1453f1a666d..5d6ac6942de 100644
--- a/src/os_posix/os_open.c
+++ b/src/os_posix/os_open.c
@@ -30,7 +30,7 @@ __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;
diff --git a/src/os_win/os_exist.c b/src/os_win/os_exist.c
index 747ea7dfc27..4a727801569 100644
--- a/src/os_win/os_exist.c
+++ b/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/os_win/os_open.c b/src/os_win/os_open.c
index 3bd24369242..9bdae92774b 100644
--- a/src/os_win/os_open.c
+++ b/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;
diff --git a/src/packing/pack_impl.c b/src/packing/pack_impl.c
index c92325a4c23..3a4428eae15 100644
--- a/src/packing/pack_impl.c
+++ b/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/reconcile/rec_write.c b/src/reconcile/rec_write.c
index 80298759100..84a8f4bfde5 100644
--- a/src/reconcile/rec_write.c
+++ b/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,12 +268,12 @@ 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 */
@@ -510,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 */
@@ -530,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);
}
@@ -653,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 =
@@ -661,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;
@@ -685,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
@@ -698,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;
@@ -1336,7 +1338,7 @@ 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;
@@ -1482,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;
@@ -1593,7 +1595,7 @@ __rec_split_bnd_init(WT_SESSION_IMPL *session, WT_BOUNDARY *bnd)
* reconciliation.
*/
- bnd->already_compressed = 0;
+ bnd->already_compressed = false;
}
/*
@@ -1779,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);
}
@@ -1909,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);
@@ -2404,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);
@@ -2425,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:
@@ -2514,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
@@ -2598,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);
@@ -2874,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);
@@ -2922,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;
}
@@ -2939,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
@@ -2951,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 &&
@@ -2966,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;
@@ -3004,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:
@@ -3100,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));
@@ -3113,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);
@@ -3314,7 +3317,7 @@ __rec_col_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
* Modified child. Empty pages are merged into the
* parent and discarded.
*/
- switch (F_ISSET(child->modify, WT_PM_REC_MASK)) {
+ switch (child->modify->rec_result) {
case WT_PM_REC_EMPTY:
/*
* Column-store pages are almost never empty, as
@@ -3890,7 +3893,7 @@ record_loop: /*
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;
@@ -4096,7 +4099,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) {
@@ -4145,7 +4148,7 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
* Modified child. Empty pages are merged into the
* parent and discarded.
*/
- switch (F_ISSET(child->modify, WT_PM_REC_MASK)) {
+ switch (child->modify->rec_result) {
case WT_PM_REC_EMPTY:
/*
* Overflow keys referencing empty pages are no
@@ -4232,7 +4235,7 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
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) {
@@ -4297,7 +4300,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(
@@ -4494,7 +4497,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 {
/*
@@ -4531,7 +4534,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));
@@ -4586,7 +4589,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
@@ -4660,7 +4663,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(
@@ -4676,9 +4679,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);
@@ -4746,7 +4749,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(
@@ -4762,9 +4765,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);
@@ -4870,7 +4873,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
@@ -4924,7 +4927,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,
@@ -4944,8 +4949,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
@@ -4954,7 +4959,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 */
/*
@@ -4980,7 +4985,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;
}
@@ -4990,14 +4995,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,
@@ -5072,7 +5077,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;
}
@@ -5133,7 +5138,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,
@@ -5498,7 +5503,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
@@ -5523,7 +5528,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
diff --git a/src/schema/schema_drop.c b/src/schema/schema_drop.c
index 694d07c65bf..27d0a2bb614 100644
--- a/src/schema/schema_drop.c
+++ b/src/schema/schema_drop.c
@@ -14,7 +14,7 @@
*/
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;
@@ -29,7 +29,7 @@ __drop_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,13 +53,13 @@ __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(
@@ -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;
@@ -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;
@@ -164,10 +163,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));
diff --git a/src/schema/schema_open.c b/src/schema/schema_open.c
index 414722652a0..2b645d5c666 100644
--- a/src/schema/schema_open.c
+++ b/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);
@@ -407,7 +407,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));
diff --git a/src/schema/schema_rename.c b/src/schema/schema_rename.c
index c00ffa7d61c..f75b68037af 100644
--- a/src/schema/schema_rename.c
+++ b/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);
/*
diff --git a/src/schema/schema_truncate.c b/src/schema/schema_truncate.c
index 1eb76226aad..3f2d080284c 100644
--- a/src/schema/schema_truncate.c
+++ b/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. */
diff --git a/src/schema/schema_worker.c b/src/schema/schema_worker.c
index e913fcfe69d..7d747f54a76 100644
--- a/src/schema/schema_worker.c
+++ b/src/schema/schema_worker.c
@@ -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,7 +62,7 @@ __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);
diff --git a/src/session/session_api.c b/src/session/session_api.c
index 38f5536f441..2773b31ce1e 100644
--- a/src/session/session_api.c
+++ b/src/session/session_api.c
@@ -1015,7 +1015,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));
}
diff --git a/src/session/session_dhandle.c b/src/session/session_dhandle.c
index a087e7c896d..8b23c3769c3 100644
--- a/src/session/session_dhandle.c
+++ b/src/session/session_dhandle.c
@@ -208,13 +208,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);
}
@@ -391,7 +391,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 +414,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 +441,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)));
diff --git a/src/support/filename.c b/src/support/filename.c
index db466ed3bd4..e065d59151e 100644
--- a/src/support/filename.c
+++ b/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/support/hazard.c b/src/support/hazard.c
index 37cb8bf6ce0..8333661db2d 100644
--- a/src/support/hazard.c
+++ b/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);
}
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c
index aa2ba850310..2cecba087b5 100644
--- a/src/txn/txn_ckpt.c
+++ b/src/txn/txn_ckpt.c
@@ -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);
@@ -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);
@@ -417,7 +417,7 @@ __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));
@@ -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);
}
@@ -1122,7 +1122,7 @@ __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));
}
@@ -1146,7 +1146,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));
}
/*
@@ -1183,7 +1183,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:
diff --git a/test/utility/test_util.i b/test/utility/test_util.i
new file mode 100644
index 00000000000..48b5d191a32
--- /dev/null
+++ b/test/utility/test_util.i
@@ -0,0 +1,148 @@
+/*-
+ * Public Domain 2014-2015 MongoDB, Inc.
+ * Public Domain 2008-2014 WiredTiger, Inc.
+ *
+ * This is free and unencumbered software released into the public domain.
+ *
+ * Anyone is free to copy, modify, publish, use, compile, sell, or
+ * distribute this software, either in source code form or as a compiled
+ * binary, for any purpose, commercial or non-commercial, and by any
+ * means.
+ *
+ * In jurisdictions that recognize copyright laws, the author or authors
+ * of this software dedicate any and all copyright interest in the
+ * software to the public domain. We make this dedication for the benefit
+ * of the public at large and to the detriment of our heirs and
+ * successors. We intend this dedication to be an overt act of
+ * relinquishment in perpetuity of all present and future rights to this
+ * software under copyright law.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <wiredtiger.h>
+#include "wt_internal.h" /* For __wt_XXX */
+
+#ifdef _WIN32
+#include "windows_shim.h"
+#endif
+
+#ifdef _WIN32
+ #define DIR_DELIM '\\'
+ #define RM_COMMAND "rd /s /q "
+#else
+ #define DIR_DELIM '/'
+ #define RM_COMMAND "rm -rf "
+#endif
+
+#define DEFAULT_DIR "WT_TEST"
+#define MKDIR_COMMAND "mkdir "
+
+/*
+ * die --
+ * Report an error and quit.
+ */
+static inline void
+testutil_die(int e, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ if (e != 0)
+ fprintf(stderr, ": %s", wiredtiger_strerror(e));
+ fprintf(stderr, "\n");
+ exit(EXIT_FAILURE);
+}
+
+/*
+ * testutil_work_dir_from_path --
+ * Takes a buffer, its size and the intended work directory.
+ * Creates the full intended work directory in buffer.
+ */
+static inline void
+testutil_work_dir_from_path(char *buffer, size_t inputSize, char *dir)
+{
+ /* If no directory is provided, use the default. */
+ if (dir == NULL) {
+ if (inputSize < sizeof(DEFAULT_DIR))
+ testutil_die(ENOMEM,
+ "Not enough memory in buffer for directory %s%c%s",
+ dir, DIR_DELIM, DEFAULT_DIR);
+
+ snprintf(buffer, inputSize, DEFAULT_DIR);
+ return;
+ }
+
+ /* Additional bytes for the directory and WT_TEST. */
+ if (inputSize < strlen(dir) + sizeof(DEFAULT_DIR) + sizeof(DIR_DELIM))
+ testutil_die(ENOMEM,
+ "Not enough memory in buffer for directory %s%c%s",
+ dir, DIR_DELIM, DEFAULT_DIR);
+
+ snprintf(buffer, inputSize, "%s%c%s", dir, DIR_DELIM, DEFAULT_DIR);
+}
+
+/*
+ * testutil_clean_work_dir --
+ * Remove any existing work directories, can optionally fail on error
+ */
+static inline void
+testutil_clean_work_dir(char *dir)
+{
+ size_t inputSize;
+ int ret;
+ bool exist;
+ char *buffer;
+
+ /* Additional bytes for the Windows rd command. */
+ inputSize = strlen(dir) + sizeof(RM_COMMAND);
+ if ((buffer = malloc(inputSize)) == NULL)
+ testutil_die(ENOMEM, "Failed to allocate memory");
+
+ snprintf(buffer, inputSize, "%s%s", RM_COMMAND, dir);
+
+ exist = 0;
+ if ((ret = __wt_exist(NULL, dir, &exist)) != 0)
+ testutil_die(ret,
+ "Unable to check if directory exists");
+ if (exist == 1 && (ret = system(buffer)) != 0)
+ testutil_die(ret,
+ "System call to remove directory failed");
+ free(buffer);
+}
+
+/*
+ * testutil_make_work_dir --
+ * Delete the existing work directory if it exists, then create a new one.
+ */
+static inline void
+testutil_make_work_dir(char *dir)
+{
+ size_t inputSize;
+ int ret;
+ char *buffer;
+
+ testutil_clean_work_dir(dir);
+
+ /* Additional bytes for the mkdir command */
+ inputSize = strlen(dir) + sizeof(MKDIR_COMMAND);
+ if ((buffer = malloc(inputSize)) == NULL)
+ testutil_die(ENOMEM, "Failed to allocate memory");
+
+ /* mkdir shares syntax between Windows and Linux */
+ snprintf(buffer, inputSize, "%s%s", MKDIR_COMMAND, dir);
+ if ((ret = system(buffer)) != 0)
+ testutil_die(ret, "directory create call of '%s%s' failed",
+ MKDIR_COMMAND, dir);
+ free(buffer);
+}