diff options
author | Keith Bostic <keith.bostic@mongodb.com> | 2016-08-15 22:30:53 -0400 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2016-08-16 12:30:53 +1000 |
commit | 0e8a887c8c7281ab09c5c9d61a30defbdeb58bbf (patch) | |
tree | cbace0a3076eae4d88c1af1c7cd2c300319fb3da /src | |
parent | 8e3c4660dce3c4620aae65493241238d23e9a04a (diff) | |
download | mongo-0e8a887c8c7281ab09c5c9d61a30defbdeb58bbf.tar.gz |
WT-2822 panic mutex and other functions that cannot fail (#2952)
* The pthread mutex implementation of spinlocks lock/unlock functions didn't check the underlying pthread_mutex functions for failure. Panic if pthreads fails.
* Change condition mutex functions to not return errors.
* Change __wt_verbose() to not return errors.
* Make a final panic check before writing anything.
Diffstat (limited to 'src')
74 files changed, 703 insertions, 814 deletions
diff --git a/src/async/async_api.c b/src/async/async_api.c index 42fe4378d15..d55732abfb5 100644 --- a/src/async/async_api.c +++ b/src/async/async_api.c @@ -489,7 +489,6 @@ __wt_async_flush(WT_SESSION_IMPL *session) { WT_ASYNC *async; WT_CONNECTION_IMPL *conn; - WT_DECL_RET; uint32_t i, workers; conn = S2C(session); @@ -540,16 +539,15 @@ retry: (void)__wt_atomic_add64(&async->flush_gen, 1); WT_ASSERT(session, async->flush_op.state == WT_ASYNCOP_FREE); async->flush_op.state = WT_ASYNCOP_READY; - WT_ERR(__wt_async_op_enqueue(session, &async->flush_op)); + WT_RET(__wt_async_op_enqueue(session, &async->flush_op)); while (async->flush_state != WT_ASYNC_FLUSH_COMPLETE) - WT_ERR(__wt_cond_wait(NULL, async->flush_cond, 100000)); + __wt_cond_wait(NULL, async->flush_cond, 100000); /* * Flush is done. Clear the flags. */ async->flush_op.state = WT_ASYNCOP_FREE; WT_PUBLISH(async->flush_state, WT_ASYNC_FLUSH_NONE); -err: - return (ret); + return (0); } /* diff --git a/src/async/async_worker.c b/src/async/async_worker.c index 90dac557e36..cf83d797738 100644 --- a/src/async/async_worker.c +++ b/src/async/async_worker.c @@ -102,13 +102,12 @@ retry: * __async_flush_wait -- * Wait for the final worker to finish flushing. */ -static int +static void __async_flush_wait(WT_SESSION_IMPL *session, WT_ASYNC *async, uint64_t my_gen) { while (async->flush_state == WT_ASYNC_FLUSHING && async->flush_gen == my_gen) - WT_RET(__wt_cond_wait(session, async->flush_cond, 10000)); - return (0); + __wt_cond_wait(session, async->flush_cond, 10000); } /* @@ -326,15 +325,13 @@ __wt_async_worker(void *arg) */ WT_PUBLISH(async->flush_state, WT_ASYNC_FLUSH_COMPLETE); - WT_ERR(__wt_cond_signal(session, - async->flush_cond)); + __wt_cond_signal(session, async->flush_cond); } else /* * We need to wait for the last worker to * signal the condition. */ - WT_ERR(__async_flush_wait( - session, async, flush_gen)); + __async_flush_wait(session, async, flush_gen); } } diff --git a/src/block/block_ckpt.c b/src/block/block_ckpt.c index 6d827cf697d..1e7f4ff09ae 100644 --- a/src/block/block_ckpt.c +++ b/src/block/block_ckpt.c @@ -69,9 +69,9 @@ __wt_block_checkpoint_load(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ERR(__wt_scr_alloc(session, 0, &tmp)); WT_ERR(__ckpt_string(session, block, addr, tmp)); } - WT_ERR(__wt_verbose(session, WT_VERB_CHECKPOINT, + __wt_verbose(session, WT_VERB_CHECKPOINT, "%s: load-checkpoint: %s", block->name, - addr == NULL ? "[Empty]" : (const char *)tmp->data)); + addr == NULL ? "[Empty]" : (const char *)tmp->data); } #endif @@ -504,9 +504,9 @@ __ckpt_process(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_CKPT *ckptbase) WT_ERR(__wt_scr_alloc(session, 0, &tmp)); WT_ERR(__ckpt_string( session, block, ckpt->raw.data, tmp)); - WT_ERR(__wt_verbose(session, WT_VERB_CHECKPOINT, + __wt_verbose(session, WT_VERB_CHECKPOINT, "%s: delete-checkpoint: %s: %s", - block->name, ckpt->name, (const char *)tmp->data)); + block->name, ckpt->name, (const char *)tmp->data); } #endif /* @@ -742,9 +742,9 @@ __ckpt_update(WT_SESSION_IMPL *session, if (WT_VERBOSE_ISSET(session, WT_VERB_CHECKPOINT)) { WT_RET(__wt_scr_alloc(session, 0, &tmp)); WT_ERR(__ckpt_string(session, block, ckpt->raw.data, tmp)); - WT_ERR(__wt_verbose(session, WT_VERB_CHECKPOINT, + __wt_verbose(session, WT_VERB_CHECKPOINT, "%s: create-checkpoint: %s: %s", - block->name, ckpt->name, (const char *)tmp->data)); + block->name, ckpt->name, (const char *)tmp->data); } err: __wt_scr_free(session, &tmp); diff --git a/src/block/block_compact.c b/src/block/block_compact.c index 02862ea842f..a5e510445cc 100644 --- a/src/block/block_compact.c +++ b/src/block/block_compact.c @@ -8,7 +8,7 @@ #include "wt_internal.h" -static int __block_dump_avail(WT_SESSION_IMPL *, WT_BLOCK *, bool); +static void __block_dump_avail(WT_SESSION_IMPL *, WT_BLOCK *, bool); /* * __wt_block_compact_start -- @@ -32,8 +32,6 @@ __wt_block_compact_start(WT_SESSION_IMPL *session, WT_BLOCK *block) int __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block) { - WT_DECL_RET; - WT_UNUSED(session); /* Restore the original allocation plan. */ @@ -43,12 +41,11 @@ __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block) /* Dump the results of the compaction pass. */ if (WT_VERBOSE_ISSET(session, WT_VERB_COMPACT)) { __wt_spin_lock(session, &block->live_lock); - ret = __block_dump_avail(session, block, false); + __block_dump_avail(session, block, false); __wt_spin_unlock(session, &block->live_lock); } #endif - - return (ret); + return (0); } /* @@ -88,7 +85,7 @@ __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp) /* Dump the current state of the file. */ if (WT_VERBOSE_ISSET(session, WT_VERB_COMPACT)) - WT_ERR(__block_dump_avail(session, block, true)); + __block_dump_avail(session, block, true); /* Sum the available bytes in the initial 80% and 90% of the file. */ avail_eighty = avail_ninety = 0; @@ -125,25 +122,25 @@ __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp) block->compact_pct_tenths = 1; } - WT_ERR(__wt_verbose(session, WT_VERB_COMPACT, + __wt_verbose(session, WT_VERB_COMPACT, "%s: %" PRIuMAX "MB (%" PRIuMAX ") available space in the first " "80%% of the file", block->name, - (uintmax_t)avail_eighty / WT_MEGABYTE, (uintmax_t)avail_eighty)); - WT_ERR(__wt_verbose(session, WT_VERB_COMPACT, + (uintmax_t)avail_eighty / WT_MEGABYTE, (uintmax_t)avail_eighty); + __wt_verbose(session, WT_VERB_COMPACT, "%s: %" PRIuMAX "MB (%" PRIuMAX ") available space in the first " "90%% of the file", block->name, - (uintmax_t)avail_ninety / WT_MEGABYTE, (uintmax_t)avail_ninety)); - WT_ERR(__wt_verbose(session, WT_VERB_COMPACT, + (uintmax_t)avail_ninety / WT_MEGABYTE, (uintmax_t)avail_ninety); + __wt_verbose(session, WT_VERB_COMPACT, "%s: require 10%% or %" PRIuMAX "MB (%" PRIuMAX ") in the first " "90%% of the file to perform compaction, compaction %s", block->name, (uintmax_t)(block->size / 10) / WT_MEGABYTE, (uintmax_t)block->size / 10, - *skipp ? "skipped" : "proceeding")); + *skipp ? "skipped" : "proceeding"); -err: __wt_spin_unlock(session, &block->live_lock); + __wt_spin_unlock(session, &block->live_lock); return (ret); } @@ -207,7 +204,7 @@ __wt_block_compact_page_skip(WT_SESSION_IMPL *session, * __block_dump_avail -- * Dump out the avail list so we can see what compaction will look like. */ -static int +static void __block_dump_avail(WT_SESSION_IMPL *session, WT_BLOCK *block, bool start) { WT_EXTLIST *el; @@ -218,29 +215,28 @@ __block_dump_avail(WT_SESSION_IMPL *session, WT_BLOCK *block, bool start) el = &block->live.avail; size = block->size; - WT_RET(__wt_verbose(session, WT_VERB_COMPACT, + __wt_verbose(session, WT_VERB_COMPACT, "============ %s", - start ? "testing for compaction" : "ending compaction pass")); + start ? "testing for compaction" : "ending compaction pass"); if (!start) { - WT_RET(__wt_verbose(session, WT_VERB_COMPACT, - "pages reviewed: %" PRIuMAX, - block->compact_pages_reviewed)); - WT_RET(__wt_verbose(session, WT_VERB_COMPACT, - "pages skipped: %" PRIuMAX, block->compact_pages_skipped)); - WT_RET(__wt_verbose(session, WT_VERB_COMPACT, - "pages written: %" PRIuMAX, block->compact_pages_written)); + __wt_verbose(session, WT_VERB_COMPACT, + "pages reviewed: %" PRIuMAX, block->compact_pages_reviewed); + __wt_verbose(session, WT_VERB_COMPACT, + "pages skipped: %" PRIuMAX, block->compact_pages_skipped); + __wt_verbose(session, WT_VERB_COMPACT, + "pages written: %" PRIuMAX, block->compact_pages_written); } - WT_RET(__wt_verbose(session, WT_VERB_COMPACT, + __wt_verbose(session, WT_VERB_COMPACT, "file size %" PRIuMAX "MB (%" PRIuMAX ") with %" PRIuMAX "%% space available %" PRIuMAX "MB (%" PRIuMAX ")", (uintmax_t)size / WT_MEGABYTE, (uintmax_t)size, ((uintmax_t)el->bytes * 100) / (uintmax_t)size, - (uintmax_t)el->bytes / WT_MEGABYTE, (uintmax_t)el->bytes)); + (uintmax_t)el->bytes / WT_MEGABYTE, (uintmax_t)el->bytes); if (el->entries == 0) - return (0); + return; /* * Bucket the available memory into file deciles/percentiles. Large @@ -262,21 +258,19 @@ __block_dump_avail(WT_SESSION_IMPL *session, WT_BLOCK *block, bool start) */ for (i = 0; i < WT_ELEMENTS(percentile); ++i) { v = percentile[i] * 512; - WT_RET(__wt_verbose(session, WT_VERB_COMPACT, + __wt_verbose(session, WT_VERB_COMPACT, "%2u%%: %12" PRIuMAX "MB, (%" PRIuMAX "B, %" PRIuMAX "%%)", i, (uintmax_t)v / WT_MEGABYTE, (uintmax_t)v, - (uintmax_t)((v * 100) / (wt_off_t)el->bytes))); + (uintmax_t)((v * 100) / (wt_off_t)el->bytes)); } #endif for (i = 0; i < WT_ELEMENTS(decile); ++i) { v = decile[i] * 512; - WT_RET(__wt_verbose(session, WT_VERB_COMPACT, + __wt_verbose(session, WT_VERB_COMPACT, "%2u%%: %12" PRIuMAX "MB, (%" PRIuMAX "B, %" PRIuMAX "%%)", i * 10, (uintmax_t)v / WT_MEGABYTE, (uintmax_t)v, - (uintmax_t)((v * 100) / (wt_off_t)el->bytes))); + (uintmax_t)((v * 100) / (wt_off_t)el->bytes)); } - - return (0); } diff --git a/src/block/block_ext.c b/src/block/block_ext.c index 5e7616b8bcb..d618bf70010 100644 --- a/src/block/block_ext.c +++ b/src/block/block_ext.c @@ -486,9 +486,9 @@ __block_extend( block->size += size; WT_STAT_FAST_DATA_INCR(session, block_extension); - WT_RET(__wt_verbose(session, WT_VERB_BLOCK, + __wt_verbose(session, WT_VERB_BLOCK, "file extend %" PRIdMAX "B @ %" PRIdMAX, - (intmax_t)size, (intmax_t)*offp)); + (intmax_t)size, (intmax_t)*offp); return (0); } @@ -552,21 +552,21 @@ append: WT_RET(__block_extend(session, block, offp, size)); /* If doing a partial allocation, adjust the record and put it back. */ if (ext->size > size) { - WT_RET(__wt_verbose(session, WT_VERB_BLOCK, + __wt_verbose(session, WT_VERB_BLOCK, "allocate %" PRIdMAX " from range %" PRIdMAX "-%" PRIdMAX ", range shrinks to %" PRIdMAX "-%" PRIdMAX, (intmax_t)size, (intmax_t)ext->off, (intmax_t)(ext->off + ext->size), (intmax_t)(ext->off + size), - (intmax_t)(ext->off + size + ext->size - size))); + (intmax_t)(ext->off + size + ext->size - size)); ext->off += size; ext->size -= size; WT_RET(__block_ext_insert(session, &block->live.avail, ext)); } else { - WT_RET(__wt_verbose(session, WT_VERB_BLOCK, + __wt_verbose(session, WT_VERB_BLOCK, "allocate range %" PRIdMAX "-%" PRIdMAX, - (intmax_t)ext->off, (intmax_t)(ext->off + ext->size))); + (intmax_t)ext->off, (intmax_t)(ext->off + ext->size)); __wt_block_ext_free(session, ext); } @@ -595,8 +595,8 @@ __wt_block_free(WT_SESSION_IMPL *session, /* Crack the cookie. */ WT_RET(__wt_block_buffer_to_addr(block, addr, &offset, &size, &cksum)); - WT_RET(__wt_verbose(session, WT_VERB_BLOCK, - "free %" PRIdMAX "/%" PRIdMAX, (intmax_t)offset, (intmax_t)size)); + __wt_verbose(session, WT_VERB_BLOCK, + "free %" PRIdMAX "/%" PRIdMAX, (intmax_t)offset, (intmax_t)size); #ifdef HAVE_DIAGNOSTIC WT_RET( @@ -922,8 +922,8 @@ __wt_block_extlist_merge(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST tmp; u_int i; - WT_RET(__wt_verbose( - session, WT_VERB_BLOCK, "merging %s into %s", a->name, b->name)); + __wt_verbose( + session, WT_VERB_BLOCK, "merging %s into %s", a->name, b->name); /* * Sometimes the list we are merging is much bigger than the other: if @@ -1063,9 +1063,9 @@ __block_merge(WT_SESSION_IMPL *session, WT_BLOCK *block, after = NULL; } if (before == NULL && after == NULL) { - WT_RET(__wt_verbose(session, WT_VERB_BLOCK, + __wt_verbose(session, WT_VERB_BLOCK, "%s: insert range %" PRIdMAX "-%" PRIdMAX, - el->name, (intmax_t)off, (intmax_t)(off + size))); + el->name, (intmax_t)off, (intmax_t)(off + size)); return (__block_off_insert(session, el, off, size)); } @@ -1081,12 +1081,12 @@ __block_merge(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_RET(__block_off_remove( session, block, el, after->off, &ext)); - WT_RET(__wt_verbose(session, WT_VERB_BLOCK, + __wt_verbose(session, WT_VERB_BLOCK, "%s: range grows from %" PRIdMAX "-%" PRIdMAX ", to %" PRIdMAX "-%" PRIdMAX, el->name, (intmax_t)ext->off, (intmax_t)(ext->off + ext->size), - (intmax_t)off, (intmax_t)(off + ext->size + size))); + (intmax_t)off, (intmax_t)(off + ext->size + size)); ext->off = off; ext->size += size; @@ -1099,13 +1099,13 @@ __block_merge(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_RET(__block_off_remove( session, block, el, before->off, &ext)); - WT_RET(__wt_verbose(session, WT_VERB_BLOCK, + __wt_verbose(session, WT_VERB_BLOCK, "%s: range grows from %" PRIdMAX "-%" PRIdMAX ", to %" PRIdMAX "-%" PRIdMAX, el->name, (intmax_t)ext->off, (intmax_t)(ext->off + ext->size), (intmax_t)ext->off, - (intmax_t)(ext->off + ext->size + size))); + (intmax_t)(ext->off + ext->size + size)); ext->size += size; } @@ -1319,9 +1319,9 @@ __wt_block_extlist_write(WT_SESSION_IMPL *session, WT_TRET(__wt_block_off_remove_overlap( session, block, &block->live.alloc, el->offset, el->size)); - WT_ERR(__wt_verbose(session, WT_VERB_BLOCK, + __wt_verbose(session, WT_VERB_BLOCK, "%s written %" PRIdMAX "/%" PRIu32, - el->name, (intmax_t)el->offset, el->size)); + el->name, (intmax_t)el->offset, el->size); err: __wt_scr_free(session, &tmp); return (ret); @@ -1434,10 +1434,10 @@ __block_extlist_dump( tag, el->name, el->entries, __wt_buf_set_size(session, el->bytes, true, t1))); else - WT_ERR(__wt_verbose(session, WT_VERB_BLOCK, + __wt_verbose(session, WT_VERB_BLOCK, "%s extent list %s, %" PRIu32 " entries, %s bytes", tag, el->name, el->entries, - __wt_buf_set_size(session, el->bytes, true, t1))); + __wt_buf_set_size(session, el->bytes, true, t1)); if (el->entries == 0) goto done; @@ -1465,8 +1465,7 @@ __block_extlist_dump( if (block->verify_layout) WT_ERR(__wt_msg(session, "%s", (char *)t1->data)); else - WT_ERR(__wt_verbose( - session, WT_VERB_BLOCK, "%s", (char *)t1->data)); + __wt_verbose(session, WT_VERB_BLOCK, "%s", (char *)t1->data); done: err: __wt_scr_free(session, &t1); diff --git a/src/block/block_open.c b/src/block/block_open.c index 7cff7eab629..b975f1612cc 100644 --- a/src/block/block_open.c +++ b/src/block/block_open.c @@ -150,7 +150,7 @@ __wt_block_open(WT_SESSION_IMPL *session, uint64_t bucket, hash; uint32_t flags; - WT_RET(__wt_verbose(session, WT_VERB_BLOCK, "open: %s", filename)); + __wt_verbose(session, WT_VERB_BLOCK, "open: %s", filename); conn = S2C(session); *blockp = block = NULL; @@ -248,14 +248,14 @@ __wt_block_close(WT_SESSION_IMPL *session, WT_BLOCK *block) conn = S2C(session); - WT_TRET(__wt_verbose(session, WT_VERB_BLOCK, - "close: %s", block->name == NULL ? "" : block->name )); + __wt_verbose(session, WT_VERB_BLOCK, + "close: %s", block->name == NULL ? "" : block->name ); __wt_spin_lock(session, &conn->block_lock); /* Reference count is initialized to 1. */ if (block->ref == 0 || --block->ref == 0) - WT_TRET(__block_destroy(session, block)); + ret = __block_destroy(session, block); __wt_spin_unlock(session, &conn->block_lock); @@ -362,13 +362,13 @@ __desc_read(WT_SESSION_IMPL *session, WT_BLOCK *block) WT_BLOCK_MAJOR_VERSION, WT_BLOCK_MINOR_VERSION, desc->majorv, desc->minorv); - WT_ERR(__wt_verbose(session, WT_VERB_BLOCK, + __wt_verbose(session, WT_VERB_BLOCK, "%s: magic %" PRIu32 ", major/minor: %" PRIu32 "/%" PRIu32 ", checksum %#" PRIx32, block->name, desc->magic, desc->majorv, desc->minorv, - desc->cksum)); + desc->cksum); err: __wt_scr_free(session, &buf); return (ret); diff --git a/src/block/block_read.c b/src/block/block_read.c index 97157e4a0f1..6706800409c 100644 --- a/src/block/block_read.c +++ b/src/block/block_read.c @@ -156,9 +156,9 @@ __wt_block_read_off(WT_SESSION_IMPL *session, WT_BLOCK *block, size_t bufsize; uint32_t page_cksum; - WT_RET(__wt_verbose(session, WT_VERB_READ, + __wt_verbose(session, WT_VERB_READ, "off %" PRIuMAX ", size %" PRIu32 ", cksum %" PRIu32, - (uintmax_t)offset, size, cksum)); + (uintmax_t)offset, size, cksum); WT_STAT_FAST_CONN_INCR(session, block_read); WT_STAT_FAST_CONN_INCRV(session, block_byte_read, size); diff --git a/src/block/block_slvg.c b/src/block/block_slvg.c index ea04f994874..1bfc67f45e2 100644 --- a/src/block/block_slvg.c +++ b/src/block/block_slvg.c @@ -139,9 +139,9 @@ __wt_block_salvage_next(WT_SESSION_IMPL *session, break; /* Free the allocation-size block. */ - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "skipping %" PRIu32 "B at file offset %" PRIuMAX, - allocsize, (uintmax_t)offset)); + allocsize, (uintmax_t)offset); WT_ERR(__wt_block_off_free( session, block, offset, (wt_off_t)allocsize)); block->slvg_off += allocsize; diff --git a/src/block/block_vrfy.c b/src/block/block_vrfy.c index af58864b9dc..81b6059ab25 100644 --- a/src/block/block_vrfy.c +++ b/src/block/block_vrfy.c @@ -386,12 +386,12 @@ __verify_filefrag_add(WT_SESSION_IMPL *session, WT_BLOCK *block, { uint64_t f, frag, frags, i; - WT_RET(__wt_verbose(session, WT_VERB_VERIFY, + __wt_verbose(session, WT_VERB_VERIFY, "add file block%s%s%s at %" PRIuMAX "-%" PRIuMAX " (%" PRIuMAX ")", type == NULL ? "" : " (", type == NULL ? "" : type, type == NULL ? "" : ")", - (uintmax_t)offset, (uintmax_t)(offset + size), (uintmax_t)size)); + (uintmax_t)offset, (uintmax_t)(offset + size), (uintmax_t)size); /* Check each chunk against the total file size. */ if (offset + size > block->size) @@ -491,9 +491,9 @@ __verify_ckptfrag_add( { uint64_t f, frag, frags, i; - WT_RET(__wt_verbose(session, WT_VERB_VERIFY, + __wt_verbose(session, WT_VERB_VERIFY, "add checkpoint block at %" PRIuMAX "-%" PRIuMAX " (%" PRIuMAX ")", - (uintmax_t)offset, (uintmax_t)(offset + size), (uintmax_t)size)); + (uintmax_t)offset, (uintmax_t)(offset + size), (uintmax_t)size); /* * Check each chunk against the checkpoint's size, a checkpoint should diff --git a/src/block/block_write.c b/src/block/block_write.c index d8001704080..d926a8b7c2d 100644 --- a/src/block/block_write.c +++ b/src/block/block_write.c @@ -17,8 +17,8 @@ __wt_block_truncate(WT_SESSION_IMPL *session, WT_BLOCK *block, wt_off_t len) { WT_DECL_RET; - WT_RET(__wt_verbose(session, - WT_VERB_BLOCK, "truncate file to %" PRIuMAX, (uintmax_t)len)); + __wt_verbose(session, + WT_VERB_BLOCK, "truncate file to %" PRIuMAX, (uintmax_t)len); /* * Truncate requires serialization, we depend on our caller for that. @@ -363,9 +363,9 @@ __block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_STAT_FAST_CONN_INCRV( session, block_byte_write_checkpoint, align_size); - WT_RET(__wt_verbose(session, WT_VERB_WRITE, + __wt_verbose(session, WT_VERB_WRITE, "off %" PRIuMAX ", size %" PRIuMAX ", cksum %" PRIu32, - (uintmax_t)offset, (uintmax_t)align_size, cksum)); + (uintmax_t)offset, (uintmax_t)align_size, cksum); *offsetp = offset; *sizep = WT_STORE_SIZE(align_size); diff --git a/src/btree/bt_compact.c b/src/btree/bt_compact.c index 9cc56c56452..d52afbe4280 100644 --- a/src/btree/bt_compact.c +++ b/src/btree/bt_compact.c @@ -60,7 +60,7 @@ __compact_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp) */ if (mod->rec_result == WT_PM_REC_REPLACE || mod->rec_result == WT_PM_REC_MULTIBLOCK) - WT_RET(__wt_fair_lock(session, &page->page_lock)); + __wt_fair_lock(session, &page->page_lock); if (mod->rec_result == WT_PM_REC_REPLACE) ret = bm->compact_page_skip(bm, session, @@ -80,7 +80,7 @@ __compact_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp) if (mod->rec_result == WT_PM_REC_REPLACE || mod->rec_result == WT_PM_REC_MULTIBLOCK) - WT_TRET(__wt_fair_unlock(session, &page->page_lock)); + __wt_fair_unlock(session, &page->page_lock); return (ret); } diff --git a/src/btree/bt_curnext.c b/src/btree/bt_curnext.c index e1b097c22a5..c6955dd9ed6 100644 --- a/src/btree/bt_curnext.c +++ b/src/btree/bt_curnext.c @@ -665,7 +665,7 @@ __wt_btcur_next(WT_CURSOR_BTREE *cbt, bool truncating) if (page != NULL && (cbt->page_deleted_count > WT_BTREE_DELETE_THRESHOLD || (newpage && cbt->page_deleted_count > 0))) - WT_ERR(__wt_page_evict_soon(session, cbt->ref)); + __wt_page_evict_soon(session, cbt->ref); cbt->page_deleted_count = 0; WT_ERR(__wt_tree_walk(session, &cbt->ref, flags)); diff --git a/src/btree/bt_curprev.c b/src/btree/bt_curprev.c index e39dffa357f..79fd067ac7b 100644 --- a/src/btree/bt_curprev.c +++ b/src/btree/bt_curprev.c @@ -621,7 +621,7 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, bool truncating) if (page != NULL && (cbt->page_deleted_count > WT_BTREE_DELETE_THRESHOLD || (newpage && cbt->page_deleted_count > 0))) - WT_ERR(__wt_page_evict_soon(session, cbt->ref)); + __wt_page_evict_soon(session, cbt->ref); cbt->page_deleted_count = 0; WT_ERR(__wt_tree_walk(session, &cbt->ref, flags)); diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index cacf1369430..02580bca4a8 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -163,7 +163,7 @@ __wt_btree_close(WT_SESSION_IMPL *session) __wt_btree_huffman_close(session); /* Destroy locks. */ - WT_TRET(__wt_rwlock_destroy(session, &btree->ovfl_lock)); + __wt_rwlock_destroy(session, &btree->ovfl_lock); __wt_spin_destroy(session, &btree->flush_lock); /* Free allocated memory. */ @@ -212,8 +212,8 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt) maj_version = cval.val; WT_RET(__wt_config_gets(session, cfg, "version.minor", &cval)); min_version = cval.val; - WT_RET(__wt_verbose(session, WT_VERB_VERSION, - "%" PRIu64 ".%" PRIu64, maj_version, min_version)); + __wt_verbose(session, WT_VERB_VERSION, + "%" PRIu64 ".%" PRIu64, maj_version, min_version); } /* Get the file ID. */ diff --git a/src/btree/bt_ovfl.c b/src/btree/bt_ovfl.c index 1f080041a23..feb78df75e2 100644 --- a/src/btree/bt_ovfl.c +++ b/src/btree/bt_ovfl.c @@ -67,11 +67,11 @@ __wt_ovfl_read(WT_SESSION_IMPL *session, * Acquire the overflow lock, and retest the on-page cell's value inside * the lock. */ - WT_RET(__wt_readlock(session, S2BT(session)->ovfl_lock)); + __wt_readlock(session, S2BT(session)->ovfl_lock); ret = __wt_cell_type_raw(unpack->cell) == WT_CELL_VALUE_OVFL_RM ? __wt_ovfl_txnc_search(page, unpack->data, unpack->size, store) : __ovfl_read(session, unpack->data, unpack->size, store); - WT_TRET(__wt_readunlock(session, S2BT(session)->ovfl_lock)); + __wt_readunlock(session, S2BT(session)->ovfl_lock); return (ret); } @@ -231,7 +231,6 @@ __wt_ovfl_discard(WT_SESSION_IMPL *session, WT_CELL *cell) WT_BM *bm; WT_BTREE *btree; WT_CELL_UNPACK *unpack, _unpack; - WT_DECL_RET; btree = S2BT(session); bm = btree->bm; @@ -250,7 +249,7 @@ __wt_ovfl_discard(WT_SESSION_IMPL *session, WT_CELL *cell) * Acquire the overflow lock to avoid racing with a thread reading the * backing overflow blocks. */ - WT_RET(__wt_writelock(session, btree->ovfl_lock)); + __wt_writelock(session, btree->ovfl_lock); switch (unpack->raw) { case WT_CELL_KEY_OVFL: @@ -264,10 +263,8 @@ __wt_ovfl_discard(WT_SESSION_IMPL *session, WT_CELL *cell) WT_ILLEGAL_VALUE(session); } - WT_TRET(__wt_writeunlock(session, btree->ovfl_lock)); + __wt_writeunlock(session, btree->ovfl_lock); /* Free the backing disk blocks. */ - WT_TRET(bm->free(bm, session, unpack->data, unpack->size)); - - return (ret); + return (bm->free(bm, session, unpack->data, unpack->size)); } diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index f052ba77b6f..c1485d26192 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -323,7 +323,7 @@ __evict_force_check(WT_SESSION_IMPL *session, WT_REF *ref) return (__wt_leaf_page_can_split(session, page)); /* Trigger eviction on the next page release. */ - WT_IGNORE_RET(__wt_page_evict_soon(session, ref)); + __wt_page_evict_soon(session, ref); /* Bump the oldest ID, we're about to do some visibility checks. */ WT_IGNORE_RET(__wt_txn_update_oldest(session, 0)); @@ -599,14 +599,7 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags page = ref->page; if (page->read_gen == WT_READGEN_NOTSET) { if (evict_soon) - /* - * Ignore error returns, since the - * evict soon call is advisory and we - * are holding a hazard pointer to the - * page already. - */ - WT_IGNORE_RET( - __wt_page_evict_soon(session, ref)); + __wt_page_evict_soon(session, ref); else __wt_cache_read_gen_new(session, page); } else if (!LF_ISSET(WT_READ_NO_GEN)) diff --git a/src/btree/bt_rebalance.c b/src/btree/bt_rebalance.c index de54e8433a8..29380459b94 100644 --- a/src/btree/bt_rebalance.c +++ b/src/btree/bt_rebalance.c @@ -65,10 +65,10 @@ __rebalance_leaf_append(WT_SESSION_IMPL *session, WT_ADDR *copy_addr; WT_REF *copy; - WT_RET(__wt_verbose(session, WT_VERB_REBALANCE, + __wt_verbose(session, WT_VERB_REBALANCE, "rebalance leaf-list append %s, %s", __wt_buf_set_printable(session, key, key_len, rs->tmp2), - __wt_addr_string(session, addr, addr_len, rs->tmp1))); + __wt_addr_string(session, addr, addr_len, rs->tmp1)); /* Allocate and initialize a new leaf page reference. */ WT_RET(__wt_realloc_def( @@ -179,10 +179,10 @@ __rebalance_free_original(WT_SESSION_IMPL *session, WT_REBALANCE_STUFF *rs) for (i = 0; i < rs->fl_next; ++i) { addr = &rs->fl[i]; - WT_RET(__wt_verbose(session, WT_VERB_REBALANCE, + __wt_verbose(session, WT_VERB_REBALANCE, "rebalance discarding %s", __wt_addr_string( - session, addr->addr, addr->size, rs->tmp1))); + session, addr->addr, addr->size, rs->tmp1)); WT_RET(__wt_btree_block_free(session, addr->addr, addr->size)); } @@ -225,10 +225,10 @@ __rebalance_col_walk( WT_ERR(__wt_bt_read( session, buf, unpack.data, unpack.size)); WT_ERR(__rebalance_col_walk(session, buf->data, rs)); - WT_ERR(__wt_verbose(session, WT_VERB_REBALANCE, + __wt_verbose(session, WT_VERB_REBALANCE, "free-list append internal page: %s", __wt_addr_string( - session, unpack.data, unpack.size, rs->tmp1))); + session, unpack.data, unpack.size, rs->tmp1)); WT_ERR(__rebalance_fl_append( session, unpack.data, unpack.size, rs)); break; @@ -321,10 +321,10 @@ __rebalance_row_walk( * that's more work to get reconciliation to understand * and overflow keys are (well, should be), uncommon. */ - WT_ERR(__wt_verbose(session, WT_VERB_REBALANCE, + __wt_verbose(session, WT_VERB_REBALANCE, "free-list append overflow key: %s", __wt_addr_string( - session, unpack.data, unpack.size, rs->tmp1))); + session, unpack.data, unpack.size, rs->tmp1)); WT_ERR(__rebalance_fl_append( session, unpack.data, unpack.size, rs)); @@ -342,10 +342,10 @@ __rebalance_row_walk( break; case WT_CELL_ADDR_INT: /* An internal page, schedule its blocks to be freed. */ - WT_ERR(__wt_verbose(session, WT_VERB_REBALANCE, + __wt_verbose(session, WT_VERB_REBALANCE, "free-list append internal page: %s", __wt_addr_string( - session, unpack.data, unpack.size, rs->tmp1))); + session, unpack.data, unpack.size, rs->tmp1)); WT_ERR(__rebalance_fl_append( session, unpack.data, unpack.size, rs)); diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c index 9b5e4daf74a..831e58b91bd 100644 --- a/src/btree/bt_slvg.c +++ b/src/btree/bt_slvg.c @@ -431,10 +431,10 @@ __slvg_read(WT_SESSION_IMPL *session, WT_STUFF *ss) case WT_PAGE_BLOCK_MANAGER: case WT_PAGE_COL_INT: case WT_PAGE_ROW_INT: - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s page ignored %s", __wt_page_type_string(dsk->type), - (const char *)as->data)); + (const char *)as->data); WT_ERR(bm->free(bm, session, addr, addr_size)); continue; } @@ -449,18 +449,18 @@ __slvg_read(WT_SESSION_IMPL *session, WT_STUFF *ss) * discard these pages now. */ if (__wt_verify_dsk(session, as->data, buf) != 0) { - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s page failed verify %s", __wt_page_type_string(dsk->type), - (const char *)as->data)); + (const char *)as->data); WT_ERR(bm->free(bm, session, addr, addr_size)); continue; } - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "tracking %s page, generation %" PRIu64 " %s", __wt_page_type_string(dsk->type), dsk->write_gen, - (const char *)as->data)); + (const char *)as->data); switch (dsk->type) { case WT_PAGE_COL_FIX: @@ -562,11 +562,11 @@ __slvg_trk_leaf(WT_SESSION_IMPL *session, trk->col_start = dsk->recno; trk->col_stop = dsk->recno + (dsk->u.entries - 1); - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s records %" PRIu64 "-%" PRIu64, __wt_addr_string( session, trk->trk_addr, trk->trk_addr_size, ss->tmp1), - trk->col_start, trk->col_stop)); + trk->col_start, trk->col_stop); break; case WT_PAGE_COL_VAR: /* @@ -583,11 +583,11 @@ __slvg_trk_leaf(WT_SESSION_IMPL *session, trk->col_start = dsk->recno; trk->col_stop = stop_recno - 1; - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s records %" PRIu64 "-%" PRIu64, __wt_addr_string( session, trk->trk_addr, trk->trk_addr_size, ss->tmp1), - trk->col_start, trk->col_stop)); + trk->col_start, trk->col_stop); /* Column-store pages can contain overflow items. */ WT_ERR(__slvg_trk_leaf_ovfl(session, dsk, trk)); @@ -607,18 +607,18 @@ __slvg_trk_leaf(WT_SESSION_IMPL *session, WT_ERR(__wt_row_leaf_key_copy(session, page, &page->pg_row_d[page->pg_row_entries - 1], &trk->row_stop)); - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s start key %s", __wt_addr_string(session, trk->trk_addr, trk->trk_addr_size, ss->tmp1), __wt_buf_set_printable(session, - trk->row_start.data, trk->row_start.size, ss->tmp2))); - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + trk->row_start.data, trk->row_start.size, ss->tmp2)); + __wt_verbose(session, WT_VERB_SALVAGE, "%s stop key %s", __wt_addr_string(session, trk->trk_addr, trk->trk_addr_size, ss->tmp1), __wt_buf_set_printable(session, - trk->row_stop.data, trk->row_stop.size, ss->tmp2))); + trk->row_stop.data, trk->row_stop.size, ss->tmp2)); /* Row-store pages can contain overflow items. */ WT_ERR(__slvg_trk_leaf_ovfl(session, dsk, trk)); @@ -700,12 +700,12 @@ __slvg_trk_leaf_ovfl( trk->trk_ovfl_addr[ovfl_cnt].size = (uint8_t)unpack->size; - WT_RET(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s overflow reference %s", __wt_addr_string(session, trk->trk_addr, trk->trk_addr_size, trk->ss->tmp1), __wt_addr_string(session, - unpack->data, unpack->size, trk->ss->tmp2))); + unpack->data, unpack->size, trk->ss->tmp2)); if (++ovfl_cnt == trk->trk_ovfl_cnt) break; @@ -871,12 +871,12 @@ __slvg_col_range_overlap( a_trk = ss->pages[a_slot]; b_trk = ss->pages[b_slot]; - WT_RET(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s and %s range overlap", __wt_addr_string( session, a_trk->trk_addr, a_trk->trk_addr_size, ss->tmp1), __wt_addr_string( - session, b_trk->trk_addr, b_trk->trk_addr_size, ss->tmp2))); + session, b_trk->trk_addr, b_trk->trk_addr_size, ss->tmp2)); /* * The key ranges of two WT_TRACK pages in the array overlap -- choose @@ -1053,12 +1053,12 @@ delete_b: /* F_SET(new, WT_TRACK_MERGE); F_SET(a_trk, WT_TRACK_MERGE); -merge: WT_RET(__wt_verbose(session, WT_VERB_SALVAGE, +merge: __wt_verbose(session, WT_VERB_SALVAGE, "%s and %s require merge", __wt_addr_string( session, a_trk->trk_addr, a_trk->trk_addr_size, ss->tmp1), __wt_addr_string( - session, b_trk->trk_addr, b_trk->trk_addr_size, ss->tmp2))); + session, b_trk->trk_addr, b_trk->trk_addr_size, ss->tmp2)); return (0); } @@ -1118,12 +1118,12 @@ __slvg_col_range_missing(WT_SESSION_IMPL *session, WT_STUFF *ss) if ((trk = ss->pages[i]) == NULL) continue; if (trk->col_start != r + 1) { - WT_RET(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s column-store missing range from %" PRIu64 " to %" PRIu64 " inclusive", __wt_addr_string(session, trk->trk_addr, trk->trk_addr_size, ss->tmp1), - r + 1, trk->col_start - 1)); + r + 1, trk->col_start - 1); /* * We need to instantiate deleted items for the missing @@ -1259,12 +1259,12 @@ __slvg_col_build_leaf(WT_SESSION_IMPL *session, WT_TRACK *trk, WT_REF *ref) cookie->skip = skip = trk->col_start - recno; cookie->take = take = (trk->col_stop - trk->col_start) + 1; - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s merge discarding first %" PRIu64 " records, " "then taking %" PRIu64 " records", __wt_addr_string( session, trk->trk_addr, trk->trk_addr_size, trk->ss->tmp1), - skip, take)); + skip, take); /* Set the referenced flag on overflow pages we're using. */ if (page->type == WT_PAGE_COL_VAR && trk->trk_ovfl_cnt != 0) @@ -1281,11 +1281,11 @@ __slvg_col_build_leaf(WT_SESSION_IMPL *session, WT_TRACK *trk, WT_REF *ref) ref->ref_recno = trk->col_missing; cookie->missing = trk->col_start - trk->col_missing; - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s merge inserting %" PRIu64 " missing records", __wt_addr_string( session, trk->trk_addr, trk->trk_addr_size, trk->ss->tmp1), - cookie->missing)); + cookie->missing); } /* @@ -1501,12 +1501,12 @@ __slvg_row_range_overlap( a_trk = ss->pages[a_slot]; b_trk = ss->pages[b_slot]; - WT_RET(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s and %s range overlap", __wt_addr_string( session, a_trk->trk_addr, a_trk->trk_addr_size, ss->tmp1), __wt_addr_string( - session, b_trk->trk_addr, b_trk->trk_addr_size, ss->tmp2))); + session, b_trk->trk_addr, b_trk->trk_addr_size, ss->tmp2)); /* * The key ranges of two WT_TRACK pages in the array overlap -- choose @@ -1698,12 +1698,12 @@ delete_b: /* F_SET(new, WT_TRACK_MERGE); F_SET(a_trk, WT_TRACK_MERGE); -merge: WT_RET(__wt_verbose(session, WT_VERB_SALVAGE, +merge: __wt_verbose(session, WT_VERB_SALVAGE, "%s and %s require merge", __wt_addr_string( session, a_trk->trk_addr, a_trk->trk_addr_size, ss->tmp1), __wt_addr_string( - session, b_trk->trk_addr, b_trk->trk_addr_size, ss->tmp2))); + session, b_trk->trk_addr, b_trk->trk_addr_size, ss->tmp2)); return (0); } @@ -1942,12 +1942,12 @@ __slvg_row_build_leaf( btree->collator, key, &trk->row_start, &cmp)); if (cmp >= 0) break; - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s merge discarding leading key %.*s", __wt_addr_string(session, trk->trk_addr, trk->trk_addr_size, ss->tmp1), __wt_buf_set_printable( - session, key->data, key->size, ss->tmp2))); + session, key->data, key->size, ss->tmp2)); ++skip_start; } if (F_ISSET(trk, WT_TRACK_CHECK_STOP)) @@ -1962,12 +1962,12 @@ __slvg_row_build_leaf( btree->collator, key, &trk->row_stop, &cmp)); if (cmp < 0) break; - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s merge discarding trailing key %.*s", __wt_addr_string(session, trk->trk_addr, trk->trk_addr_size, ss->tmp1), __wt_buf_set_printable( - session, key->data, key->size, ss->tmp2))); + session, key->data, key->size, ss->tmp2)); ++skip_stop; } @@ -2204,12 +2204,12 @@ __slvg_ovfl_reconcile(WT_SESSION_IMPL *session, WT_STUFF *ss) continue; } - WT_ERR(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s references unavailable overflow page %s", __wt_addr_string(session, trk->trk_addr, trk->trk_addr_size, ss->tmp1), __wt_addr_string(session, - addr->addr, addr->size, ss->tmp2))); + addr->addr, addr->size, ss->tmp2)); /* * Clear the "referenced" flag for any overflow pages @@ -2405,10 +2405,10 @@ __slvg_ovfl_discard(WT_SESSION_IMPL *session, WT_STUFF *ss) F_CLR(trk, WT_TRACK_OVFL_REFD); continue; } - WT_RET(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s unused overflow page", __wt_addr_string( - session, trk->trk_addr, trk->trk_addr_size, ss->tmp1))); + session, trk->trk_addr, trk->trk_addr_size, ss->tmp1)); WT_RET(__slvg_trk_free(session, &ss->ovfl[i], true)); } @@ -2470,10 +2470,10 @@ __slvg_trk_free_block(WT_SESSION_IMPL *session, WT_TRACK *trk) * If freeing underlying file blocks or overflow pages, this is a page * we were tracking but eventually decided not to use. */ - WT_RET(__wt_verbose(session, WT_VERB_SALVAGE, + __wt_verbose(session, WT_VERB_SALVAGE, "%s blocks discarded: discard freed file bytes %" PRIu32, __wt_addr_string(session, - trk->trk_addr, trk->trk_addr_size, trk->ss->tmp1), trk->trk_size)); + trk->trk_addr, trk->trk_addr_size, trk->ss->tmp1), trk->trk_size); return (bm->free(bm, session, trk->trk_addr, trk->trk_addr_size)); } diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index 4f6f300802e..5b15a1224ea 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -577,10 +577,10 @@ __split_root(WT_SESSION_IMPL *session, WT_PAGE *root) chunk = pindex->entries / children; remain = pindex->entries - chunk * (children - 1); - WT_ERR(__wt_verbose(session, WT_VERB_SPLIT, + __wt_verbose(session, WT_VERB_SPLIT, "%p: %" PRIu32 " root page elements, splitting into %" PRIu32 " children", - root, pindex->entries, children)); + root, pindex->entries, children); /* * Allocate a new WT_PAGE_INDEX and set of WT_REF objects to be inserted @@ -795,7 +795,7 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, WT_REF **ref_new, if (result_entries == 0) { empty_parent = true; if (!__wt_ref_is_root(parent->pg_intl_parent_ref)) - ret = __wt_page_evict_soon( + __wt_page_evict_soon( session, parent->pg_intl_parent_ref); goto err; } @@ -888,17 +888,17 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, WT_REF **ref_new, */ if (ref->page == NULL) - WT_ERR(__wt_verbose(session, WT_VERB_SPLIT, + __wt_verbose(session, WT_VERB_SPLIT, "%p: reverse split into parent %p, %" PRIu32 " -> %" PRIu32 " (-%" PRIu32 ")", ref->page, parent, parent_entries, result_entries, - parent_entries - result_entries)); + parent_entries - result_entries); else - WT_ERR(__wt_verbose(session, WT_VERB_SPLIT, + __wt_verbose(session, WT_VERB_SPLIT, "%p: split into parent %p, %" PRIu32 " -> %" PRIu32 " (+%" PRIu32 ")", ref->page, parent, parent_entries, result_entries, - result_entries - parent_entries)); + result_entries - parent_entries); /* * The new page index is in place, free the WT_REF we were splitting and @@ -1060,10 +1060,10 @@ __split_internal(WT_SESSION_IMPL *session, WT_PAGE *parent, WT_PAGE *page) chunk = pindex->entries / children; remain = pindex->entries - chunk * (children - 1); - WT_ERR(__wt_verbose(session, WT_VERB_SPLIT, + __wt_verbose(session, WT_VERB_SPLIT, "%p: %" PRIu32 " internal page elements, splitting %" PRIu32 " children into parent %p", - page, pindex->entries, children, parent)); + page, pindex->entries, children, parent); /* * Ideally, we'd discard the original page, but that's hard since other @@ -1289,10 +1289,10 @@ __split_internal_lock(WT_SESSION_IMPL *session, WT_REF *ref, bool trylock, if (trylock) WT_RET(__wt_fair_trylock(session, &parent->page_lock)); else - WT_RET(__wt_fair_lock(session, &parent->page_lock)); + __wt_fair_lock(session, &parent->page_lock); if (parent == ref->home) break; - WT_RET(__wt_fair_unlock(session, &parent->page_lock)); + __wt_fair_unlock(session, &parent->page_lock); } /* @@ -1315,7 +1315,7 @@ __split_internal_lock(WT_SESSION_IMPL *session, WT_REF *ref, bool trylock, *parentp = parent; return (0); -err: WT_TRET(__wt_fair_unlock(session, &parent->page_lock)); +err: __wt_fair_unlock(session, &parent->page_lock); return (ret); } @@ -1331,7 +1331,7 @@ __split_internal_unlock(WT_SESSION_IMPL *session, WT_PAGE *parent, bool hazard) if (hazard) ret = __wt_hazard_clear(session, parent); - WT_TRET(__wt_fair_unlock(session, &parent->page_lock)); + __wt_fair_unlock(session, &parent->page_lock); return (ret); } @@ -2077,8 +2077,7 @@ __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref) WT_PAGE *parent; bool hazard; - WT_RET(__wt_verbose( - session, WT_VERB_SPLIT, "%p: split-insert", ref->page)); + __wt_verbose(session, WT_VERB_SPLIT, "%p: split-insert", ref->page); WT_RET(__split_internal_lock(session, ref, true, &parent, &hazard)); if ((ret = __split_insert(session, ref)) != 0) { @@ -2169,8 +2168,7 @@ __wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, int closing) WT_PAGE *parent; bool hazard; - WT_RET(__wt_verbose( - session, WT_VERB_SPLIT, "%p: split-multi", ref->page)); + __wt_verbose(session, WT_VERB_SPLIT, "%p: split-multi", ref->page); WT_RET(__split_internal_lock(session, ref, false, &parent, &hazard)); if ((ret = __split_multi(session, ref, closing)) != 0 || closing) { @@ -2198,8 +2196,7 @@ __wt_split_reverse(WT_SESSION_IMPL *session, WT_REF *ref) WT_PAGE *parent; bool hazard; - WT_RET(__wt_verbose( - session, WT_VERB_SPLIT, "%p: reverse-split", ref->page)); + __wt_verbose(session, WT_VERB_SPLIT, "%p: reverse-split", ref->page); WT_RET(__split_internal_lock(session, ref, false, &parent, &hazard)); ret = __split_parent(session, ref, NULL, 0, 0, false, true); @@ -2220,8 +2217,7 @@ __wt_split_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, WT_MULTI *multi) page = ref->page; - WT_RET(__wt_verbose( - session, WT_VERB_SPLIT, "%p: split-rewrite", ref->page)); + __wt_verbose(session, WT_VERB_SPLIT, "%p: split-rewrite", ref->page); /* * This isn't a split: a reconciliation failed because we couldn't write diff --git a/src/btree/bt_sync.c b/src/btree/bt_sync.c index df794c96cda..b41179a565d 100644 --- a/src/btree/bt_sync.c +++ b/src/btree/bt_sync.c @@ -206,7 +206,7 @@ __sync_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop) if (WT_VERBOSE_ISSET(session, WT_VERB_CHECKPOINT)) { WT_ERR(__wt_epoch(session, &end)); - WT_ERR(__wt_verbose(session, WT_VERB_CHECKPOINT, + __wt_verbose(session, WT_VERB_CHECKPOINT, "__sync_file WT_SYNC_%s wrote:\n\t %" PRIu64 " bytes, %" PRIu64 " pages of leaves\n\t %" PRIu64 " bytes, %" PRIu64 " pages of internal\n\t" @@ -214,7 +214,7 @@ __sync_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop) syncop == WT_SYNC_WRITE_LEAVES ? "WRITE_LEAVES" : "CHECKPOINT", leaf_bytes, leaf_pages, internal_bytes, internal_pages, - WT_TIMEDIFF_MS(end, start))); + WT_TIMEDIFF_MS(end, start)); } err: /* On error, clear any left-over tree walk. */ diff --git a/src/btree/bt_vrfy.c b/src/btree/bt_vrfy.c index 0a04c387a0f..76817cef7cd 100644 --- a/src/btree/bt_vrfy.c +++ b/src/btree/bt_vrfy.c @@ -195,8 +195,8 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]) /* Loop through the file's checkpoints, verifying each one. */ WT_CKPT_FOREACH(ckptbase, ckpt) { - WT_ERR(__wt_verbose(session, WT_VERB_VERIFY, - "%s: checkpoint %s", btree->dhandle->name, ckpt->name)); + __wt_verbose(session, WT_VERB_VERIFY, + "%s: checkpoint %s", btree->dhandle->name, ckpt->name); /* Fake checkpoints require no work. */ if (F_ISSET(ckpt, WT_CKPT_FAKE)) @@ -312,9 +312,9 @@ __verify_tree(WT_SESSION_IMPL *session, WT_REF *ref, WT_VSTUFF *vs) unpack = &_unpack; WT_CLEAR(*unpack); /* -Wuninitialized */ - WT_RET(__wt_verbose(session, WT_VERB_VERIFY, "%s %s", + __wt_verbose(session, WT_VERB_VERIFY, "%s %s", __wt_page_addr_string(session, ref, vs->tmp1), - __wt_page_type_string(page->type))); + __wt_page_type_string(page->type)); /* Optionally dump the address. */ if (vs->dump_address) diff --git a/src/btree/bt_walk.c b/src/btree/bt_walk.c index 17d32d6ed63..dc1cf4e7f98 100644 --- a/src/btree/bt_walk.c +++ b/src/btree/bt_walk.c @@ -399,7 +399,7 @@ restart: /* * eviction. */ if (empty_internal && pindex->entries > 1) { - WT_ERR(__wt_page_evict_soon(session, ref)); + __wt_page_evict_soon(session, ref); empty_internal = false; } diff --git a/src/btree/row_key.c b/src/btree/row_key.c index 83fd2dad9e4..99ee34a6c5d 100644 --- a/src/btree/row_key.c +++ b/src/btree/row_key.c @@ -282,8 +282,7 @@ switch_and_jump: /* Switching to a forward roll. */ * the tracking cache. */ if (slot_offset == 0) { - WT_ERR( - __wt_readlock(session, btree->ovfl_lock)); + __wt_readlock(session, btree->ovfl_lock); copy = WT_ROW_KEY_COPY(rip); if (!__wt_row_leaf_key_info(page, copy, NULL, &cell, &keyb->data, &keyb->size)) { @@ -291,8 +290,7 @@ switch_and_jump: /* Switching to a forward roll. */ ret = __wt_dsk_cell_data_ref(session, WT_PAGE_ROW_LEAF, unpack, keyb); } - WT_TRET( - __wt_readunlock(session, btree->ovfl_lock)); + __wt_readunlock(session, btree->ovfl_lock); WT_ERR(ret); break; } diff --git a/src/btree/row_srch.c b/src/btree/row_srch.c index 0f70e84de7e..d4e82c458d4 100644 --- a/src/btree/row_srch.c +++ b/src/btree/row_srch.c @@ -775,7 +775,7 @@ __wt_row_random_leaf(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt) * traversing the skip list each time accumulates to real time. */ if (samples > 5000) - WT_RET(__wt_page_evict_soon(session, cbt->ref)); + __wt_page_evict_soon(session, cbt->ref); return (0); } diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index 1c6b0c2b500..44fcd56c0d5 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -2270,8 +2270,7 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, conn->page_size = __wt_get_vm_pagesize(); /* Now that we know if verbose is configured, output the version. */ - WT_ERR(__wt_verbose( - session, WT_VERB_VERSION, "%s", WIREDTIGER_VERSION_STRING)); + __wt_verbose(session, WT_VERB_VERSION, "%s", WIREDTIGER_VERSION_STRING); /* * Open the connection, then reset the local session as the real one diff --git a/src/conn/conn_cache_pool.c b/src/conn/conn_cache_pool.c index 75ecb6b3b4a..15517f37b6a 100644 --- a/src/conn/conn_cache_pool.c +++ b/src/conn/conn_cache_pool.c @@ -108,8 +108,8 @@ __wt_cache_pool_config(WT_SESSION_IMPL *session, const char **cfg) "cache pool server", false, &cp->cache_pool_cond)); __wt_process.cache_pool = cp; - WT_ERR(__wt_verbose(session, - WT_VERB_SHARED_CACHE, "Created cache pool %s", cp->name)); + __wt_verbose(session, + WT_VERB_SHARED_CACHE, "Created cache pool %s", cp->name); } else if (!updating && strcmp(__wt_process.cache_pool->name, pool_name) != 0) /* Only a single cache pool is supported. */ @@ -212,12 +212,12 @@ __wt_cache_pool_config(WT_SESSION_IMPL *session, const char **cfg) /* Wake up the cache pool server so any changes are noticed. */ if (updating) - WT_ERR(__wt_cond_signal( - session, __wt_process.cache_pool->cache_pool_cond)); + __wt_cond_signal( + session, __wt_process.cache_pool->cache_pool_cond); - WT_ERR(__wt_verbose(session, WT_VERB_SHARED_CACHE, + __wt_verbose(session, WT_VERB_SHARED_CACHE, "Configured cache pool %s. Size: %" PRIu64 - ", chunk size: %" PRIu64, cp->name, cp->size, cp->chunk)); + ", chunk size: %" PRIu64, cp->name, cp->size, cp->chunk); F_SET(conn, WT_CONN_CACHE_POOL); err: __wt_spin_unlock(session, &__wt_process.spinlock); @@ -267,8 +267,8 @@ __wt_conn_cache_pool_open(WT_SESSION_IMPL *session) TAILQ_INSERT_TAIL(&cp->cache_pool_qh, conn, cpq); __wt_spin_unlock(session, &cp->cache_pool_lock); - WT_RET(__wt_verbose(session, WT_VERB_SHARED_CACHE, - "Added %s to cache pool %s", conn->home, cp->name)); + __wt_verbose(session, WT_VERB_SHARED_CACHE, + "Added %s to cache pool %s", conn->home, cp->name); /* * Each connection participating in the cache pool starts a manager @@ -282,7 +282,7 @@ __wt_conn_cache_pool_open(WT_SESSION_IMPL *session) __wt_cache_pool_server, cache->cp_session)); /* Wake up the cache pool server to get our initial chunk. */ - WT_RET(__wt_cond_signal(session, cp->cache_pool_cond)); + __wt_cond_signal(session, cp->cache_pool_cond); return (0); } @@ -324,8 +324,8 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session) * queue. We did increment the reference count, so proceed regardless. */ if (found) { - WT_TRET(__wt_verbose(session, WT_VERB_SHARED_CACHE, - "Removing %s from cache pool", entry->home)); + __wt_verbose(session, WT_VERB_SHARED_CACHE, + "Removing %s from cache pool", entry->home); TAILQ_REMOVE(&cp->cache_pool_qh, entry, cpq); /* Give the connection's resources back to the pool. */ @@ -341,7 +341,7 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session) cp_locked = false; F_CLR(cache, WT_CACHE_POOL_RUN); - WT_TRET(__wt_cond_signal(session, cp->cache_pool_cond)); + __wt_cond_signal(session, cp->cache_pool_cond); WT_TRET(__wt_thread_join(session, cache->cp_tid)); wt_session = &cache->cp_session->iface; @@ -372,8 +372,8 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session) } if (!F_ISSET(cp, WT_CACHE_POOL_ACTIVE)) { - WT_TRET(__wt_verbose( - session, WT_VERB_SHARED_CACHE, "Destroying cache pool")); + __wt_verbose( + session, WT_VERB_SHARED_CACHE, "Destroying cache pool"); __wt_spin_lock(session, &__wt_process.spinlock); /* * We have been holding the pool lock - no connections could @@ -401,8 +401,8 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session) /* Notify other participants if we were managing */ if (F_ISSET(cache, WT_CACHE_POOL_MANAGER)) { cp->pool_managed = 0; - WT_TRET(__wt_verbose(session, WT_VERB_SHARED_CACHE, - "Shutting down shared cache manager connection")); + __wt_verbose(session, WT_VERB_SHARED_CACHE, + "Shutting down shared cache manager connection"); } } @@ -538,14 +538,14 @@ __cache_pool_assess(WT_SESSION_IMPL *session, uint64_t *phighest) if (cache->cp_pass_pressure > highest) highest = cache->cp_pass_pressure; - WT_RET(__wt_verbose(session, WT_VERB_SHARED_CACHE, + __wt_verbose(session, WT_VERB_SHARED_CACHE, "Assess entry. reads: %" PRIu64 ", app evicts: %" PRIu64 ", app waits: %" PRIu64 ", pressure: %" PRIu64, - reads, app_evicts, app_waits, cache->cp_pass_pressure)); + reads, app_evicts, app_waits, cache->cp_pass_pressure); } - WT_RET(__wt_verbose(session, WT_VERB_SHARED_CACHE, + __wt_verbose(session, WT_VERB_SHARED_CACHE, "Highest eviction count: %" PRIu64 ", entries: %" PRIu64, - highest, entries)); + highest, entries); *phighest = highest; return (0); @@ -577,10 +577,10 @@ __cache_pool_adjust(WT_SESSION_IMPL *session, highest_percentile = (highest / 100) + 1; if (WT_VERBOSE_ISSET(session, WT_VERB_SHARED_CACHE)) { - WT_RET(__wt_verbose(session, - WT_VERB_SHARED_CACHE, "Cache pool distribution: ")); - WT_RET(__wt_verbose(session, WT_VERB_SHARED_CACHE, - "\t" "cache (MB), pressure, skips, busy, %% full:")); + __wt_verbose(session, + WT_VERB_SHARED_CACHE, "Cache pool distribution: "); + __wt_verbose(session, WT_VERB_SHARED_CACHE, + "\t" "cache (MB), pressure, skips, busy, %% full:"); } for (entry = forward ? TAILQ_FIRST(&cp->cache_pool_qh) : @@ -602,10 +602,10 @@ __cache_pool_adjust(WT_SESSION_IMPL *session, pressure = cache->cp_pass_pressure / highest_percentile; busy = __wt_eviction_needed(entry->default_session, &pct_full); - WT_RET(__wt_verbose(session, WT_VERB_SHARED_CACHE, + __wt_verbose(session, WT_VERB_SHARED_CACHE, "\t%5" PRIu64 ", %3" PRIu64 ", %2" PRIu32 ", %d, %2u", entry->cache_size >> 20, pressure, cache->cp_skip_count, - busy, pct_full)); + busy, pct_full); /* Allow to stabilize after changes. */ if (cache->cp_skip_count > 0 && --cache->cp_skip_count > 0) @@ -699,9 +699,9 @@ __cache_pool_adjust(WT_SESSION_IMPL *session, entry->cache_size -= adjustment; cp->currently_used -= adjustment; } - WT_RET(__wt_verbose(session, WT_VERB_SHARED_CACHE, + __wt_verbose(session, WT_VERB_SHARED_CACHE, "Allocated %s%" PRId64 " to %s", - grow ? "" : "-", adjustment, entry->home)); + grow ? "" : "-", adjustment, entry->home); /* * TODO: Add a loop waiting for connection to give up @@ -721,7 +721,6 @@ __wt_cache_pool_server(void *arg) { WT_CACHE *cache; WT_CACHE_POOL *cp; - WT_DECL_RET; WT_SESSION_IMPL *session; bool forward; @@ -734,8 +733,8 @@ __wt_cache_pool_server(void *arg) while (F_ISSET(cp, WT_CACHE_POOL_ACTIVE) && F_ISSET(cache, WT_CACHE_POOL_RUN)) { if (cp->currently_used <= cp->size) - WT_ERR(__wt_cond_wait(session, - cp->cache_pool_cond, WT_MILLION)); + __wt_cond_wait( + session, cp->cache_pool_cond, WT_MILLION); /* * Re-check pool run flag - since we want to avoid getting the @@ -748,8 +747,8 @@ __wt_cache_pool_server(void *arg) /* Try to become the managing thread */ if (__wt_atomic_cas8(&cp->pool_managed, 0, 1)) { F_SET(cache, WT_CACHE_POOL_MANAGER); - WT_ERR(__wt_verbose(session, WT_VERB_SHARED_CACHE, - "Cache pool switched manager thread")); + __wt_verbose(session, WT_VERB_SHARED_CACHE, + "Cache pool switched manager thread"); } /* @@ -762,8 +761,5 @@ __wt_cache_pool_server(void *arg) } } - if (0) { -err: WT_PANIC_MSG(session, ret, "cache pool manager server error"); - } return (WT_THREAD_RET_VALUE); } diff --git a/src/conn/conn_ckpt.c b/src/conn/conn_ckpt.c index 24546fc4943..5e9d8f70193 100644 --- a/src/conn/conn_ckpt.c +++ b/src/conn/conn_ckpt.c @@ -85,8 +85,7 @@ __ckpt_server(void *arg) * NOTE: If the user only configured logsize, then usecs * will be 0 and this wait won't return until signalled. */ - WT_ERR( - __wt_cond_wait(session, conn->ckpt_cond, conn->ckpt_usecs)); + __wt_cond_wait(session, conn->ckpt_cond, conn->ckpt_usecs); /* Checkpoint the database. */ WT_ERR(wt_session->checkpoint(wt_session, NULL)); @@ -102,7 +101,7 @@ __ckpt_server(void *arg) * signalled, do a tiny wait to clear it so we don't do * another checkpoint immediately. */ - WT_ERR(__wt_cond_wait(session, conn->ckpt_cond, 1)); + __wt_cond_wait(session, conn->ckpt_cond, 1); } } @@ -200,7 +199,7 @@ __wt_checkpoint_server_destroy(WT_SESSION_IMPL *session) F_CLR(conn, WT_CONN_SERVER_CHECKPOINT); if (conn->ckpt_tid_set) { - WT_TRET(__wt_cond_signal(session, conn->ckpt_cond)); + __wt_cond_signal(session, conn->ckpt_cond); WT_TRET(__wt_thread_join(session, conn->ckpt_tid)); conn->ckpt_tid_set = false; } @@ -237,7 +236,7 @@ __wt_checkpoint_signal(WT_SESSION_IMPL *session, wt_off_t logsize) conn = S2C(session); WT_ASSERT(session, WT_CKPT_LOGSIZE(conn)); if (logsize >= conn->ckpt_logsize && !conn->ckpt_signalled) { - WT_RET(__wt_cond_signal(session, conn->ckpt_cond)); + __wt_cond_signal(session, conn->ckpt_cond); conn->ckpt_signalled = 1; } return (0); diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c index f52fccc7d1c..3f242b9df7e 100644 --- a/src/conn/conn_dhandle.c +++ b/src/conn/conn_dhandle.c @@ -12,19 +12,15 @@ * __conn_dhandle_destroy -- * Destroy a data handle. */ -static int +static void __conn_dhandle_destroy(WT_SESSION_IMPL *session, WT_DATA_HANDLE *dhandle) { - WT_DECL_RET; - - ret = __wt_rwlock_destroy(session, &dhandle->rwlock); + __wt_rwlock_destroy(session, &dhandle->rwlock); __wt_free(session, dhandle->name); __wt_free(session, dhandle->checkpoint); __wt_free(session, dhandle->handle); __wt_spin_destroy(session, &dhandle->close_lock); __wt_overwrite_and_free(session, dhandle); - - return (ret); } /* @@ -83,7 +79,7 @@ __conn_dhandle_alloc(WT_SESSION_IMPL *session, *dhandlep = dhandle; return (0); -err: WT_TRET(__conn_dhandle_destroy(session, dhandle)); +err: __conn_dhandle_destroy(session, dhandle); return (ret); } @@ -591,7 +587,7 @@ __wt_conn_dhandle_discard_single( */ if (ret == 0 || final) { __conn_btree_config_clear(session); - WT_TRET(__conn_dhandle_destroy(session, dhandle)); + __conn_dhandle_destroy(session, dhandle); session->dhandle = NULL; } diff --git a/src/conn/conn_handle.c b/src/conn/conn_handle.c index 509966793e5..5ff8b7f798b 100644 --- a/src/conn/conn_handle.c +++ b/src/conn/conn_handle.c @@ -138,7 +138,7 @@ __wt_connection_destroy(WT_CONNECTION_IMPL *conn) __wt_spin_destroy(session, &conn->dhandle_lock); __wt_spin_destroy(session, &conn->encryptor_lock); __wt_spin_destroy(session, &conn->fh_lock); - WT_TRET(__wt_rwlock_destroy(session, &conn->hot_backup_lock)); + __wt_rwlock_destroy(session, &conn->hot_backup_lock); __wt_spin_destroy(session, &conn->las_lock); __wt_spin_destroy(session, &conn->metadata_lock); __wt_spin_destroy(session, &conn->reconfig_lock); diff --git a/src/conn/conn_log.c b/src/conn/conn_log.c index 06b23086c69..6c05376f9ce 100644 --- a/src/conn/conn_log.c +++ b/src/conn/conn_log.c @@ -173,7 +173,7 @@ __logmgr_config( WT_RET(__logmgr_sync_cfg(session, cfg)); if (conn->log_cond != NULL) - WT_RET(__wt_cond_auto_signal(session, conn->log_cond)); + __wt_cond_auto_signal(session, conn->log_cond); return (0); } @@ -222,8 +222,8 @@ __log_archive_once(WT_SESSION_IMPL *session, uint32_t backup_file) else min_lognum = WT_MIN( log->ckpt_lsn.l.file, log->sync_lsn.l.file); - WT_RET(__wt_verbose(session, WT_VERB_LOG, - "log_archive: archive to log number %" PRIu32, min_lognum)); + __wt_verbose(session, WT_VERB_LOG, + "log_archive: archive to log number %" PRIu32, min_lognum); /* * Main archive code. Get the list of all log files and @@ -236,7 +236,7 @@ __log_archive_once(WT_SESSION_IMPL *session, uint32_t backup_file) * We can only archive files if a hot backup is not in progress or * if we are the backup. */ - WT_ERR(__wt_readlock(session, conn->hot_backup_lock)); + __wt_readlock(session, conn->hot_backup_lock); locked = true; if (!conn->hot_backup || backup_file != 0) { for (i = 0; i < logcount; i++) { @@ -247,7 +247,7 @@ __log_archive_once(WT_SESSION_IMPL *session, uint32_t backup_file) session, WT_LOG_FILENAME, lognum)); } } - WT_ERR(__wt_readunlock(session, conn->hot_backup_lock)); + __wt_readunlock(session, conn->hot_backup_lock); locked = false; /* @@ -259,7 +259,7 @@ __log_archive_once(WT_SESSION_IMPL *session, uint32_t backup_file) if (0) err: __wt_err(session, ret, "log archive server error"); if (locked) - WT_TRET(__wt_readunlock(session, conn->hot_backup_lock)); + __wt_readunlock(session, conn->hot_backup_lock); WT_TRET(__wt_fs_directory_list_free(session, &logfiles, logcount)); return (ret); } @@ -295,9 +295,9 @@ __log_prealloc_once(WT_SESSION_IMPL *session) */ if (log->prep_missed > 0) { conn->log_prealloc += log->prep_missed; - WT_ERR(__wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "Missed %" PRIu32 ". Now pre-allocating up to %" PRIu32, - log->prep_missed, conn->log_prealloc)); + log->prep_missed, conn->log_prealloc); } WT_STAT_FAST_CONN_SET(session, log_prealloc_max, conn->log_prealloc); /* @@ -335,7 +335,6 @@ __wt_log_truncate_files( WT_DECL_RET; WT_LOG *log; uint32_t backup_file; - bool locked; WT_UNUSED(cfg); conn = S2C(session); @@ -352,17 +351,12 @@ __wt_log_truncate_files( if (cursor != NULL) backup_file = WT_CURSOR_BACKUP_ID(cursor); WT_ASSERT(session, backup_file <= log->alloc_lsn.l.file); - WT_RET(__wt_verbose(session, WT_VERB_LOG, - "log_truncate_files: Archive once up to %" PRIu32, backup_file)); + __wt_verbose(session, WT_VERB_LOG, + "log_truncate_files: Archive once up to %" PRIu32, backup_file); - WT_RET(__wt_writelock(session, log->log_archive_lock)); - locked = true; - WT_ERR(__log_archive_once(session, backup_file)); - WT_ERR(__wt_writeunlock(session, log->log_archive_lock)); - locked = false; -err: - if (locked) - WT_RET(__wt_writeunlock(session, log->log_archive_lock)); + __wt_writelock(session, log->log_archive_lock); + ret = __log_archive_once(session, backup_file); + __wt_writeunlock(session, log->log_archive_lock); return (ret); } @@ -444,8 +438,7 @@ __log_file_server(void *arg) WT_ASSERT(session, __wt_log_cmp( &close_end_lsn, &log->sync_lsn) >= 0); log->sync_lsn = close_end_lsn; - WT_ERR(__wt_cond_signal( - session, log->log_sync_cond)); + __wt_cond_signal(session, log->log_sync_cond); locked = false; __wt_spin_unlock(session, &log->log_sync_lock); } @@ -493,14 +486,14 @@ __log_file_server(void *arg) min_lsn.l.file == log->sync_lsn.l.file); log->sync_lsn = min_lsn; - WT_ERR(__wt_cond_signal( - session, log->log_sync_cond)); + __wt_cond_signal( + session, log->log_sync_cond); } locked = false; __wt_spin_unlock(session, &log->log_sync_lock); } else { - WT_ERR(__wt_cond_auto_signal( - session, conn->log_wrlsn_cond)); + __wt_cond_auto_signal( + session, conn->log_wrlsn_cond); /* * We do not want to wait potentially a second * to process this. Yield to give the wrlsn @@ -512,8 +505,7 @@ __log_file_server(void *arg) } } /* Wait until the next event. */ - WT_ERR(__wt_cond_wait( - session, conn->log_file_cond, WT_MILLION / 10)); + __wt_cond_wait(session, conn->log_file_cond, WT_MILLION / 10); } if (0) { @@ -547,11 +539,10 @@ typedef struct { * are contiguous. The purpose of this function is to advance the * write_lsn in LSN order after the buffer is written to the log file. */ -int +void __wt_log_wrlsn(WT_SESSION_IMPL *session, int *yield) { WT_CONNECTION_IMPL *conn; - WT_DECL_RET; WT_LOG *log; WT_LOG_WRLSN_ENTRY written[WT_SLOT_POOL]; WT_LOGSLOT *coalescing, *slot; @@ -670,21 +661,19 @@ restart: (uint32_t)slot->slot_last_offset; log->write_start_lsn = slot->slot_start_lsn; log->write_lsn = slot->slot_end_lsn; - WT_ERR(__wt_cond_signal( - session, log->log_write_cond)); + __wt_cond_signal(session, log->log_write_cond); WT_STAT_FAST_CONN_INCR(session, log_write_lsn); /* * Signal the close thread if needed. */ if (F_ISSET(slot, WT_SLOT_CLOSEFH)) - WT_ERR(__wt_cond_signal( - session, conn->log_file_cond)); + __wt_cond_signal( + session, conn->log_file_cond); } __wt_log_slot_free(session, slot); } } -err: __wt_spin_unlock(session, &log->log_writelsn_lock); - return (ret); + __wt_spin_unlock(session, &log->log_writelsn_lock); } /* @@ -717,7 +706,7 @@ __log_wrlsn_server(void *arg) */ if (__wt_log_cmp(&prev, &log->alloc_lsn) != 0 || __wt_log_cmp(&log->write_lsn, &log->alloc_lsn) != 0) - WT_ERR(__wt_log_wrlsn(session, &yield)); + __wt_log_wrlsn(session, &yield); else WT_STAT_FAST_CONN_INCR(session, log_write_lsn_skip); prev = log->alloc_lsn; @@ -733,15 +722,15 @@ __log_wrlsn_server(void *arg) * Send in false because if we did any work we would * not be on this path. */ - WT_ERR(__wt_cond_auto_wait( - session, conn->log_wrlsn_cond, did_work)); + __wt_cond_auto_wait( + session, conn->log_wrlsn_cond, did_work); } /* * On close we need to do this one more time because there could * be straggling log writes that need to be written. */ WT_ERR(__wt_log_force_write(session, 1, NULL)); - WT_ERR(__wt_log_wrlsn(session, NULL)); + __wt_log_wrlsn(session, NULL); if (0) { err: __wt_err(session, ret, "log wrlsn server error"); } @@ -761,12 +750,12 @@ __log_server(void *arg) WT_LOG *log; WT_SESSION_IMPL *session; uint64_t timediff; - bool did_work, locked, signalled; + bool did_work, signalled; session = arg; conn = S2C(session); log = conn->log; - locked = signalled = false; + signalled = false; /* * Set this to the number of milliseconds we want to run archive and @@ -813,14 +802,11 @@ __log_server(void *arg) * agreed not to rename or remove any files in * the database directory. */ - WT_ERR(__wt_readlock( - session, conn->hot_backup_lock)); - locked = true; + __wt_readlock(session, conn->hot_backup_lock); if (!conn->hot_backup) - WT_ERR(__log_prealloc_once(session)); - WT_ERR(__wt_readunlock( - session, conn->hot_backup_lock)); - locked = false; + ret = __log_prealloc_once(session); + __wt_readunlock(session, conn->hot_backup_lock); + WT_ERR(ret); } /* @@ -830,31 +816,27 @@ __log_server(void *arg) if (__wt_try_writelock( session, log->log_archive_lock) == 0) { ret = __log_archive_once(session, 0); - WT_TRET(__wt_writeunlock( - session, log->log_archive_lock)); + __wt_writeunlock( + session, log->log_archive_lock); WT_ERR(ret); } else - WT_ERR( - __wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "log_archive: Blocked due to open " - "log cursor holding archive lock")); + "log cursor holding archive lock"); } } /* Wait until the next event. */ WT_ERR(__wt_epoch(session, &start)); - WT_ERR(__wt_cond_auto_wait_signal(session, conn->log_cond, - did_work, &signalled)); + __wt_cond_auto_wait_signal(session, + conn->log_cond, did_work, &signalled); WT_ERR(__wt_epoch(session, &now)); timediff = WT_TIMEDIFF_MS(now, start); } if (0) { err: __wt_err(session, ret, "log server error"); - if (locked) - WT_TRET(__wt_readunlock( - session, conn->hot_backup_lock)); } return (WT_THREAD_RET_VALUE); } @@ -975,7 +957,7 @@ __wt_logmgr_open(WT_SESSION_IMPL *session) if (conn->log_session != NULL) { WT_ASSERT(session, conn->log_cond != NULL); WT_ASSERT(session, conn->log_tid_set == true); - WT_RET(__wt_cond_auto_signal(session, conn->log_cond)); + __wt_cond_auto_signal(session, conn->log_cond); } else { /* The log server gets its own session. */ WT_RET(__wt_open_internal_session(conn, @@ -1017,12 +999,12 @@ __wt_logmgr_destroy(WT_SESSION_IMPL *session) return (0); } if (conn->log_tid_set) { - WT_TRET(__wt_cond_auto_signal(session, conn->log_cond)); + __wt_cond_auto_signal(session, conn->log_cond); WT_TRET(__wt_thread_join(session, conn->log_tid)); conn->log_tid_set = false; } if (conn->log_file_tid_set) { - WT_TRET(__wt_cond_signal(session, conn->log_file_cond)); + __wt_cond_signal(session, conn->log_file_cond); WT_TRET(__wt_thread_join(session, conn->log_file_tid)); conn->log_file_tid_set = false; } @@ -1032,7 +1014,7 @@ __wt_logmgr_destroy(WT_SESSION_IMPL *session) conn->log_file_session = NULL; } if (conn->log_wrlsn_tid_set) { - WT_TRET(__wt_cond_auto_signal(session, conn->log_wrlsn_cond)); + __wt_cond_auto_signal(session, conn->log_wrlsn_cond); WT_TRET(__wt_thread_join(session, conn->log_wrlsn_tid)); conn->log_wrlsn_tid_set = false; } @@ -1059,7 +1041,7 @@ __wt_logmgr_destroy(WT_SESSION_IMPL *session) WT_TRET(__wt_cond_destroy(session, &conn->log->log_sync_cond)); WT_TRET(__wt_cond_destroy(session, &conn->log->log_write_cond)); - WT_TRET(__wt_rwlock_destroy(session, &conn->log->log_archive_lock)); + __wt_rwlock_destroy(session, &conn->log->log_archive_lock); __wt_spin_destroy(session, &conn->log->log_lock); __wt_spin_destroy(session, &conn->log->log_slot_lock); __wt_spin_destroy(session, &conn->log->log_sync_lock); diff --git a/src/conn/conn_open.c b/src/conn/conn_open.c index 8f101d4ec8e..69b50147bf5 100644 --- a/src/conn/conn_open.c +++ b/src/conn/conn_open.c @@ -157,7 +157,7 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn) WT_TRET(__wt_cache_destroy(session)); /* Discard transaction state. */ - WT_TRET(__wt_txn_global_destroy(session)); + __wt_txn_global_destroy(session); /* Close extensions, first calling any unload entry point. */ while ((dlh = TAILQ_FIRST(&conn->dlhqh)) != NULL) { diff --git a/src/conn/conn_stat.c b/src/conn/conn_stat.c index 4e7cac59c4a..0894d1c6058 100644 --- a/src/conn/conn_stat.c +++ b/src/conn/conn_stat.c @@ -528,8 +528,7 @@ __statlog_server(void *arg) while (F_ISSET(conn, WT_CONN_SERVER_RUN) && F_ISSET(conn, WT_CONN_SERVER_STATISTICS)) { /* Wait until the next event. */ - WT_ERR( - __wt_cond_wait(session, conn->stat_cond, conn->stat_usecs)); + __wt_cond_wait(session, conn->stat_cond, conn->stat_usecs); if (!FLD_ISSET(conn->stat_flags, WT_CONN_STAT_NONE)) WT_ERR(__statlog_log_one(session, &path, &tmp)); @@ -636,7 +635,7 @@ __wt_statlog_destroy(WT_SESSION_IMPL *session, bool is_close) /* Stop the server thread. */ F_CLR(conn, WT_CONN_SERVER_STATISTICS); if (conn->stat_tid_set) { - WT_TRET(__wt_cond_signal(session, conn->stat_cond)); + __wt_cond_signal(session, conn->stat_cond); WT_TRET(__wt_thread_join(session, conn->stat_tid)); conn->stat_tid_set = false; } diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c index 67c3a734801..dda296f50f3 100644 --- a/src/conn/conn_sweep.c +++ b/src/conn/conn_sweep.c @@ -97,7 +97,7 @@ __sweep_expire_one(WT_SESSION_IMPL *session) */ ret = __wt_conn_btree_sync_and_close(session, false, true); -err: WT_TRET(__wt_writeunlock(session, dhandle->rwlock)); +err: __wt_writeunlock(session, dhandle->rwlock); return (ret); } @@ -207,7 +207,7 @@ __sweep_remove_one(WT_SESSION_IMPL *session, WT_DATA_HANDLE *dhandle) * don't retry the discard until it times out again. */ if (ret != 0) { -err: WT_TRET(__wt_writeunlock(session, dhandle->rwlock)); +err: __wt_writeunlock(session, dhandle->rwlock); } return (ret); @@ -271,8 +271,8 @@ __sweep_server(void *arg) while (F_ISSET(conn, WT_CONN_SERVER_RUN) && F_ISSET(conn, WT_CONN_SERVER_SWEEP)) { /* Wait until the next event. */ - WT_ERR(__wt_cond_wait(session, - conn->sweep_cond, conn->sweep_interval * WT_MILLION)); + __wt_cond_wait(session, + conn->sweep_cond, conn->sweep_interval * WT_MILLION); WT_ERR(__wt_seconds(session, &now)); WT_STAT_FAST_CONN_INCR(session, dh_sweeps); @@ -416,7 +416,7 @@ __wt_sweep_destroy(WT_SESSION_IMPL *session) F_CLR(conn, WT_CONN_SERVER_SWEEP); if (conn->sweep_tid_set) { - WT_TRET(__wt_cond_signal(session, conn->sweep_cond)); + __wt_cond_signal(session, conn->sweep_cond); WT_TRET(__wt_thread_join(session, conn->sweep_tid)); conn->sweep_tid_set = 0; } diff --git a/src/cursor/cur_backup.c b/src/cursor/cur_backup.c index 63952169566..598da3f0ac6 100644 --- a/src/cursor/cur_backup.c +++ b/src/cursor/cur_backup.c @@ -227,9 +227,9 @@ __backup_start( * could start a hot backup that would race with an already-started * checkpoint. */ - WT_RET(__wt_writelock(session, conn->hot_backup_lock)); + __wt_writelock(session, conn->hot_backup_lock); conn->hot_backup = true; - WT_ERR(__wt_writeunlock(session, conn->hot_backup_lock)); + __wt_writeunlock(session, conn->hot_backup_lock); /* We're the lock holder, we own cleanup. */ F_SET(cb, WT_CURBACKUP_LOCKER); @@ -342,9 +342,9 @@ __backup_stop(WT_SESSION_IMPL *session, WT_CURSOR_BACKUP *cb) WT_TRET(__wt_backup_file_remove(session)); /* Checkpoint deletion can proceed, as can the next hot backup. */ - WT_TRET(__wt_writelock(session, conn->hot_backup_lock)); + __wt_writelock(session, conn->hot_backup_lock); conn->hot_backup = false; - WT_TRET(__wt_writeunlock(session, conn->hot_backup_lock)); + __wt_writeunlock(session, conn->hot_backup_lock); return (ret); } diff --git a/src/cursor/cur_log.c b/src/cursor/cur_log.c index 2adf0c2b8ab..76f31b417a6 100644 --- a/src/cursor/cur_log.c +++ b/src/cursor/cur_log.c @@ -323,7 +323,7 @@ __curlog_close(WT_CURSOR *cursor) WT_ASSERT(session, FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED)); if (F_ISSET(cl, WT_CURLOG_ARCHIVE_LOCK)) - WT_TRET(__wt_readunlock(session, conn->log->log_archive_lock)); + __wt_readunlock(session, conn->log->log_archive_lock); __wt_free(session, cl->cur_lsn); __wt_free(session, cl->next_lsn); @@ -401,7 +401,7 @@ __wt_curlog_open(WT_SESSION_IMPL *session, WT_ERR(__wt_log_force_write(session, 1, NULL)); /* Log cursors block archiving. */ - WT_ERR(__wt_readlock(session, log->log_archive_lock)); + __wt_readlock(session, log->log_archive_lock); F_SET(cl, WT_CURLOG_ARCHIVE_LOCK); if (0) { diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index 929e36f039d..8c6500c1bbf 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -139,7 +139,7 @@ __wt_evict_list_clear_page(WT_SESSION_IMPL *session, WT_REF *ref) * __wt_evict_server_wake -- * Wake the eviction server thread. */ -int +void __wt_evict_server_wake(WT_SESSION_IMPL *session) { WT_CACHE *cache; @@ -154,17 +154,17 @@ __wt_evict_server_wake(WT_SESSION_IMPL *session) bytes_inuse = __wt_cache_bytes_inuse(cache); bytes_max = conn->cache_size; - WT_RET(__wt_verbose(session, WT_VERB_EVICTSERVER, + __wt_verbose(session, WT_VERB_EVICTSERVER, "waking, bytes inuse %s max (%" PRIu64 "MB %s %" PRIu64 "MB)", bytes_inuse <= bytes_max ? "<=" : ">", bytes_inuse / WT_MEGABYTE, bytes_inuse <= bytes_max ? "<=" : ">", - bytes_max / WT_MEGABYTE)); + bytes_max / WT_MEGABYTE); } #endif - return (__wt_cond_auto_signal(session, cache->evict_cond)); + __wt_cond_auto_signal(session, cache->evict_cond); } /* @@ -205,13 +205,11 @@ __evict_thread_run(void *arg) F_CLR(session, WT_SESSION_LOCKED_PASS); __wt_spin_unlock(session, &cache->evict_pass_lock); WT_ERR(ret); - WT_ERR(__wt_verbose( - session, WT_VERB_EVICTSERVER, "sleeping")); + __wt_verbose(session, WT_VERB_EVICTSERVER, "sleeping"); /* Don't rely on signals: check periodically. */ - WT_ERR(__wt_cond_auto_wait( - session, cache->evict_cond, did_work)); - WT_ERR(__wt_verbose( - session, WT_VERB_EVICTSERVER, "waking")); + __wt_cond_auto_wait( + session, cache->evict_cond, did_work); + __wt_verbose(session, WT_VERB_EVICTSERVER, "waking"); } else WT_ERR(__evict_helper(session)); } @@ -225,8 +223,8 @@ __evict_thread_run(void *arg) ret = __evict_clear_all_walks(session)); WT_ERR(ret); } - WT_ERR(__wt_verbose( - session, WT_VERB_EVICTSERVER, "cache eviction thread exiting")); + __wt_verbose( + session, WT_VERB_EVICTSERVER, "cache eviction thread exiting"); /* * The only two cases when eviction workers are expected to stop are @@ -453,18 +451,17 @@ __wt_evict_destroy(WT_SESSION_IMPL *session) * safely know how many helpers are running until the main thread is * done. */ - WT_TRET(__wt_verbose( - session, WT_VERB_EVICTSERVER, "waiting for main thread")); + __wt_verbose(session, WT_VERB_EVICTSERVER, "waiting for main thread"); if (conn->evict_tid_set) { - WT_TRET(__wt_evict_server_wake(session)); + __wt_evict_server_wake(session); WT_TRET(__wt_thread_join(session, conn->evict_tid)); conn->evict_tid_set = false; } - WT_TRET(__wt_verbose( - session, WT_VERB_EVICTSERVER, "waiting for helper threads")); + __wt_verbose( + session, WT_VERB_EVICTSERVER, "waiting for helper threads"); for (i = 0; i < conn->evict_workers; i++) { - WT_TRET(__wt_cond_signal(session, cache->evict_waiter_cond)); + __wt_cond_signal(session, cache->evict_waiter_cond); WT_TRET(__wt_thread_join(session, workers[i].tid)); } conn->evict_workers = 0; @@ -502,8 +499,7 @@ __evict_helper(WT_SESSION_IMPL *session) cache = S2C(session)->cache; if ((ret = __evict_lru_pages(session, false)) == WT_NOTFOUND) - WT_RET(__wt_cond_wait( - session, cache->evict_waiter_cond, 10000)); + __wt_cond_wait(session, cache->evict_waiter_cond, 10000); else WT_RET(ret); return (0); @@ -648,9 +644,9 @@ __evict_pass(WT_SESSION_IMPL *session) */ if (FLD_ISSET(cache->state, WT_EVICT_STATE_ALL) && conn->evict_workers < conn->evict_workers_max) { - WT_RET(__wt_verbose(session, WT_VERB_EVICTSERVER, + __wt_verbose(session, WT_VERB_EVICTSERVER, "Starting evict worker: %"PRIu32"\n", - conn->evict_workers)); + conn->evict_workers); if (conn->evict_workers >= conn->evict_workers_alloc) WT_RET(__evict_workers_resize(session)); worker = &conn->evict_workctx[conn->evict_workers++]; @@ -659,11 +655,11 @@ __evict_pass(WT_SESSION_IMPL *session) &worker->tid, __evict_thread_run, worker->session)); } - WT_RET(__wt_verbose(session, WT_VERB_EVICTSERVER, + __wt_verbose(session, WT_VERB_EVICTSERVER, "Eviction pass with: Max: %" PRIu64 " In use: %" PRIu64 " Dirty: %" PRIu64, conn->cache_size, cache->bytes_inmem, - cache->bytes_dirty_intl + cache->bytes_dirty_leaf)); + cache->bytes_dirty_intl + cache->bytes_dirty_leaf); WT_RET(__evict_lru_walk(session)); WT_RET_NOTFOUND_OK(__evict_lru_pages(session, true)); @@ -686,8 +682,8 @@ __evict_pass(WT_SESSION_IMPL *session) */ WT_STAT_FAST_CONN_INCR(session, cache_eviction_server_slept); - WT_RET(__wt_cond_wait(session, - cache->evict_cond, WT_THOUSAND * WT_MAX(loop, 1))); + __wt_cond_wait(session, + cache->evict_cond, WT_THOUSAND * WT_MAX(loop, 1)); if (loop == 100) { /* @@ -697,9 +693,8 @@ __evict_pass(WT_SESSION_IMPL *session) F_SET(cache, WT_CACHE_STUCK); WT_STAT_FAST_CONN_INCR( session, cache_eviction_slow); - WT_RET(__wt_verbose( - session, WT_VERB_EVICTSERVER, - "unable to reach eviction goal")); + __wt_verbose(session, WT_VERB_EVICTSERVER, + "unable to reach eviction goal"); break; } } else { @@ -1040,7 +1035,7 @@ __evict_lru_walk(WT_SESSION_IMPL *session) * Signal any application or helper threads that may be waiting * to help with eviction. */ - WT_RET(__wt_cond_signal(session, cache->evict_waiter_cond)); + __wt_cond_signal(session, cache->evict_waiter_cond); return (0); } @@ -1450,8 +1445,8 @@ fast: /* If the page can't be evicted, give up. */ if (WT_PAGE_IS_INTERNAL(page)) ++internal_pages; - WT_RET(__wt_verbose(session, WT_VERB_EVICTSERVER, - "select: %p, size %" PRIu64, page, page->memory_footprint)); + __wt_verbose(session, WT_VERB_EVICTSERVER, + "select: %p, size %" PRIu64, page, page->memory_footprint); } WT_RET_NOTFOUND_OK(ret); @@ -1748,7 +1743,7 @@ __wt_cache_eviction_worker(WT_SESSION_IMPL *session, bool busy, u_int pct_full) txn_busy = true; /* Wake the eviction server if we need to do work. */ - WT_RET(__wt_evict_server_wake(session)); + __wt_evict_server_wake(session); /* * If we're busy, either because of the transaction check we just did, @@ -1790,8 +1785,8 @@ __wt_cache_eviction_worker(WT_SESSION_IMPL *session, bool busy, u_int pct_full) break; case WT_NOTFOUND: /* Allow the queue to re-populate before retrying. */ - WT_RET(__wt_cond_wait( - session, cache->evict_waiter_cond, 100000)); + __wt_cond_wait( + session, cache->evict_waiter_cond, 100000); cache->app_waits++; break; default: @@ -1810,7 +1805,7 @@ __wt_cache_eviction_worker(WT_SESSION_IMPL *session, bool busy, u_int pct_full) * __wt_page_evict_soon -- * Set a page to be evicted as soon as possible. */ -int +void __wt_page_evict_soon(WT_SESSION_IMPL *session, WT_REF *ref) { WT_CACHE *cache; @@ -1826,7 +1821,7 @@ __wt_page_evict_soon(WT_SESSION_IMPL *session, WT_REF *ref) page->read_gen = WT_READGEN_OLDEST; if (F_ISSET_ATOMIC(page, WT_PAGE_EVICT_LRU) || F_ISSET(S2BT(session), WT_BTREE_NO_EVICTION)) - return (0); + return; /* Append to the urgent queue if we can. */ cache = S2C(session)->cache; @@ -1856,12 +1851,10 @@ done: __wt_spin_unlock(session, &cache->evict_queue_lock); WT_STAT_FAST_CONN_INCR( session, cache_eviction_pages_queued_urgent); if (S2C(session)->evict_workers > 1) - WT_RET(__wt_cond_signal( - session, cache->evict_waiter_cond)); + __wt_cond_signal(session, cache->evict_waiter_cond); else - WT_RET(__wt_evict_server_wake(session)); + __wt_evict_server_wake(session); } - return (0); } /* diff --git a/src/evict/evict_page.c b/src/evict/evict_page.c index d4c4e3e311a..ff967ea0efd 100644 --- a/src/evict/evict_page.c +++ b/src/evict/evict_page.c @@ -116,8 +116,8 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, bool closing) page = ref->page; tree_dead = F_ISSET(session->dhandle, WT_DHANDLE_DEAD); - WT_RET(__wt_verbose(session, WT_VERB_EVICT, - "page %p (%s)", page, __wt_page_type_string(page->type))); + __wt_verbose(session, WT_VERB_EVICT, + "page %p (%s)", page, __wt_page_type_string(page->type)); /* * Get exclusive access to the page and review it for conditions that diff --git a/src/include/api.h b/src/include/api.h index 0a4593178dc..e1b2f8edaf3 100644 --- a/src/include/api.h +++ b/src/include/api.h @@ -17,7 +17,7 @@ #define API_CALL_NOCONF(s, h, n, cur, dh) do { \ API_SESSION_INIT(s, h, n, cur, dh); \ WT_ERR(WT_SESSION_CHECK_PANIC(s)); \ - WT_ERR(__wt_verbose((s), WT_VERB_API, "CALL: " #h ":" #n)) + __wt_verbose((s), WT_VERB_API, "CALL: " #h ":" #n) #define API_CALL(s, h, n, cur, dh, config, cfg) do { \ const char *cfg[] = \ @@ -27,7 +27,7 @@ if ((config) != NULL) \ WT_ERR(__wt_config_check((s), \ WT_CONFIG_REF(session, h##_##n), (config), 0)); \ - WT_ERR(__wt_verbose((s), WT_VERB_API, "CALL: " #h ":" #n)) + __wt_verbose((s), WT_VERB_API, "CALL: " #h ":" #n) #define API_END(s, ret) \ if ((s) != NULL) { \ diff --git a/src/include/cursor.i b/src/include/cursor.i index 76a08138afb..e142441e0a6 100644 --- a/src/include/cursor.i +++ b/src/include/cursor.i @@ -117,7 +117,7 @@ __curfile_leave(WT_CURSOR_BTREE *cbt) */ if (cbt->ref != NULL && cbt->page_deleted_count > WT_BTREE_DELETE_THRESHOLD) - WT_TRET(__wt_page_evict_soon(session, cbt->ref)); + __wt_page_evict_soon(session, cbt->ref); cbt->page_deleted_count = 0; /* @@ -127,7 +127,7 @@ __curfile_leave(WT_CURSOR_BTREE *cbt) * * Clear the reference regardless, so we don't try the release twice. */ - WT_TRET(__wt_page_release(session, cbt->ref, 0)); + ret = __wt_page_release(session, cbt->ref, 0); cbt->ref = NULL; return (ret); diff --git a/src/include/extern.h b/src/include/extern.h index a18f2b3ef8c..a3916a31542 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -261,7 +261,7 @@ extern int __wt_connection_init(WT_CONNECTION_IMPL *conn) WT_GCC_FUNC_DECL_ATTRI extern int __wt_connection_destroy(WT_CONNECTION_IMPL *conn) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_logmgr_reconfig(WT_SESSION_IMPL *session, const char **cfg) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_log_truncate_files( WT_SESSION_IMPL *session, WT_CURSOR *cursor, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_log_wrlsn(WT_SESSION_IMPL *session, int *yield) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_log_wrlsn(WT_SESSION_IMPL *session, int *yield); extern int __wt_logmgr_create(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_logmgr_open(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_logmgr_destroy(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -338,21 +338,21 @@ extern int __wt_table_range_truncate(WT_CURSOR_TABLE *start, WT_CURSOR_TABLE *st extern int __wt_curtable_open(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_CURSOR **cursorp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_evict_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern void __wt_evict_list_clear_page(WT_SESSION_IMPL *session, WT_REF *ref); -extern int __wt_evict_server_wake(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_evict_server_wake(WT_SESSION_IMPL *session); extern int __wt_evict_create(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_evict_destroy(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_evict_file_exclusive_on(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern void __wt_evict_file_exclusive_off(WT_SESSION_IMPL *session); extern int __wt_cache_eviction_worker(WT_SESSION_IMPL *session, bool busy, u_int pct_full) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_page_evict_soon(WT_SESSION_IMPL *session, WT_REF *ref) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_page_evict_soon(WT_SESSION_IMPL *session, WT_REF *ref); extern void __wt_evict_priority_set(WT_SESSION_IMPL *session, uint64_t v); extern void __wt_evict_priority_clear(WT_SESSION_IMPL *session); extern int __wt_cache_dump(WT_SESSION_IMPL *session, const char *ofile) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, bool closing) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_log_ckpt(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_log_ckpt(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn); extern int __wt_log_flush_lsn(WT_SESSION_IMPL *session, WT_LSN *lsn, bool start) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_log_background(WT_SESSION_IMPL *session, WT_LSN *lsn) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_log_background(WT_SESSION_IMPL *session, WT_LSN *lsn); extern int __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, bool *recp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern void __wt_log_written_reset(WT_SESSION_IMPL *session); @@ -434,10 +434,10 @@ extern int __wt_lsm_tree_retire_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *ls extern int __wt_lsm_tree_drop( WT_SESSION_IMPL *session, const char *name, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_lsm_tree_rename(WT_SESSION_IMPL *session, const char *olduri, const char *newuri, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_lsm_tree_truncate( WT_SESSION_IMPL *session, const char *name, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_lsm_tree_readlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_lsm_tree_readunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_lsm_tree_writelock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_lsm_tree_writeunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_lsm_tree_readlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree); +extern void __wt_lsm_tree_readunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree); +extern void __wt_lsm_tree_writelock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree); +extern void __wt_lsm_tree_writeunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree); extern int __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, bool *skipp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_lsm_tree_worker(WT_SESSION_IMPL *session, const char *uri, int (*file_func)(WT_SESSION_IMPL *, const char *[]), int (*name_func)(WT_SESSION_IMPL *, const char *, bool *), const char *cfg[], uint32_t open_flags) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_lsm_get_chunk_to_flush(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool force, WT_LSM_CHUNK **chunkp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -605,9 +605,9 @@ extern int __wt_session_get_btree(WT_SESSION_IMPL *session, const char *uri, con extern int __wt_session_lock_checkpoint(WT_SESSION_IMPL *session, const char *checkpoint) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_salvage(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_cond_auto_alloc( WT_SESSION_IMPL *session, const char *name, bool is_signalled, uint64_t min, uint64_t max, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_cond_auto_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_cond_auto_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, bool progress, bool *signalled) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_cond_auto_wait( WT_SESSION_IMPL *session, WT_CONDVAR *cond, bool progress) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_cond_auto_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond); +extern void __wt_cond_auto_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, bool progress, bool *signalled); +extern void __wt_cond_auto_wait( WT_SESSION_IMPL *session, WT_CONDVAR *cond, bool progress); extern int __wt_cond_auto_destroy(WT_SESSION_IMPL *session, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_decrypt(WT_SESSION_IMPL *session, WT_ENCRYPTOR *encryptor, size_t skip, WT_ITEM *in, WT_ITEM *out) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_encrypt(WT_SESSION_IMPL *session, WT_KEYED_ENCRYPTOR *kencryptor, size_t skip, WT_ITEM *in, WT_ITEM *out) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -661,12 +661,12 @@ extern int __wt_huffman_encode(WT_SESSION_IMPL *session, void *huffman_arg, cons extern int __wt_huffman_decode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, size_t from_len, WT_ITEM *to_buf) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_rwlock_alloc( WT_SESSION_IMPL *session, WT_RWLOCK **rwlockp, const char *name) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_try_readlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_readlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_readunlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_readlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock); +extern void __wt_readunlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock); extern int __wt_try_writelock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_writelock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_writeunlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_rwlock_destroy(WT_SESSION_IMPL *session, WT_RWLOCK **rwlockp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_writelock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock); +extern void __wt_writeunlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock); +extern void __wt_rwlock_destroy(WT_SESSION_IMPL *session, WT_RWLOCK **rwlockp); extern uint32_t __wt_nlpo2_round(uint32_t v); extern uint32_t __wt_nlpo2(uint32_t v); extern uint32_t __wt_log2_int(uint32_t n); @@ -718,7 +718,7 @@ extern int __wt_txn_init(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((w extern void __wt_txn_stats_update(WT_SESSION_IMPL *session); extern void __wt_txn_destroy(WT_SESSION_IMPL *session); extern int __wt_txn_global_init(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_txn_global_destroy(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_txn_global_destroy(WT_SESSION_IMPL *session); extern int __wt_checkpoint_get_handles(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_checkpoint(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); diff --git a/src/include/extern_posix.h b/src/include/extern_posix.h index 1cc29a5c70a..d2f74d2ffe4 100644 --- a/src/include/extern_posix.h +++ b/src/include/extern_posix.h @@ -13,8 +13,8 @@ extern int __wt_posix_map_preload(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, co extern int __wt_posix_map_discard(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, void *map, size_t length, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_posix_unmap(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, void *mapped_region, size_t len, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_cond_alloc(WT_SESSION_IMPL *session, const char *name, bool is_signalled, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_cond_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs, bool *signalled) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_cond_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs, bool *signalled); +extern void __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond); extern int __wt_cond_destroy(WT_SESSION_IMPL *session, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_once(void (*init_routine)(void)) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_get_vm_pagesize(void) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); diff --git a/src/include/extern_win.h b/src/include/extern_win.h index f34dbb270d0..bceb5158c28 100644 --- a/src/include/extern_win.h +++ b/src/include/extern_win.h @@ -11,8 +11,8 @@ extern int __wt_getenv(WT_SESSION_IMPL *session, const char *variable, const cha extern int __wt_win_map(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, void *mapped_regionp, size_t *lenp, void *mapped_cookiep) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_win_unmap(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, void *mapped_region, size_t length, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_cond_alloc(WT_SESSION_IMPL *session, const char *name, bool is_signalled, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_cond_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs, bool *signalled) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_cond_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs, bool *signalled); +extern void __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond); extern int __wt_cond_destroy(WT_SESSION_IMPL *session, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_once(void (*init_routine)(void)) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_get_vm_pagesize(void) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); diff --git a/src/include/misc.i b/src/include/misc.i index 93887e413a4..e1b882388e7 100644 --- a/src/include/misc.i +++ b/src/include/misc.i @@ -10,12 +10,12 @@ * __wt_cond_wait -- * Wait on a mutex, optionally timing out. */ -static inline int +static inline void __wt_cond_wait(WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs) { bool notused; - return (__wt_cond_wait_signal(session, cond, usecs, ¬used)); + __wt_cond_wait_signal(session, cond, usecs, ¬used); } /* @@ -49,25 +49,22 @@ __wt_seconds(WT_SESSION_IMPL *session, time_t *timep) * __wt_verbose -- * Verbose message. */ -static inline int +static inline void __wt_verbose(WT_SESSION_IMPL *session, int flag, const char *fmt, ...) WT_GCC_FUNC_ATTRIBUTE((format (printf, 2, 3))) WT_GCC_FUNC_ATTRIBUTE((cold)) { #ifdef HAVE_VERBOSE - WT_DECL_RET; va_list ap; if (WT_VERBOSE_ISSET(session, flag)) { va_start(ap, fmt); - ret = __wt_eventv(session, true, 0, NULL, 0, fmt, ap); + WT_IGNORE_RET(__wt_eventv(session, true, 0, NULL, 0, fmt, ap)); va_end(ap); } - return (ret); #else WT_UNUSED(session); WT_UNUSED(flag); WT_UNUSED(fmt); - return (0); #endif } diff --git a/src/include/mutex.i b/src/include/mutex.i index 65956c13c08..e7c78fdb484 100644 --- a/src/include/mutex.i +++ b/src/include/mutex.i @@ -154,9 +154,10 @@ __wt_spin_trylock(WT_SESSION_IMPL *session, WT_SPINLOCK *t) static inline void __wt_spin_lock(WT_SESSION_IMPL *session, WT_SPINLOCK *t) { - WT_UNUSED(session); + WT_DECL_RET; - (void)pthread_mutex_lock(&t->lock); + if ((ret = pthread_mutex_lock(&t->lock)) != 0) + WT_PANIC_MSG(session, ret, "pthread_mutex_lock: %s", t->name); } #endif @@ -167,16 +168,14 @@ __wt_spin_lock(WT_SESSION_IMPL *session, WT_SPINLOCK *t) static inline void __wt_spin_unlock(WT_SESSION_IMPL *session, WT_SPINLOCK *t) { - WT_UNUSED(session); + WT_DECL_RET; - (void)pthread_mutex_unlock(&t->lock); + if ((ret = pthread_mutex_unlock(&t->lock)) != 0) + WT_PANIC_MSG(session, ret, "pthread_mutex_unlock: %s", t->name); } #elif SPINLOCK_TYPE == SPINLOCK_MSVC -#define WT_SPINLOCK_REGISTER -1 -#define WT_SPINLOCK_REGISTER_FAILED -2 - /* * __wt_spin_init -- * Initialize a spinlock. @@ -184,13 +183,18 @@ __wt_spin_unlock(WT_SESSION_IMPL *session, WT_SPINLOCK *t) static inline int __wt_spin_init(WT_SESSION_IMPL *session, WT_SPINLOCK *t, const char *name) { - WT_UNUSED(session); + DWORD windows_error; + + if (InitializeCriticalSectionAndSpinCount(&t->lock, 4000) == 0) { + windows_error = __wt_getlasterror(); + __wt_errx(session, + "%s: InitializeCriticalSectionAndSpinCount: %s", + name, __wt_formatmessage(session, windows_error)); + return (__wt_map_windows_error(windows_error)); + } t->name = name; t->initialized = 1; - - InitializeCriticalSectionAndSpinCount(&t->lock, 4000); - return (0); } @@ -279,7 +283,7 @@ __wt_fair_trylock(WT_SESSION_IMPL *session, WT_FAIR_LOCK *lock) * __wt_fair_lock -- * Get a lock. */ -static inline int +static inline void __wt_fair_lock(WT_SESSION_IMPL *session, WT_FAIR_LOCK *lock) { uint16_t ticket; @@ -311,15 +315,13 @@ __wt_fair_lock(WT_SESSION_IMPL *session, WT_FAIR_LOCK *lock) * lock see consistent data. */ WT_READ_BARRIER(); - - return (0); } /* * __wt_fair_unlock -- * Release a shared lock. */ -static inline int +static inline void __wt_fair_unlock(WT_SESSION_IMPL *session, WT_FAIR_LOCK *lock) { WT_UNUSED(session); @@ -334,8 +336,6 @@ __wt_fair_unlock(WT_SESSION_IMPL *session, WT_FAIR_LOCK *lock) * We have exclusive access - the update does not need to be atomic. */ ++lock->fair_lock_owner; - - return (0); } #ifdef HAVE_DIAGNOSTIC diff --git a/src/include/os_fhandle.i b/src/include/os_fhandle.i index 06eef2b7e9c..78d25969508 100644 --- a/src/include/os_fhandle.i +++ b/src/include/os_fhandle.i @@ -18,8 +18,8 @@ __wt_fsync(WT_SESSION_IMPL *session, WT_FH *fh, bool block) WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY)); - WT_RET(__wt_verbose( - session, WT_VERB_HANDLEOPS, "%s: handle-sync", fh->handle->name)); + __wt_verbose( + session, WT_VERB_HANDLEOPS, "%s: handle-sync", fh->handle->name); handle = fh->handle; /* @@ -50,9 +50,9 @@ __wt_fextend(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset) WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY)); WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_IN_MEMORY)); - WT_RET(__wt_verbose(session, WT_VERB_HANDLEOPS, + __wt_verbose(session, WT_VERB_HANDLEOPS, "%s: handle-extend: %" PRIuMAX " at %" PRIuMAX, - fh->handle->name, (uintmax_t)offset)); + fh->handle->name, (uintmax_t)offset); /* * Our caller is responsible for handling any locking issues, all we @@ -77,8 +77,8 @@ __wt_file_lock(WT_SESSION_IMPL * session, WT_FH *fh, bool lock) { WT_FILE_HANDLE *handle; - WT_RET(__wt_verbose(session, WT_VERB_HANDLEOPS, - "%s: handle-lock: %s", fh->handle->name, lock ? "lock" : "unlock")); + __wt_verbose(session, WT_VERB_HANDLEOPS, + "%s: handle-lock: %s", fh->handle->name, lock ? "lock" : "unlock"); handle = fh->handle; return (handle->fh_lock == NULL ? 0 : @@ -95,9 +95,9 @@ __wt_read( { WT_DECL_RET; - WT_RET(__wt_verbose(session, WT_VERB_HANDLEOPS, + __wt_verbose(session, WT_VERB_HANDLEOPS, "%s: handle-read: %" WT_SIZET_FMT " at %" PRIuMAX, - fh->handle->name, len, (uintmax_t)offset)); + fh->handle->name, len, (uintmax_t)offset); WT_STAT_FAST_CONN_INCR_ATOMIC(session, thread_read_active); WT_STAT_FAST_CONN_INCR(session, read_io); @@ -116,8 +116,8 @@ __wt_read( static inline int __wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t *sizep) { - WT_RET(__wt_verbose( - session, WT_VERB_HANDLEOPS, "%s: handle-size", fh->handle->name)); + __wt_verbose( + session, WT_VERB_HANDLEOPS, "%s: handle-size", fh->handle->name); return (fh->handle->fh_size(fh->handle, (WT_SESSION *)session, sizep)); } @@ -133,9 +133,9 @@ __wt_ftruncate(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset) WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY)); - WT_RET(__wt_verbose(session, WT_VERB_HANDLEOPS, + __wt_verbose(session, WT_VERB_HANDLEOPS, "%s: handle-truncate: %" PRIuMAX " at %" PRIuMAX, - fh->handle->name, (uintmax_t)offset)); + fh->handle->name, (uintmax_t)offset); /* * Our caller is responsible for handling any locking issues, all we @@ -162,12 +162,19 @@ __wt_write(WT_SESSION_IMPL *session, WT_STRING_MATCH(fh->name, WT_SINGLETHREAD, strlen(WT_SINGLETHREAD))); - WT_RET(__wt_verbose(session, WT_VERB_HANDLEOPS, + __wt_verbose(session, WT_VERB_HANDLEOPS, "%s: handle-write: %" WT_SIZET_FMT " at %" PRIuMAX, - fh->handle->name, len, (uintmax_t)offset)); + fh->handle->name, len, (uintmax_t)offset); + + /* + * Do a final panic check before I/O, so we stop writing as quickly as + * possible if there's an unanticipated error. We aren't handling the + * error correctly by definition, and writing won't make things better. + */ + WT_RET(WT_SESSION_CHECK_PANIC(session)); - WT_STAT_FAST_CONN_INCR_ATOMIC(session, thread_write_active); WT_STAT_FAST_CONN_INCR(session, write_io); + WT_STAT_FAST_CONN_INCR_ATOMIC(session, thread_write_active); ret = fh->handle->fh_write( fh->handle, (WT_SESSION *)session, offset, len, buf); diff --git a/src/include/os_fs.i b/src/include/os_fs.i index a3a2fe29b65..3012422f33a 100644 --- a/src/include/os_fs.i +++ b/src/include/os_fs.i @@ -22,9 +22,9 @@ __wt_fs_directory_list(WT_SESSION_IMPL *session, *dirlistp = NULL; *countp = 0; - WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, + __wt_verbose(session, WT_VERB_FILEOPS, "%s: directory-list: %s prefix %s", - dir, prefix == NULL ? "all" : prefix)); + dir, prefix == NULL ? "all" : prefix); WT_RET(__wt_filename(session, dir, &path)); @@ -72,7 +72,7 @@ __wt_fs_exist(WT_SESSION_IMPL *session, const char *name, bool *existp) WT_SESSION *wt_session; char *path; - WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: file-exist", name)); + __wt_verbose(session, WT_VERB_FILEOPS, "%s: file-exist", name); WT_RET(__wt_filename(session, name, &path)); @@ -98,7 +98,7 @@ __wt_fs_remove(WT_SESSION_IMPL *session, const char *name, bool durable) WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY)); - WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: file-remove", name)); + __wt_verbose(session, WT_VERB_FILEOPS, "%s: file-remove", name); #ifdef HAVE_DIAGNOSTIC /* @@ -136,8 +136,8 @@ __wt_fs_rename( WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY)); - WT_RET(__wt_verbose( - session, WT_VERB_FILEOPS, "%s to %s: file-rename", from, to)); + __wt_verbose( + session, WT_VERB_FILEOPS, "%s to %s: file-rename", from, to); #ifdef HAVE_DIAGNOSTIC /* @@ -178,7 +178,7 @@ __wt_fs_size(WT_SESSION_IMPL *session, const char *name, wt_off_t *sizep) WT_SESSION *wt_session; char *path; - WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: file-size", name)); + __wt_verbose(session, WT_VERB_FILEOPS, "%s: file-size", name); WT_RET(__wt_filename(session, name, &path)); diff --git a/src/include/os_fstream.i b/src/include/os_fstream.i index 92274431011..a0ac4ef8b6a 100644 --- a/src/include/os_fstream.i +++ b/src/include/os_fstream.i @@ -49,8 +49,8 @@ static inline int __wt_vfprintf( WT_SESSION_IMPL *session, WT_FSTREAM *fstr, const char *fmt, va_list ap) { - WT_RET(__wt_verbose( - session, WT_VERB_HANDLEOPS, "%s: handle-printf", fstr->name)); + __wt_verbose( + session, WT_VERB_HANDLEOPS, "%s: handle-printf", fstr->name); return (fstr->fstr_printf(session, fstr, fmt, ap)); } diff --git a/src/include/serial.i b/src/include/serial.i index 67edc1c9ce1..ddbf3c17bb8 100644 --- a/src/include/serial.i +++ b/src/include/serial.i @@ -320,7 +320,7 @@ __wt_update_serial(WT_SESSION_IMPL *session, WT_PAGE *page, return (0); obsolete = __wt_update_obsolete_check(session, page, upd->next); - WT_RET(__wt_fair_unlock(session, &page->page_lock)); + __wt_fair_unlock(session, &page->page_lock); if (obsolete != NULL) __wt_update_obsolete_free(session, page, obsolete); diff --git a/src/log/log.c b/src/log/log.c index 6ead11af438..5dedad69e19 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -25,7 +25,7 @@ static int __log_write_internal( * Record the given LSN as the checkpoint LSN and signal the archive * thread as needed. */ -int +void __wt_log_ckpt(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn) { WT_CONNECTION_IMPL *conn; @@ -35,8 +35,7 @@ __wt_log_ckpt(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn) log = conn->log; log->ckpt_lsn = *ckp_lsn; if (conn->log_cond != NULL) - WT_RET(__wt_cond_auto_signal(session, conn->log_cond)); - return (0); + __wt_cond_auto_signal(session, conn->log_cond); } /* @@ -53,7 +52,7 @@ __wt_log_flush_lsn(WT_SESSION_IMPL *session, WT_LSN *lsn, bool start) conn = S2C(session); log = conn->log; WT_RET(__wt_log_force_write(session, 1, NULL)); - WT_RET(__wt_log_wrlsn(session, NULL)); + __wt_log_wrlsn(session, NULL); if (start) *lsn = log->write_start_lsn; else @@ -66,7 +65,7 @@ __wt_log_flush_lsn(WT_SESSION_IMPL *session, WT_LSN *lsn, bool start) * Record the given LSN as the background LSN and signal the * thread as needed. */ -int +void __wt_log_background(WT_SESSION_IMPL *session, WT_LSN *lsn) { WT_CONNECTION_IMPL *conn; @@ -78,7 +77,7 @@ __wt_log_background(WT_SESSION_IMPL *session, WT_LSN *lsn) * If a thread already set the LSN to a bigger LSN, we're done. */ if (__wt_log_cmp(&session->bg_sync_lsn, lsn) > 0) - return (0); + return; session->bg_sync_lsn = *lsn; /* @@ -89,7 +88,7 @@ __wt_log_background(WT_SESSION_IMPL *session, WT_LSN *lsn) if (__wt_log_cmp(lsn, &log->bg_sync_lsn) > 0) log->bg_sync_lsn = *lsn; __wt_spin_unlock(session, &log->log_sync_lock); - return (__wt_cond_signal(session, conn->log_file_cond)); + __wt_cond_signal(session, conn->log_file_cond); } /* @@ -115,9 +114,8 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn) * log file ready to close. */ while (log->sync_lsn.l.file < min_lsn->l.file) { - WT_ERR(__wt_cond_signal(session, - S2C(session)->log_file_cond)); - WT_ERR(__wt_cond_wait(session, log->log_sync_cond, 10000)); + __wt_cond_signal(session, S2C(session)->log_file_cond); + __wt_cond_wait(session, log->log_sync_cond, 10000); } __wt_spin_lock(session, &log->log_sync_lock); WT_ASSERT(session, log->log_dir_fh != NULL); @@ -126,10 +124,10 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn) * into the directory. */ if (log->sync_dir_lsn.l.file < min_lsn->l.file) { - WT_ERR(__wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "log_force_sync: sync directory %s to LSN %" PRIu32 "/%" PRIu32, - log->log_dir_fh->name, min_lsn->l.file, min_lsn->l.offset)); + log->log_dir_fh->name, min_lsn->l.file, min_lsn->l.offset); WT_ERR(__wt_epoch(session, &fsync_start)); WT_ERR(__wt_fsync(session, log->log_dir_fh, true)); WT_ERR(__wt_epoch(session, &fsync_stop)); @@ -151,9 +149,9 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn) */ WT_ERR(__log_openfile(session, &log_fh, WT_LOG_FILENAME, min_lsn->l.file, 0)); - WT_ERR(__wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "log_force_sync: sync %s to LSN %" PRIu32 "/%" PRIu32, - log_fh->name, min_lsn->l.file, min_lsn->l.offset)); + log_fh->name, min_lsn->l.file, min_lsn->l.offset); WT_ERR(__wt_epoch(session, &fsync_start)); WT_ERR(__wt_fsync(session, log_fh, true)); WT_ERR(__wt_epoch(session, &fsync_stop)); @@ -163,7 +161,7 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn) WT_STAT_FAST_CONN_INCRV(session, log_sync_duration, fsync_duration_usecs); WT_ERR(__wt_close(session, &log_fh)); - WT_ERR(__wt_cond_signal(session, log->log_sync_cond)); + __wt_cond_signal(session, log->log_sync_cond); } err: __wt_spin_unlock(session, &log->log_sync_lock); @@ -701,8 +699,8 @@ __log_openfile(WT_SESSION_IMPL *session, allocsize = log->allocsize; WT_RET(__wt_scr_alloc(session, 0, &buf)); WT_ERR(__log_filename(session, id, file_prefix, buf)); - WT_ERR(__wt_verbose(session, WT_VERB_LOG, - "opening log %s", (const char *)buf->data)); + __wt_verbose(session, WT_VERB_LOG, + "opening log %s", (const char *)buf->data); wtopen_flags = 0; if (LF_ISSET(WT_LOG_OPEN_CREATE_OK)) FLD_SET(wtopen_flags, WT_FS_OPEN_CREATE); @@ -773,9 +771,9 @@ __log_alloc_prealloc(WT_SESSION_IMPL *session, uint32_t to_num) WT_ERR(__wt_scr_alloc(session, 0, &to_path)); WT_ERR(__log_filename(session, from_num, WT_LOG_PREPNAME, from_path)); WT_ERR(__log_filename(session, to_num, WT_LOG_FILENAME, to_path)); - WT_ERR(__wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "log_alloc_prealloc: rename log %s to %s", - (char *)from_path->data, (char *)to_path->data)); + (const char *)from_path->data, (const char *)to_path->data); WT_STAT_FAST_CONN_INCR(session, log_prealloc_used); /* * All file setup, writing the header and pre-allocation was done @@ -818,7 +816,7 @@ __log_newfile(WT_SESSION_IMPL *session, bool conn_open, bool *created) WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SLOT)); while (log->log_close_fh != NULL) { WT_STAT_FAST_CONN_INCR(session, log_close_yields); - WT_RET(__wt_log_wrlsn(session, NULL)); + __wt_log_wrlsn(session, NULL); if (++yield_cnt > 10000) return (EBUSY); __wt_yield(); @@ -859,8 +857,7 @@ __log_newfile(WT_SESSION_IMPL *session, bool conn_open, bool *created) if (create_log) { WT_STAT_FAST_CONN_INCR(session, log_prealloc_missed); if (conn->log_cond != NULL) - WT_RET(__wt_cond_auto_signal( - session, conn->log_cond)); + __wt_cond_auto_signal(session, conn->log_cond); } } /* @@ -1074,9 +1071,9 @@ __wt_log_allocfile( WT_ERR(__log_prealloc(session, log_fh)); WT_ERR(__wt_fsync(session, log_fh, true)); WT_ERR(__wt_close(session, &log_fh)); - WT_ERR(__wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "log_prealloc: rename %s to %s", - (char *)from_path->data, (char *)to_path->data)); + (const char *)from_path->data, (const char *)to_path->data); /* * Rename it into place and make it available. */ @@ -1101,8 +1098,8 @@ __wt_log_remove(WT_SESSION_IMPL *session, WT_RET(__wt_scr_alloc(session, 0, &path)); WT_ERR(__log_filename(session, lognum, file_prefix, path)); - WT_ERR(__wt_verbose(session, WT_VERB_LOG, - "log_remove: remove log %s", (char *)path->data)); + __wt_verbose(session, WT_VERB_LOG, + "log_remove: remove log %s", (const char *)path->data); WT_ERR(__wt_fs_remove(session, path->data, false)); err: __wt_scr_free(session, &path); return (ret); @@ -1136,8 +1133,8 @@ __wt_log_open(WT_SESSION_IMPL *session) * Open up a file handle to the log directory if we haven't. */ if (log->log_dir_fh == NULL) { - WT_RET(__wt_verbose(session, WT_VERB_LOG, - "log_open: open fh to directory %s", conn->log_path)); + __wt_verbose(session, WT_VERB_LOG, + "log_open: open fh to directory %s", conn->log_path); WT_RET(__wt_open(session, conn->log_path, WT_FS_OPEN_FILE_TYPE_DIRECTORY, 0, &log->log_dir_fh)); } @@ -1180,9 +1177,9 @@ __wt_log_open(WT_SESSION_IMPL *session) firstlog = WT_MIN(firstlog, lognum); } log->fileid = lastlog; - WT_ERR(__wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "log_open: first log %" PRIu32 " last log %" PRIu32, - firstlog, lastlog)); + firstlog, lastlog); if (firstlog == UINT32_MAX) { WT_ASSERT(session, logcount == 0); WT_INIT_LSN(&log->first_lsn); @@ -1225,23 +1222,23 @@ __wt_log_close(WT_SESSION_IMPL *session) log = conn->log; if (log->log_close_fh != NULL && log->log_close_fh != log->log_fh) { - WT_RET(__wt_verbose(session, WT_VERB_LOG, - "closing old log %s", log->log_close_fh->name)); + __wt_verbose(session, WT_VERB_LOG, + "closing old log %s", log->log_close_fh->name); if (!F_ISSET(conn, WT_CONN_READONLY)) WT_RET(__wt_fsync(session, log->log_close_fh, true)); WT_RET(__wt_close(session, &log->log_close_fh)); } if (log->log_fh != NULL) { - WT_RET(__wt_verbose(session, WT_VERB_LOG, - "closing log %s", log->log_fh->name)); + __wt_verbose(session, WT_VERB_LOG, + "closing log %s", log->log_fh->name); if (!F_ISSET(conn, WT_CONN_READONLY)) WT_RET(__wt_fsync(session, log->log_fh, true)); WT_RET(__wt_close(session, &log->log_fh)); log->log_fh = NULL; } if (log->log_dir_fh != NULL) { - WT_RET(__wt_verbose(session, WT_VERB_LOG, - "closing log directory %s", log->log_dir_fh->name)); + __wt_verbose(session, WT_VERB_LOG, + "closing log directory %s", log->log_dir_fh->name); if (!F_ISSET(conn, WT_CONN_READONLY)) WT_RET(__wt_fsync(session, log->log_dir_fh, true)); WT_RET(__wt_close(session, &log->log_dir_fh)); @@ -1392,28 +1389,27 @@ __wt_log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep) */ if (F_ISSET(session, WT_SESSION_LOCKED_SLOT)) __wt_spin_unlock(session, &log->log_slot_lock); - WT_ERR(__wt_cond_auto_signal(session, conn->log_wrlsn_cond)); + __wt_cond_auto_signal(session, conn->log_wrlsn_cond); if (++yield_count < WT_THOUSAND) __wt_yield(); else - ret = __wt_cond_wait(session, log->log_write_cond, 200); + __wt_cond_wait(session, log->log_write_cond, 200); if (F_ISSET(session, WT_SESSION_LOCKED_SLOT)) __wt_spin_lock(session, &log->log_slot_lock); - WT_ERR(ret); } log->write_start_lsn = slot->slot_start_lsn; log->write_lsn = slot->slot_end_lsn; WT_ASSERT(session, slot != log->active_slot); - WT_ERR(__wt_cond_signal(session, log->log_write_cond)); + __wt_cond_signal(session, log->log_write_cond); F_CLR(slot, WT_SLOT_FLUSH); /* * Signal the close thread if needed. */ if (F_ISSET(slot, WT_SLOT_CLOSEFH)) - WT_ERR(__wt_cond_signal(session, conn->log_file_cond)); + __wt_cond_signal(session, conn->log_file_cond); /* * Try to consolidate calls to fsync to wait less. Acquire a spin lock @@ -1428,8 +1424,7 @@ __wt_log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep) */ if (log->sync_lsn.l.file < slot->slot_end_lsn.l.file || __wt_spin_trylock(session, &log->log_sync_lock) != 0) { - WT_ERR(__wt_cond_wait( - session, log->log_sync_cond, 10000)); + __wt_cond_wait(session, log->log_sync_cond, 10000); continue; } locked = true; @@ -1448,11 +1443,11 @@ __wt_log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep) if (F_ISSET(slot, WT_SLOT_SYNC_DIR) && (log->sync_dir_lsn.l.file < sync_lsn.l.file)) { WT_ASSERT(session, log->log_dir_fh != NULL); - WT_ERR(__wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "log_release: sync directory %s to LSN %" PRIu32 "/%" PRIu32, log->log_dir_fh->name, - sync_lsn.l.file, sync_lsn.l.offset)); + sync_lsn.l.file, sync_lsn.l.offset); WT_ERR(__wt_epoch(session, &fsync_start)); WT_ERR(__wt_fsync(session, log->log_dir_fh, true)); WT_ERR(__wt_epoch(session, &fsync_stop)); @@ -1469,11 +1464,11 @@ __wt_log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep) */ if (F_ISSET(slot, WT_SLOT_SYNC) && __wt_log_cmp(&log->sync_lsn, &slot->slot_end_lsn) < 0) { - WT_ERR(__wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "log_release: sync log %s to LSN %" PRIu32 "/%" PRIu32, log->log_fh->name, - sync_lsn.l.file, sync_lsn.l.offset)); + sync_lsn.l.file, sync_lsn.l.offset); WT_STAT_FAST_CONN_INCR(session, log_sync); WT_ERR(__wt_epoch(session, &fsync_start)); WT_ERR(__wt_fsync(session, log->log_fh, true)); @@ -1483,7 +1478,7 @@ __wt_log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep) WT_STAT_FAST_CONN_INCRV(session, log_sync_duration, fsync_duration_usecs); log->sync_lsn = sync_lsn; - WT_ERR(__wt_cond_signal(session, log->log_sync_cond)); + __wt_cond_signal(session, log->log_sync_cond); } /* * Clear the flags before leaving the loop. @@ -1543,9 +1538,9 @@ __wt_log_scan(WT_SESSION_IMPL *session, WT_LSN *lsnp, uint32_t flags, return (0); if (LF_ISSET(WT_LOGSCAN_RECOVER)) - WT_RET(__wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "__wt_log_scan truncating to %" PRIu32 "/%" PRIu32, - log->trunc_lsn.l.file, log->trunc_lsn.l.offset)); + log->trunc_lsn.l.file, log->trunc_lsn.l.offset); if (log != NULL) { allocsize = log->allocsize; @@ -2093,7 +2088,7 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, * XXX I've seen times when conditions are NULL. */ if (conn->log_cond != NULL) { - WT_ERR(__wt_cond_auto_signal(session, conn->log_cond)); + __wt_cond_auto_signal(session, conn->log_cond); __wt_yield(); } else WT_ERR(__wt_log_force_write(session, 1, NULL)); @@ -2102,21 +2097,19 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, /* Wait for our writes to reach the OS */ while (__wt_log_cmp(&log->write_lsn, &lsn) <= 0 && myslot.slot->slot_error == 0) - (void)__wt_cond_wait( - session, log->log_write_cond, 10000); + __wt_cond_wait(session, log->log_write_cond, 10000); } else if (LF_ISSET(WT_LOG_FSYNC)) { /* Wait for our writes to reach disk */ while (__wt_log_cmp(&log->sync_lsn, &lsn) <= 0 && myslot.slot->slot_error == 0) - (void)__wt_cond_wait( - session, log->log_sync_cond, 10000); + __wt_cond_wait(session, log->log_sync_cond, 10000); } /* * Advance the background sync LSN if needed. */ if (LF_ISSET(WT_LOG_BACKGROUND)) - WT_ERR(__wt_log_background(session, &lsn)); + __wt_log_background(session, &lsn); err: if (ret == 0 && lsnp != NULL) @@ -2184,8 +2177,8 @@ __wt_log_vprintf(WT_SESSION_IMPL *session, const char *fmt, va_list ap) (void)vsnprintf((char *)logrec->data + logrec->size, len, fmt, ap); - WT_ERR(__wt_verbose(session, WT_VERB_LOG, - "log_printf: %s", (char *)logrec->data + logrec->size)); + __wt_verbose(session, WT_VERB_LOG, + "log_printf: %s", (char *)logrec->data + logrec->size); logrec->size += len; WT_ERR(__wt_log_write(session, logrec, NULL, 0)); @@ -2231,16 +2224,16 @@ __wt_log_flush(WT_SESSION_IMPL *session, uint32_t flags) while (__wt_log_cmp(&last_lsn, &lsn) > 0) WT_RET(__wt_log_flush_lsn(session, &lsn, false)); - WT_RET(__wt_verbose(session, WT_VERB_LOG, + __wt_verbose(session, WT_VERB_LOG, "log_flush: flags %#" PRIx32 " LSN %" PRIu32 "/%" PRIu32, - flags, lsn.l.file, lsn.l.offset)); + flags, lsn.l.file, lsn.l.offset); /* * If the user wants write-no-sync, there is nothing more to do. * If the user wants background sync, set the LSN and we're done. * If the user wants sync, force it now. */ if (LF_ISSET(WT_LOG_BACKGROUND)) - WT_RET(__wt_log_background(session, &lsn)); + __wt_log_background(session, &lsn); else if (LF_ISSET(WT_LOG_FSYNC)) WT_RET(__wt_log_force_sync(session, &lsn)); return (0); diff --git a/src/log/log_slot.c b/src/log/log_slot.c index 578085eb9be..58377aff6f5 100644 --- a/src/log/log_slot.c +++ b/src/log/log_slot.c @@ -262,7 +262,7 @@ __wt_log_slot_new(WT_SESSION_IMPL *session) /* * If we didn't find any free slots signal the worker thread. */ - WT_RET(__wt_cond_auto_signal(session, conn->log_wrlsn_cond)); + __wt_cond_auto_signal(session, conn->log_wrlsn_cond); __wt_yield(); } /* NOTREACHED */ diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c index bedef6a8596..78d77884d40 100644 --- a/src/lsm/lsm_cursor.c +++ b/src/lsm/lsm_cursor.c @@ -40,7 +40,7 @@ __wt_clsm_request_switch(WT_CURSOR_LSM *clsm) * to switching multiple times when only one switch is * required, creating very small chunks. */ - WT_RET(__wt_lsm_tree_readlock(session, lsm_tree)); + __wt_lsm_tree_readlock(session, lsm_tree); if (lsm_tree->nchunks == 0 || (clsm->dsk_gen == lsm_tree->dsk_gen && !F_ISSET(lsm_tree, WT_LSM_TREE_NEED_SWITCH))) { @@ -48,7 +48,7 @@ __wt_clsm_request_switch(WT_CURSOR_LSM *clsm) ret = __wt_lsm_manager_push_entry( session, WT_LSM_WORK_SWITCH, 0, lsm_tree); } - WT_TRET(__wt_lsm_tree_readunlock(session, lsm_tree)); + __wt_lsm_tree_readunlock(session, lsm_tree); } return (ret); @@ -458,7 +458,7 @@ __clsm_open_cursors( F_CLR(clsm, WT_CLSM_ITERATE_NEXT | WT_CLSM_ITERATE_PREV); - WT_RET(__wt_lsm_tree_readlock(session, lsm_tree)); + __wt_lsm_tree_readlock(session, lsm_tree); locked = true; /* Merge cursors have already figured out how many chunks they need. */ @@ -577,10 +577,10 @@ retry: if (F_ISSET(clsm, WT_CLSM_MERGE)) { if (close_range_end > close_range_start) { saved_gen = lsm_tree->dsk_gen; locked = false; - WT_ERR(__wt_lsm_tree_readunlock(session, lsm_tree)); + __wt_lsm_tree_readunlock(session, lsm_tree); WT_ERR(__clsm_close_cursors( clsm, close_range_start, close_range_end)); - WT_ERR(__wt_lsm_tree_readlock(session, lsm_tree)); + __wt_lsm_tree_readlock(session, lsm_tree); locked = true; if (lsm_tree->dsk_gen != saved_gen) goto retry; @@ -698,7 +698,7 @@ err: } #endif if (locked) - WT_TRET(__wt_lsm_tree_readunlock(session, lsm_tree)); + __wt_lsm_tree_readunlock(session, lsm_tree); return (ret); } diff --git a/src/lsm/lsm_manager.c b/src/lsm/lsm_manager.c index 943a5894ab3..bafab9abaa3 100644 --- a/src/lsm/lsm_manager.c +++ b/src/lsm/lsm_manager.c @@ -358,7 +358,7 @@ __lsm_manager_worker_shutdown(WT_SESSION_IMPL *session) */ for (i = 1; i < manager->lsm_workers; i++) { WT_ASSERT(session, manager->lsm_worker_cookies[i].tid != 0); - WT_TRET(__wt_cond_signal(session, manager->work_cond)); + __wt_cond_signal(session, manager->work_cond); WT_TRET(__wt_thread_join( session, manager->lsm_worker_cookies[i].tid)); } @@ -431,7 +431,7 @@ __lsm_manager_run_server(WT_SESSION_IMPL *session) session, WT_LSM_WORK_FLUSH, 0, lsm_tree)); WT_ERR(__wt_lsm_manager_push_entry( session, WT_LSM_WORK_BLOOM, 0, lsm_tree)); - WT_ERR(__wt_verbose(session, + __wt_verbose(session, WT_VERB_LSM_MANAGER, "MGR %s: queue %" PRIu32 " mod %d " "nchunks %" PRIu32 @@ -442,7 +442,7 @@ __lsm_manager_run_server(WT_SESSION_IMPL *session) lsm_tree->modified, lsm_tree->nchunks, lsm_tree->flags, lsm_tree->merge_aggressiveness, - pushms, fillms)); + pushms, fillms); WT_ERR(__wt_lsm_manager_push_entry( session, WT_LSM_WORK_MERGE, 0, lsm_tree)); } @@ -617,10 +617,8 @@ int __wt_lsm_manager_push_entry(WT_SESSION_IMPL *session, uint32_t type, uint32_t flags, WT_LSM_TREE *lsm_tree) { - WT_DECL_RET; WT_LSM_MANAGER *manager; WT_LSM_WORK_UNIT *entry; - bool pushed; manager = &S2C(session)->lsm_manager; @@ -655,9 +653,8 @@ __wt_lsm_manager_push_entry(WT_SESSION_IMPL *session, return (0); } - pushed = false; - WT_ERR(__wt_epoch(session, &lsm_tree->work_push_ts)); - WT_ERR(__wt_calloc_one(session, &entry)); + WT_RET(__wt_epoch(session, &lsm_tree->work_push_ts)); + WT_RET(__wt_calloc_one(session, &entry)); entry->type = type; entry->flags = flags; entry->lsm_tree = lsm_tree; @@ -672,12 +669,7 @@ __wt_lsm_manager_push_entry(WT_SESSION_IMPL *session, else LSM_PUSH_ENTRY(&manager->appqh, &manager->app_lock, lsm_work_queue_app); - pushed = true; - WT_ERR(__wt_cond_signal(session, manager->work_cond)); + __wt_cond_signal(session, manager->work_cond); return (0); -err: - if (!pushed) - (void)__wt_atomic_sub32(&lsm_tree->queue_ref, 1); - return (ret); } diff --git a/src/lsm/lsm_merge.c b/src/lsm/lsm_merge.c index 1ff0a216c02..64f40cc9eff 100644 --- a/src/lsm/lsm_merge.c +++ b/src/lsm/lsm_merge.c @@ -124,13 +124,13 @@ __lsm_merge_aggressive_update(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) ++new_aggressive; if (new_aggressive > lsm_tree->merge_aggressiveness) { - WT_RET(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "LSM merge %s got aggressive " "(old %" PRIu32 " new %" PRIu32 "), " "merge_min %u, %" PRIu64 " / %" PRIu64, lsm_tree->name, lsm_tree->merge_aggressiveness, new_aggressive, lsm_tree->merge_min, - msec_since_last_merge, lsm_tree->chunk_fill_ms)); + msec_since_last_merge, lsm_tree->chunk_fill_ms); lsm_tree->merge_aggressiveness = new_aggressive; } return (0); @@ -372,7 +372,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id) * avoid holding it while the merge is in progress: that may take a * long time. */ - WT_RET(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); locked = true; WT_ERR(__lsm_merge_span(session, @@ -387,7 +387,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id) generation = WT_MAX(generation, lsm_tree->chunk[start_chunk + i]->generation + 1); - WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); locked = false; /* Allocate an ID for the merge. */ @@ -399,20 +399,20 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id) * in the normal path. */ if (WT_VERBOSE_ISSET(session, WT_VERB_LSM)) { - WT_ERR(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "Merging %s chunks %u-%u into %u (%" PRIu64 " records)" ", generation %" PRIu32, lsm_tree->name, - start_chunk, end_chunk, dest_id, record_count, generation)); + start_chunk, end_chunk, dest_id, record_count, generation); for (verb = start_chunk; verb <= end_chunk; verb++) - WT_ERR(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "Merging %s: Chunk[%u] id %" PRIu32 ", gen: %" PRIu32 ", size: %" PRIu64 ", records: %" PRIu64, lsm_tree->name, verb, lsm_tree->chunk[verb]->id, lsm_tree->chunk[verb]->generation, lsm_tree->chunk[verb]->size, - lsm_tree->chunk[verb]->count)); + lsm_tree->chunk[verb]->count); } WT_ERR(__wt_calloc_one(session, &chunk)); @@ -478,9 +478,9 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id) WT_STAT_FAST_CONN_INCRV(session, lsm_rows_merged, insert_count % LSM_MERGE_CHECK_INTERVAL); ++lsm_tree->merge_progressing; - WT_ERR(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "Bloom size for %" PRIu64 " has %" PRIu64 " items inserted", - record_count, insert_count)); + record_count, insert_count); /* * Closing and syncing the files can take a while. Set the @@ -543,7 +543,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id) WT_ERR_NOTFOUND_OK(ret); WT_ERR(__wt_lsm_tree_set_chunk_size(session, chunk)); - WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); locked = true; /* @@ -592,7 +592,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id) session, WT_LSM_WORK_DROP, 0, lsm_tree)); err: if (locked) - WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); if (in_sync) (void)__wt_atomic_sub32(&lsm_tree->merge_syncing, 1); if (src != NULL) @@ -620,12 +620,12 @@ err: if (locked) __wt_free(session, chunk); if (ret == EINTR) - WT_TRET(__wt_verbose(session, WT_VERB_LSM, - "Merge aborted due to close")); + __wt_verbose(session, WT_VERB_LSM, + "Merge aborted due to close"); else - WT_TRET(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "Merge failed with %s", - __wt_strerror(session, ret, NULL, 0))); + __wt_strerror(session, ret, NULL, 0)); } F_CLR(session, WT_SESSION_NO_CACHE | WT_SESSION_NO_EVICTION); return (ret); diff --git a/src/lsm/lsm_stat.c b/src/lsm/lsm_stat.c index 76e2ca6185e..95909ce30e8 100644 --- a/src/lsm/lsm_stat.c +++ b/src/lsm/lsm_stat.c @@ -51,7 +51,7 @@ __curstat_lsm_init( } /* Hold the LSM lock so that we can safely walk through the chunks. */ - WT_ERR(__wt_lsm_tree_readlock(session, lsm_tree)); + __wt_lsm_tree_readlock(session, lsm_tree); locked = true; /* @@ -155,7 +155,7 @@ __curstat_lsm_init( __wt_curstat_dsrc_final(cst); err: if (locked) - WT_TRET(__wt_lsm_tree_readunlock(session, lsm_tree)); + __wt_lsm_tree_readunlock(session, lsm_tree); __wt_lsm_tree_release(session, lsm_tree); __wt_scr_free(session, &uribuf); diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c index a684a633fff..c84f5c519cf 100644 --- a/src/lsm/lsm_tree.c +++ b/src/lsm/lsm_tree.c @@ -55,7 +55,7 @@ __lsm_tree_discard(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, bool final) __wt_free(session, lsm_tree->bloom_config); __wt_free(session, lsm_tree->file_config); - WT_TRET(__wt_rwlock_destroy(session, &lsm_tree->rwlock)); + __wt_rwlock_destroy(session, &lsm_tree->rwlock); for (i = 0; i < lsm_tree->nchunks; i++) { if ((chunk = lsm_tree->chunk[i]) == NULL) @@ -730,7 +730,7 @@ __wt_lsm_tree_switch(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) uint32_t chunks_moved, nchunks, new_id; bool first_switch; - WT_RET(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); nchunks = lsm_tree->nchunks; @@ -755,10 +755,10 @@ __wt_lsm_tree_switch(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) WT_ERR(__wt_realloc_def(session, &lsm_tree->chunk_alloc, nchunks + 1, &lsm_tree->chunk)); - WT_ERR(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "Tree %s switch to: %" PRIu32 ", checkpoint throttle %" PRIu64 ", merge throttle %" PRIu64, lsm_tree->name, - new_id, lsm_tree->ckpt_throttle, lsm_tree->merge_throttle)); + new_id, lsm_tree->ckpt_throttle, lsm_tree->merge_throttle); WT_ERR(__wt_calloc_one(session, &chunk)); chunk->id = new_id; @@ -811,7 +811,7 @@ __wt_lsm_tree_switch(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) session, WT_LSM_WORK_DROP, 0, lsm_tree)); } -err: WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree)); +err: __wt_lsm_tree_writeunlock(session, lsm_tree); /* * Errors that happen during a tree switch leave the tree in a state * where we can't make progress. Error out of WiredTiger. @@ -874,7 +874,7 @@ __wt_lsm_tree_drop( WT_ASSERT(session, !lsm_tree->active); /* Prevent any new opens. */ - WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); locked = true; /* Drop the chunks. */ @@ -897,12 +897,12 @@ __wt_lsm_tree_drop( } locked = false; - WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); ret = __wt_metadata_remove(session, name); WT_ASSERT(session, !lsm_tree->active); err: if (locked) - WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); WT_WITH_HANDLE_LIST_LOCK(session, tret = __lsm_tree_discard(session, lsm_tree, false)); WT_TRET(tret); @@ -934,7 +934,7 @@ __wt_lsm_tree_rename(WT_SESSION_IMPL *session, WT_RET(ret); /* Prevent any new opens. */ - WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); locked = true; /* Set the new name. */ @@ -965,11 +965,11 @@ __wt_lsm_tree_rename(WT_SESSION_IMPL *session, WT_ERR(__wt_lsm_meta_write(session, lsm_tree)); locked = false; - WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); WT_ERR(__wt_metadata_remove(session, olduri)); err: if (locked) - WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); __wt_free(session, old); /* @@ -1006,7 +1006,7 @@ __wt_lsm_tree_truncate( WT_RET(ret); /* Prevent any new opens. */ - WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); locked = true; /* Create the new chunk. */ @@ -1021,11 +1021,11 @@ __wt_lsm_tree_truncate( WT_ERR(__wt_lsm_meta_write(session, lsm_tree)); locked = false; - WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); __wt_lsm_tree_release(session, lsm_tree); err: if (locked) - WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); if (ret != 0) { if (chunk != NULL) { WT_TRET(__wt_schema_drop(session, chunk->uri, NULL)); @@ -1048,66 +1048,56 @@ err: if (locked) * __wt_lsm_tree_readlock -- * Acquire a shared lock on an LSM tree. */ -int +void __wt_lsm_tree_readlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) { - WT_RET(__wt_readlock(session, lsm_tree->rwlock)); + __wt_readlock(session, lsm_tree->rwlock); /* * Diagnostic: avoid deadlocks with the schema lock: if we need it for * an operation, we should already have it. */ F_SET(session, WT_SESSION_NO_EVICTION | WT_SESSION_NO_SCHEMA_LOCK); - return (0); } /* * __wt_lsm_tree_readunlock -- * Release a shared lock on an LSM tree. */ -int +void __wt_lsm_tree_readunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) { - WT_DECL_RET; - F_CLR(session, WT_SESSION_NO_EVICTION | WT_SESSION_NO_SCHEMA_LOCK); - if ((ret = __wt_readunlock(session, lsm_tree->rwlock)) != 0) - WT_PANIC_RET(session, ret, "Unlocking an LSM tree"); - return (0); + __wt_readunlock(session, lsm_tree->rwlock); } /* * __wt_lsm_tree_writelock -- * Acquire an exclusive lock on an LSM tree. */ -int +void __wt_lsm_tree_writelock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) { - WT_RET(__wt_writelock(session, lsm_tree->rwlock)); + __wt_writelock(session, lsm_tree->rwlock); /* * Diagnostic: avoid deadlocks with the schema lock: if we need it for * an operation, we should already have it. */ F_SET(session, WT_SESSION_NO_EVICTION | WT_SESSION_NO_SCHEMA_LOCK); - return (0); } /* * __wt_lsm_tree_writeunlock -- * Release an exclusive lock on an LSM tree. */ -int +void __wt_lsm_tree_writeunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) { - WT_DECL_RET; - F_CLR(session, WT_SESSION_NO_EVICTION | WT_SESSION_NO_SCHEMA_LOCK); - if ((ret = __wt_writeunlock(session, lsm_tree->rwlock)) != 0) - WT_PANIC_RET(session, ret, "Unlocking an LSM tree"); - return (0); + __wt_writeunlock(session, lsm_tree->rwlock); } /* @@ -1173,7 +1163,7 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, bool *skipp) */ /* Lock the tree: single-thread compaction. */ - WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); locked = true; /* Clear any merge throttle: compact throws out that calculation. */ @@ -1210,13 +1200,13 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, bool *skipp) } locked = false; - WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); if (chunk != NULL) { - WT_ERR(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "Compact force flush %s flags 0x%" PRIx32 " chunk %" PRIu32 " flags 0x%" PRIx32, - name, lsm_tree->flags, chunk->id, chunk->flags)); + name, lsm_tree->flags, chunk->id, chunk->flags); flushing = true; /* * Make sure the in-memory chunk gets flushed do not push a @@ -1233,8 +1223,8 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, bool *skipp) compacting = true; progress = lsm_tree->merge_progressing; F_SET(lsm_tree, WT_LSM_TREE_COMPACTING); - WT_ERR(__wt_verbose(session, WT_VERB_LSM, - "COMPACT: Start compacting %s", lsm_tree->name)); + __wt_verbose(session, WT_VERB_LSM, + "COMPACT: Start compacting %s", lsm_tree->name); } /* Wait for the work unit queues to drain. */ @@ -1247,21 +1237,21 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, bool *skipp) if (flushing) { WT_ASSERT(session, chunk != NULL); if (F_ISSET(chunk, WT_LSM_CHUNK_ONDISK)) { - WT_ERR(__wt_verbose(session, + __wt_verbose(session, WT_VERB_LSM, "Compact flush done %s chunk %" PRIu32 ". " "Start compacting progress %" PRIu64, name, chunk->id, - lsm_tree->merge_progressing)); + lsm_tree->merge_progressing); (void)__wt_atomic_sub32(&chunk->refcnt, 1); flushing = ref = false; compacting = true; F_SET(lsm_tree, WT_LSM_TREE_COMPACTING); progress = lsm_tree->merge_progressing; } else { - WT_ERR(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "Compact flush retry %s chunk %" PRIu32, - name, chunk->id)); + name, chunk->id); WT_ERR(__wt_lsm_manager_push_entry(session, WT_LSM_WORK_FLUSH, WT_LSM_WORK_FORCE, lsm_tree)); @@ -1313,10 +1303,10 @@ err: lsm_tree->merge_aggressiveness = 0; } if (locked) - WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); - WT_TRET(__wt_verbose(session, WT_VERB_LSM, - "Compact %s complete, return %d", name, ret)); + __wt_verbose(session, WT_VERB_LSM, + "Compact %s complete, return %d", name, ret); __wt_lsm_tree_release(session, lsm_tree); return (ret); @@ -1350,9 +1340,10 @@ __wt_lsm_tree_worker(WT_SESSION_IMPL *session, * with merges so that merging doesn't change the chunk * array out from underneath us. */ - WT_ERR(exclusive ? - __wt_lsm_tree_writelock(session, lsm_tree) : - __wt_lsm_tree_readlock(session, lsm_tree)); + if (exclusive) + __wt_lsm_tree_writelock(session, lsm_tree); + else + __wt_lsm_tree_readlock(session, lsm_tree); locked = true; for (i = 0; i < lsm_tree->nchunks; i++) { chunk = lsm_tree->chunk[i]; @@ -1371,10 +1362,12 @@ __wt_lsm_tree_worker(WT_SESSION_IMPL *session, WT_ERR(__wt_schema_worker(session, chunk->bloom_uri, file_func, name_func, cfg, open_flags)); } -err: if (locked) - WT_TRET(exclusive ? - __wt_lsm_tree_writeunlock(session, lsm_tree) : - __wt_lsm_tree_readunlock(session, lsm_tree)); +err: if (locked) { + if (exclusive) + __wt_lsm_tree_writeunlock(session, lsm_tree); + else + __wt_lsm_tree_readunlock(session, lsm_tree); + } __wt_lsm_tree_release(session, lsm_tree); return (ret); } diff --git a/src/lsm/lsm_work_unit.c b/src/lsm/lsm_work_unit.c index 0f2a407c70d..bfca09b3807 100644 --- a/src/lsm/lsm_work_unit.c +++ b/src/lsm/lsm_work_unit.c @@ -28,9 +28,11 @@ __lsm_copy_chunks(WT_SESSION_IMPL *session, /* Always return zero chunks on error. */ cookie->nchunks = 0; - WT_RET(__wt_lsm_tree_readlock(session, lsm_tree)); - if (!lsm_tree->active) - return (__wt_lsm_tree_readunlock(session, lsm_tree)); + __wt_lsm_tree_readlock(session, lsm_tree); + if (!lsm_tree->active) { + __wt_lsm_tree_readunlock(session, lsm_tree); + return (0); + } /* Take a copy of the current state of the LSM tree. */ nchunks = old_chunks ? lsm_tree->nold_chunks : lsm_tree->nchunks; @@ -55,7 +57,7 @@ __lsm_copy_chunks(WT_SESSION_IMPL *session, for (i = 0; i < nchunks; i++) (void)__wt_atomic_add32(&cookie->chunk_array[i]->refcnt, 1); -err: WT_TRET(__wt_lsm_tree_readunlock(session, lsm_tree)); +err: __wt_lsm_tree_readunlock(session, lsm_tree); if (ret == 0) cookie->nchunks = nchunks; @@ -78,9 +80,11 @@ __wt_lsm_get_chunk_to_flush(WT_SESSION_IMPL *session, chunk = evict_chunk = flush_chunk = NULL; WT_ASSERT(session, lsm_tree->queue_ref > 0); - WT_RET(__wt_lsm_tree_readlock(session, lsm_tree)); - if (!lsm_tree->active || lsm_tree->nchunks == 0) - return (__wt_lsm_tree_readunlock(session, lsm_tree)); + __wt_lsm_tree_readlock(session, lsm_tree); + if (!lsm_tree->active || lsm_tree->nchunks == 0) { + __wt_lsm_tree_readunlock(session, lsm_tree); + return (0); + } /* Search for a chunk to evict and/or a chunk to flush. */ for (i = 0; i < lsm_tree->nchunks; i++) { @@ -117,15 +121,15 @@ __wt_lsm_get_chunk_to_flush(WT_SESSION_IMPL *session, chunk = (evict_chunk != NULL) ? evict_chunk : flush_chunk; if (chunk != NULL) { - WT_ERR(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "Flush%s: return chunk %" PRIu32 " of %" PRIu32 ": %s", force ? " w/ force" : "", - i, lsm_tree->nchunks, chunk->uri)); + i, lsm_tree->nchunks, chunk->uri); (void)__wt_atomic_add32(&chunk->refcnt, 1); } -err: WT_RET(__wt_lsm_tree_readunlock(session, lsm_tree)); +err: __wt_lsm_tree_readunlock(session, lsm_tree); *chunkp = chunk; return (ret); @@ -282,9 +286,9 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session, WT_RET_MSG(session, ret, "discard handle"); } if (F_ISSET(chunk, WT_LSM_CHUNK_ONDISK)) { - WT_RET(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "LSM worker %s already on disk", - chunk->uri)); + chunk->uri); return (0); } @@ -293,9 +297,9 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session, session, WT_TXN_OLDEST_STRICT | WT_TXN_OLDEST_WAIT)); if (chunk->switch_txn == WT_TXN_NONE || !__wt_txn_visible_all(session, chunk->switch_txn)) { - WT_RET(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "LSM worker %s: running transaction, return", - chunk->uri)); + chunk->uri); return (0); } @@ -303,8 +307,8 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session, return (0); flush_set = true; - WT_ERR(__wt_verbose(session, WT_VERB_LSM, "LSM worker flushing %s", - chunk->uri)); + __wt_verbose(session, WT_VERB_LSM, "LSM worker flushing %s", + chunk->uri); /* * Flush the file before checkpointing: this is the expensive part in @@ -329,8 +333,8 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session, } WT_ERR(ret); - WT_ERR(__wt_verbose(session, WT_VERB_LSM, "LSM worker checkpointing %s", - chunk->uri)); + __wt_verbose(session, WT_VERB_LSM, "LSM worker checkpointing %s", + chunk->uri); /* * Turn on metadata tracking to ensure the checkpoint gets the @@ -358,14 +362,14 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session, ++lsm_tree->chunks_flushed; /* Lock the tree, mark the chunk as on disk and update the metadata. */ - WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); F_SET(chunk, WT_LSM_CHUNK_ONDISK); ret = __wt_lsm_meta_write(session, lsm_tree); ++lsm_tree->dsk_gen; /* Update the throttle time. */ __wt_lsm_tree_throttle(session, lsm_tree, true); - WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); if (ret != 0) WT_ERR_MSG(session, ret, "LSM metadata write"); @@ -385,8 +389,8 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session, /* Make sure we aren't pinning a transaction ID. */ __wt_txn_release_snapshot(session); - WT_ERR(__wt_verbose(session, WT_VERB_LSM, "LSM worker checkpointed %s", - chunk->uri)); + __wt_verbose(session, WT_VERB_LSM, "LSM worker checkpointed %s", + chunk->uri); /* Schedule a bloom filter create for our newly flushed chunk. */ if (!FLD_ISSET(lsm_tree->bloom, WT_LSM_BLOOM_OFF)) @@ -457,17 +461,17 @@ __lsm_bloom_create(WT_SESSION_IMPL *session, WT_CLEAR(key); WT_ERR_NOTFOUND_OK(__wt_bloom_get(bloom, &key)); - WT_ERR(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "LSM worker created bloom filter %s. " "Expected %" PRIu64 " items, got %" PRIu64, - chunk->bloom_uri, chunk->count, insert_count)); + chunk->bloom_uri, chunk->count, insert_count); /* Ensure the bloom filter is in the metadata. */ - WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); F_SET(chunk, WT_LSM_CHUNK_BLOOM); ret = __wt_lsm_meta_write(session, lsm_tree); ++lsm_tree->dsk_gen; - WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); if (ret != 0) WT_ERR_MSG(session, ret, "LSM bloom worker metadata write"); @@ -527,11 +531,11 @@ __lsm_drop_file(WT_SESSION_IMPL *session, const char *uri) if (ret == 0) ret = __wt_fs_remove(session, uri + strlen("file:"), false); - WT_RET(__wt_verbose(session, WT_VERB_LSM, "Dropped %s", uri)); + __wt_verbose(session, WT_VERB_LSM, "Dropped %s", uri); if (ret == EBUSY || ret == ENOENT) - WT_RET(__wt_verbose(session, WT_VERB_LSM, - "LSM worker drop of %s failed with %d", uri, ret)); + __wt_verbose(session, WT_VERB_LSM, + "LSM worker drop of %s failed with %d", uri, ret); return (ret); } @@ -623,7 +627,7 @@ __wt_lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) } /* Lock the tree to clear out the old chunk information. */ - WT_ERR(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); /* * The chunk we are looking at should be the first one in the @@ -643,7 +647,7 @@ __wt_lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) lsm_tree->old_chunks[lsm_tree->nold_chunks] = NULL; } - WT_ERR(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); /* * Clear the chunk in the cookie so we don't attempt to @@ -654,9 +658,9 @@ __wt_lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) err: /* Flush the metadata unless the system is in panic */ if (flush_metadata && ret != WT_PANIC) { - WT_TRET(__wt_lsm_tree_writelock(session, lsm_tree)); + __wt_lsm_tree_writelock(session, lsm_tree); WT_TRET(__wt_lsm_meta_write(session, lsm_tree)); - WT_TRET(__wt_lsm_tree_writeunlock(session, lsm_tree)); + __wt_lsm_tree_writeunlock(session, lsm_tree); } __lsm_unpin_chunks(session, &cookie); __wt_free(session, cookie.chunk_array); diff --git a/src/lsm/lsm_worker.c b/src/lsm/lsm_worker.c index 0874da8db13..b0d0758775d 100644 --- a/src/lsm/lsm_worker.c +++ b/src/lsm/lsm_worker.c @@ -19,8 +19,8 @@ static WT_THREAD_RET __lsm_worker(void *); int __wt_lsm_worker_start(WT_SESSION_IMPL *session, WT_LSM_WORKER_ARGS *args) { - WT_RET(__wt_verbose(session, WT_VERB_LSM_MANAGER, - "Start LSM worker %u type %#" PRIx32, args->id, args->type)); + __wt_verbose(session, WT_VERB_LSM_MANAGER, + "Start LSM worker %u type %#" PRIx32, args->id, args->type); return (__wt_thread_create(session, &args->tid, __lsm_worker, args)); } @@ -58,9 +58,9 @@ __lsm_worker_general_op( * If we got a chunk to flush, checkpoint it. */ if (chunk != NULL) { - WT_ERR(__wt_verbose(session, WT_VERB_LSM, + __wt_verbose(session, WT_VERB_LSM, "Flush%s chunk %" PRIu32 " %s", - force ? " w/ force" : "", chunk->id, chunk->uri)); + force ? " w/ force" : "", chunk->id, chunk->uri); ret = __wt_lsm_checkpoint_chunk( session, entry->lsm_tree, chunk); WT_ASSERT(session, chunk->refcnt > 0); @@ -154,8 +154,7 @@ __lsm_worker(void *arg) /* Don't busy wait if there was any work to do. */ if (!progress) { - WT_ERR( - __wt_cond_wait(session, cookie->work_cond, 10000)); + __wt_cond_wait(session, cookie->work_cond, 10000); continue; } } diff --git a/src/meta/meta_table.c b/src/meta/meta_table.c index d39df163daf..58842c756d1 100644 --- a/src/meta/meta_table.c +++ b/src/meta/meta_table.c @@ -159,10 +159,10 @@ __wt_metadata_insert( WT_CURSOR *cursor; WT_DECL_RET; - WT_RET(__wt_verbose(session, WT_VERB_METADATA, + __wt_verbose(session, WT_VERB_METADATA, "Insert: key: %s, value: %s, tracking: %s, %s" "turtle", key, value, WT_META_TRACKING(session) ? "true" : "false", - __metadata_turtle(key) ? "" : "not ")); + __metadata_turtle(key) ? "" : "not "); if (__metadata_turtle(key)) WT_RET_MSG(session, EINVAL, @@ -189,10 +189,10 @@ __wt_metadata_update( WT_CURSOR *cursor; WT_DECL_RET; - WT_RET(__wt_verbose(session, WT_VERB_METADATA, + __wt_verbose(session, WT_VERB_METADATA, "Update: key: %s, value: %s, tracking: %s, %s" "turtle", key, value, WT_META_TRACKING(session) ? "true" : "false", - __metadata_turtle(key) ? "" : "not ")); + __metadata_turtle(key) ? "" : "not "); if (__metadata_turtle(key)) { WT_WITH_TURTLE_LOCK(session, ret, @@ -224,10 +224,10 @@ __wt_metadata_remove(WT_SESSION_IMPL *session, const char *key) WT_CURSOR *cursor; WT_DECL_RET; - WT_RET(__wt_verbose(session, WT_VERB_METADATA, + __wt_verbose(session, WT_VERB_METADATA, "Remove: key: %s, tracking: %s, %s" "turtle", key, WT_META_TRACKING(session) ? "true" : "false", - __metadata_turtle(key) ? "" : "not ")); + __metadata_turtle(key) ? "" : "not "); if (__metadata_turtle(key)) WT_RET_MSG(session, EINVAL, @@ -257,10 +257,10 @@ __wt_metadata_search(WT_SESSION_IMPL *session, const char *key, char **valuep) *valuep = NULL; - WT_RET(__wt_verbose(session, WT_VERB_METADATA, + __wt_verbose(session, WT_VERB_METADATA, "Search: key: %s, tracking: %s, %s" "turtle", key, WT_META_TRACKING(session) ? "true" : "false", - __metadata_turtle(key) ? "" : "not ")); + __metadata_turtle(key) ? "" : "not "); if (__metadata_turtle(key)) return (__wt_turtle_read(session, key, valuep)); diff --git a/src/os_common/os_fhandle.c b/src/os_common/os_fhandle.c index 3466f0d4e9b..3fd5b5db773 100644 --- a/src/os_common/os_fhandle.c +++ b/src/os_common/os_fhandle.c @@ -187,7 +187,7 @@ __open_verbose( if (tmp->size != 0) WT_ERR(__wt_buf_catfmt(session, tmp, ")")); - ret = __wt_verbose(session, WT_VERB_FILEOPS, + __wt_verbose(session, WT_VERB_FILEOPS, "%s: file-open: type %s%s", name, file_type_tag, tmp->size == 0 ? "" : (char *)tmp->data); @@ -300,8 +300,7 @@ __wt_close(WT_SESSION_IMPL *session, WT_FH **fhp) *fhp = NULL; /* Track handle-close as a file operation, so open and close match. */ - WT_RET(__wt_verbose( - session, WT_VERB_FILEOPS, "%s: file-close", fh->name)); + __wt_verbose(session, WT_VERB_FILEOPS, "%s: file-close", fh->name); /* * If the reference count hasn't gone to 0, or if it's an in-memory diff --git a/src/os_posix/os_map.c b/src/os_posix/os_map.c index b33f6d82e34..91ccc04ff7e 100644 --- a/src/os_posix/os_map.c +++ b/src/os_posix/os_map.c @@ -43,7 +43,7 @@ __wt_posix_map(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, WT_RET(fh->fh_size(fh, wt_session, &file_size)); len = (size_t)file_size; - (void)__wt_verbose(session, WT_VERB_HANDLEOPS, + __wt_verbose(session, WT_VERB_HANDLEOPS, "%s: memory-map: %" WT_SIZET_FMT " bytes", fh->name, len); if ((map = mmap(NULL, len, @@ -162,7 +162,7 @@ __wt_posix_unmap(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, session = (WT_SESSION_IMPL *)wt_session; - (void)__wt_verbose(session, WT_VERB_HANDLEOPS, + __wt_verbose(session, WT_VERB_HANDLEOPS, "%s: memory-unmap: %" WT_SIZET_FMT " bytes", fh->name, len); if (munmap(mapped_region, len) == 0) diff --git a/src/os_posix/os_mtx_cond.c b/src/os_posix/os_mtx_cond.c index 5f4e9a7cf2b..fb5a0f018cf 100644 --- a/src/os_posix/os_mtx_cond.c +++ b/src/os_posix/os_mtx_cond.c @@ -42,10 +42,10 @@ err: __wt_free(session, cond); /* * __wt_cond_wait_signal -- - * Wait on a mutex, optionally timing out. If we get it - * before the time out period expires, let the caller know. + * Wait on a mutex, optionally timing out. If we get it before the time + * out period expires, let the caller know. */ -int +void __wt_cond_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs, bool *signalled) { @@ -58,15 +58,15 @@ __wt_cond_wait_signal( /* Fast path if already signalled. */ *signalled = true; if (__wt_atomic_addi32(&cond->waiters, 1) == 0) - return (0); + return; /* * !!! * This function MUST handle a NULL session handle. */ if (session != NULL) { - WT_RET(__wt_verbose(session, WT_VERB_MUTEX, - "wait %s cond (%p)", cond->name, cond)); + __wt_verbose( + session, WT_VERB_MUTEX, "wait %s", cond->name, cond); WT_STAT_FAST_CONN_INCR(session, cond_wait); } @@ -96,20 +96,21 @@ __wt_cond_wait_signal( ret = 0; } - (void)__wt_atomic_subi32(&cond->waiters, 1); +err: (void)__wt_atomic_subi32(&cond->waiters, 1); -err: if (locked) + if (locked) WT_TRET(pthread_mutex_unlock(&cond->mtx)); if (ret == 0) - return (0); - WT_RET_MSG(session, ret, "pthread_cond_wait"); + return; + + WT_PANIC_MSG(session, ret, "pthread_cond_wait: %s", cond->name); } /* * __wt_cond_signal -- * Signal a waiting thread. */ -int +void __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) { WT_DECL_RET; @@ -122,12 +123,11 @@ __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) * This function MUST handle a NULL session handle. */ if (session != NULL) - WT_RET(__wt_verbose(session, WT_VERB_MUTEX, - "signal %s cond (%p)", cond->name, cond)); + __wt_verbose(session, WT_VERB_MUTEX, "signal %s", cond->name); /* Fast path if already signalled. */ if (cond->waiters == -1) - return (0); + return; if (cond->waiters > 0 || !__wt_atomic_casi32(&cond->waiters, 0, -1)) { WT_ERR(pthread_mutex_lock(&cond->mtx)); @@ -138,8 +138,9 @@ __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) err: if (locked) WT_TRET(pthread_mutex_unlock(&cond->mtx)); if (ret == 0) - return (0); - WT_RET_MSG(session, ret, "pthread_cond_broadcast"); + return; + + WT_PANIC_MSG(session, ret, "pthread_cond_broadcast: %s", cond->name); } /* diff --git a/src/os_win/os_map.c b/src/os_win/os_map.c index 8f5b289062d..93e81007c89 100644 --- a/src/os_win/os_map.c +++ b/src/os_win/os_map.c @@ -35,7 +35,7 @@ __wt_win_map(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, wt_session, file_handle->name, &file_size)); len = (size_t)file_size; - (void)__wt_verbose(session, WT_VERB_HANDLEOPS, + __wt_verbose(session, WT_VERB_HANDLEOPS, "%s: memory-map: %" WT_SIZET_FMT " bytes", file_handle->name, len); mapped_cookie = CreateFileMappingA( @@ -85,7 +85,7 @@ __wt_win_unmap(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, win_fh = (WT_FILE_HANDLE_WIN *)file_handle; session = (WT_SESSION_IMPL *)wt_session; - (void)__wt_verbose(session, WT_VERB_HANDLEOPS, + __wt_verbose(session, WT_VERB_HANDLEOPS, "%s: memory-unmap: %" WT_SIZET_FMT " bytes", file_handle->name, length); diff --git a/src/os_win/os_mtx_cond.c b/src/os_win/os_mtx_cond.c index 8645fdaccb3..da61904443f 100644 --- a/src/os_win/os_mtx_cond.c +++ b/src/os_win/os_mtx_cond.c @@ -38,10 +38,10 @@ __wt_cond_alloc(WT_SESSION_IMPL *session, /* * __wt_cond_wait_signal -- - * Wait on a mutex, optionally timing out. If we get it - * before the time out period expires, let the caller know. + * Wait on a mutex, optionally timing out. If we get it before the time + * out period expires, let the caller know. */ -int +void __wt_cond_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs, bool *signalled) { @@ -55,15 +55,14 @@ __wt_cond_wait_signal( /* Fast path if already signalled. */ *signalled = true; if (__wt_atomic_addi32(&cond->waiters, 1) == 0) - return (0); + return; /* * !!! * This function MUST handle a NULL session handle. */ if (session != NULL) { - WT_RET(__wt_verbose(session, WT_VERB_MUTEX, - "wait %s cond (%p)", cond->name, cond)); + __wt_verbose(session, WT_VERB_MUTEX, "wait %s", cond->name); WT_STAT_FAST_CONN_INCR(session, cond_wait); } @@ -112,18 +111,19 @@ __wt_cond_wait_signal( LeaveCriticalSection(&cond->mtx); if (sleepret != 0) - return (0); + return; - __wt_errx(session, "SleepConditionVariableCS: %s", - __wt_formatmessage(session, windows_error)); - return (__wt_map_windows_error(windows_error)); + __wt_errx(session, "SleepConditionVariableCS: %s: %s", + cond->name, __wt_formatmessage(session, windows_error)); + WT_PANIC_MSG(session, __wt_map_windows_error(windows_error), + "SleepConditionVariableCS: %s", cond->name); } /* * __wt_cond_signal -- * Signal a waiting thread. */ -int +void __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) { WT_DECL_RET; @@ -136,12 +136,11 @@ __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) * This function MUST handle a NULL session handle. */ if (session != NULL) - WT_RET(__wt_verbose(session, WT_VERB_MUTEX, - "signal %s cond (%p)", cond->name, cond)); + __wt_verbose(session, WT_VERB_MUTEX, "signal %s", cond->name); /* Fast path if already signalled. */ if (cond->waiters == -1) - return (0); + return; if (cond->waiters > 0 || !__wt_atomic_casi32(&cond->waiters, 0, -1)) { EnterCriticalSection(&cond->mtx); @@ -152,8 +151,9 @@ __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) if (locked) LeaveCriticalSection(&cond->mtx); if (ret == 0) - return (0); - WT_RET_MSG(session, ret, "WakeAllConditionVariable"); + return; + + WT_PANIC_MSG(session, ret, "WakeAllConditionVariable: %s", cond->name); } /* diff --git a/src/reconcile/rec_track.c b/src/reconcile/rec_track.c index 4a3a8a7e988..1515550deda 100644 --- a/src/reconcile/rec_track.c +++ b/src/reconcile/rec_track.c @@ -42,14 +42,14 @@ __ovfl_discard_verbose( unpack = &_unpack; __wt_cell_unpack(cell, unpack); - WT_ERR(__wt_verbose(session, WT_VERB_OVERFLOW, + __wt_verbose(session, WT_VERB_OVERFLOW, "discard: %s%s%p %s", tag == NULL ? "" : tag, tag == NULL ? "" : ": ", page, - __wt_addr_string(session, unpack->data, unpack->size, tmp))); + __wt_addr_string(session, unpack->data, unpack->size, tmp)); -err: __wt_scr_free(session, &tmp); + __wt_scr_free(session, &tmp); return (ret); } @@ -176,7 +176,7 @@ __ovfl_reuse_verbose(WT_SESSION_IMPL *session, WT_RET(__wt_scr_alloc(session, 64, &tmp)); - WT_ERR(__wt_verbose(session, WT_VERB_OVERFLOW, + __wt_verbose(session, WT_VERB_OVERFLOW, "reuse: %s%s%p %s (%s%s%s) {%.*s}", tag == NULL ? "" : tag, tag == NULL ? "" : ": ", @@ -187,9 +187,9 @@ __ovfl_reuse_verbose(WT_SESSION_IMPL *session, F_ISSET(reuse, WT_OVFL_REUSE_INUSE) && F_ISSET(reuse, WT_OVFL_REUSE_JUST_ADDED) ? ", " : "", F_ISSET(reuse, WT_OVFL_REUSE_JUST_ADDED) ? "just-added" : "", - WT_MIN(reuse->value_size, 40), (char *)WT_OVFL_REUSE_VALUE(reuse))); + WT_MIN(reuse->value_size, 40), (char *)WT_OVFL_REUSE_VALUE(reuse)); -err: __wt_scr_free(session, &tmp); + __wt_scr_free(session, &tmp); return (ret); } @@ -574,7 +574,7 @@ __ovfl_txnc_verbose(WT_SESSION_IMPL *session, WT_RET(__wt_scr_alloc(session, 64, &tmp)); - WT_ERR(__wt_verbose(session, WT_VERB_OVERFLOW, + __wt_verbose(session, WT_VERB_OVERFLOW, "txn-cache: %s%s%p %s %" PRIu64 " {%.*s}", tag == NULL ? "" : tag, tag == NULL ? "" : ": ", @@ -582,9 +582,9 @@ __ovfl_txnc_verbose(WT_SESSION_IMPL *session, __wt_addr_string( session, WT_OVFL_TXNC_ADDR(txnc), txnc->addr_size, tmp), txnc->current, - WT_MIN(txnc->value_size, 40), (char *)WT_OVFL_TXNC_VALUE(txnc))); + WT_MIN(txnc->value_size, 40), (char *)WT_OVFL_TXNC_VALUE(txnc)); -err: __wt_scr_free(session, &tmp); + __wt_scr_free(session, &tmp); return (ret); } @@ -881,11 +881,11 @@ __wt_ovfl_track_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page) WT_RET(__ovfl_reuse_wrapup(session, page)); if (track->ovfl_txnc[0] != NULL) { - WT_RET(__wt_writelock(session, S2BT(session)->ovfl_lock)); + __wt_writelock(session, S2BT(session)->ovfl_lock); ret = __ovfl_txnc_wrapup(session, page); - WT_TRET(__wt_writeunlock(session, S2BT(session)->ovfl_lock)); + __wt_writeunlock(session, S2BT(session)->ovfl_lock); } - return (0); + return (ret); } /* @@ -909,9 +909,9 @@ __wt_ovfl_track_wrapup_err(WT_SESSION_IMPL *session, WT_PAGE *page) WT_RET(__ovfl_reuse_wrapup_err(session, page)); if (track->ovfl_txnc[0] != NULL) { - WT_RET(__wt_writelock(session, S2BT(session)->ovfl_lock)); + __wt_writelock(session, S2BT(session)->ovfl_lock); ret = __ovfl_txnc_wrapup(session, page); - WT_TRET(__wt_writeunlock(session, S2BT(session)->ovfl_lock)); + __wt_writeunlock(session, S2BT(session)->ovfl_lock); } - return (0); + return (ret); } diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index b96b34594b0..4e5537dbcdf 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -357,8 +357,8 @@ __wt_reconcile(WT_SESSION_IMPL *session, page = ref->page; mod = page->modify; - WT_RET(__wt_verbose(session, - WT_VERB_RECONCILE, "%s", __wt_page_type_string(page->type))); + __wt_verbose(session, + WT_VERB_RECONCILE, "%s", __wt_page_type_string(page->type)); /* We shouldn't get called with a clean page, that's an error. */ WT_ASSERT(session, __wt_page_is_modified(page)); @@ -372,7 +372,7 @@ __wt_reconcile(WT_SESSION_IMPL *session, * In-memory splits: reconciliation of an internal page cannot handle * a child page splitting during the reconciliation. */ - WT_RET(__wt_fair_lock(session, &page->page_lock)); + __wt_fair_lock(session, &page->page_lock); /* * Check that transaction time always moves forward for a given page. @@ -386,7 +386,7 @@ __wt_reconcile(WT_SESSION_IMPL *session, /* Initialize the reconciliation structure for each new run. */ if ((ret = __rec_write_init( session, ref, flags, salvage, &session->reconcile)) != 0) { - WT_TRET(__wt_fair_unlock(session, &page->page_lock)); + __wt_fair_unlock(session, &page->page_lock); return (ret); } r = session->reconcile; @@ -427,7 +427,7 @@ __wt_reconcile(WT_SESSION_IMPL *session, WT_TRET(__rec_write_wrapup_err(session, r, page)); /* Release the reconciliation lock. */ - WT_TRET(__wt_fair_unlock(session, &page->page_lock)); + __wt_fair_unlock(session, &page->page_lock); /* Update statistics. */ WT_STAT_FAST_CONN_INCR(session, rec_pages); @@ -640,8 +640,8 @@ __rec_root_write(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t flags) WT_ILLEGAL_VALUE(session); } - WT_RET(__wt_verbose(session, WT_VERB_SPLIT, - "root page split -> %" PRIu32 " pages", mod->mod_multi_entries)); + __wt_verbose(session, WT_VERB_SPLIT, + "root page split -> %" PRIu32 " pages", mod->mod_multi_entries); /* * Create a new root page, initialize the array of child references, @@ -3327,13 +3327,13 @@ supd_check_complete: #ifdef HAVE_VERBOSE /* Output a verbose message if we create a page without many entries */ if (WT_VERBOSE_ISSET(session, WT_VERB_SPLIT) && r->entries < 6) - WT_ERR(__wt_verbose(session, WT_VERB_SPLIT, + __wt_verbose(session, WT_VERB_SPLIT, "Reconciliation creating a page with %" PRIu32 " entries, memory footprint %" PRIu64 ", page count %" PRIu32 ", %s, split state: %d\n", r->entries, r->page->memory_footprint, r->bnd_next, F_ISSET(r, WT_EVICTING) ? "evict" : "checkpoint", - r->bnd_state)); + r->bnd_state); #endif WT_ERR(__wt_bt_write(session, buf, addr, &addr_size, @@ -5535,22 +5535,22 @@ __rec_split_dump_keys(WT_SESSION_IMPL *session, WT_PAGE *page, WT_RECONCILE *r) if (page->type == WT_PAGE_ROW_INT || page->type == WT_PAGE_ROW_LEAF) WT_RET(__wt_scr_alloc(session, 0, &tkey)); - WT_ERR(__wt_verbose( - session, WT_VERB_SPLIT, "split: %" PRIu32 " pages", r->bnd_next)); + __wt_verbose( + session, WT_VERB_SPLIT, "split: %" PRIu32 " pages", r->bnd_next); for (bnd = r->bnd, i = 0; i < r->bnd_next; ++bnd, ++i) switch (page->type) { case WT_PAGE_ROW_INT: case WT_PAGE_ROW_LEAF: - WT_ERR(__wt_verbose(session, WT_VERB_SPLIT, + __wt_verbose(session, WT_VERB_SPLIT, "starting key %s", __wt_buf_set_printable( - session, bnd->key.data, bnd->key.size, tkey))); + session, bnd->key.data, bnd->key.size, tkey)); break; case WT_PAGE_COL_FIX: case WT_PAGE_COL_INT: case WT_PAGE_COL_VAR: - WT_ERR(__wt_verbose(session, WT_VERB_SPLIT, - "starting recno %" PRIu64, bnd->recno)); + __wt_verbose(session, WT_VERB_SPLIT, + "starting recno %" PRIu64, bnd->recno); break; WT_ILLEGAL_VALUE_ERR(session); } @@ -5637,8 +5637,7 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page) switch (r->bnd_next) { case 0: /* Page delete */ - WT_RET(__wt_verbose( - session, WT_VERB_RECONCILE, "page %p empty", page)); + __wt_verbose(session, WT_VERB_RECONCILE, "page %p empty", page); WT_STAT_FAST_CONN_INCR(session, rec_page_delete); WT_STAT_FAST_DATA_INCR(session, rec_page_delete); @@ -5698,9 +5697,9 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page) mod->rec_result = WT_PM_REC_REPLACE; break; default: /* Page split */ - WT_RET(__wt_verbose(session, WT_VERB_RECONCILE, + __wt_verbose(session, WT_VERB_RECONCILE, "page %p reconciled into %" PRIu32 " pages", - page, r->bnd_next)); + page, r->bnd_next); switch (page->type) { case WT_PAGE_COL_INT: diff --git a/src/session/session_api.c b/src/session/session_api.c index 0072d7e1445..82ce934c250 100644 --- a/src/session/session_api.c +++ b/src/session/session_api.c @@ -1500,7 +1500,7 @@ __session_transaction_sync(WT_SESSION *wt_session, const char *config) * our timeout. */ while (__wt_log_cmp(&session->bg_sync_lsn, &log->sync_lsn) > 0) { - WT_ERR(__wt_cond_signal(session, conn->log_file_cond)); + __wt_cond_signal(session, conn->log_file_cond); WT_ERR(__wt_epoch(session, &now)); waited_ms = WT_TIMEDIFF_MS(now, start); if (forever || waited_ms < timeout_ms) @@ -1511,8 +1511,7 @@ __session_transaction_sync(WT_SESSION *wt_session, const char *config) * computing the wait time in msecs and passing that * in, unchanged, as the usecs to wait). */ - WT_ERR(__wt_cond_wait( - session, log->log_sync_cond, waited_ms)); + __wt_cond_wait(session, log->log_sync_cond, waited_ms); else WT_ERR(ETIMEDOUT); } @@ -1627,7 +1626,7 @@ __session_snapshot(WT_SESSION *wt_session, const char *config) WT_ERR(__wt_txn_named_snapshot_config( session, cfg, &has_create, &has_drop)); - WT_ERR(__wt_writelock(session, txn_global->nsnap_rwlock)); + __wt_writelock(session, txn_global->nsnap_rwlock); /* Drop any snapshots to be removed first. */ if (has_drop) @@ -1637,7 +1636,7 @@ __session_snapshot(WT_SESSION *wt_session, const char *config) if (has_create) WT_ERR(__wt_txn_named_snapshot_begin(session, cfg)); -err: WT_TRET(__wt_writeunlock(session, txn_global->nsnap_rwlock)); +err: __wt_writeunlock(session, txn_global->nsnap_rwlock); API_END_RET_NOTFOUND_MAP(session, ret); } diff --git a/src/session/session_dhandle.c b/src/session/session_dhandle.c index ddf4d3dfa33..a899bad1b1f 100644 --- a/src/session/session_dhandle.c +++ b/src/session/session_dhandle.c @@ -183,17 +183,17 @@ __wt_session_lock_dhandle( */ if (F_ISSET(dhandle, WT_DHANDLE_OPEN) && (!want_exclusive || lock_busy)) { - WT_RET(__wt_readlock(session, dhandle->rwlock)); + __wt_readlock(session, dhandle->rwlock); if (F_ISSET(dhandle, WT_DHANDLE_DEAD)) { *is_deadp = 1; - return ( - __wt_readunlock(session, dhandle->rwlock)); + __wt_readunlock(session, dhandle->rwlock); + return (0); } is_open = F_ISSET(dhandle, WT_DHANDLE_OPEN); if (is_open && !want_exclusive) return (0); - WT_RET(__wt_readunlock(session, dhandle->rwlock)); + __wt_readunlock(session, dhandle->rwlock); } else is_open = false; @@ -206,8 +206,8 @@ __wt_session_lock_dhandle( if ((ret = __wt_try_writelock(session, dhandle->rwlock)) == 0) { if (F_ISSET(dhandle, WT_DHANDLE_DEAD)) { *is_deadp = 1; - return ( - __wt_writeunlock(session, dhandle->rwlock)); + __wt_writeunlock(session, dhandle->rwlock); + return (0); } /* @@ -217,8 +217,7 @@ __wt_session_lock_dhandle( if (F_ISSET(dhandle, WT_DHANDLE_OPEN) && !want_exclusive) { lock_busy = false; - WT_RET( - __wt_writeunlock(session, dhandle->rwlock)); + __wt_writeunlock(session, dhandle->rwlock); continue; } @@ -287,12 +286,11 @@ __wt_session_release_btree(WT_SESSION_IMPL *session) locked = false; } if (locked) { - if (write_locked) + if (write_locked) { F_CLR(dhandle, WT_DHANDLE_EXCLUSIVE); - - WT_TRET(write_locked ? - __wt_writeunlock(session, dhandle->rwlock): - __wt_readunlock(session, dhandle->rwlock)); + __wt_writeunlock(session, dhandle->rwlock); + } else + __wt_readunlock(session, dhandle->rwlock); } session->dhandle = NULL; @@ -514,7 +512,7 @@ __wt_session_get_btree(WT_SESSION_IMPL *session, dhandle->excl_session = NULL; dhandle->excl_ref = 0; F_CLR(dhandle, WT_DHANDLE_EXCLUSIVE); - WT_RET(__wt_writeunlock(session, dhandle->rwlock)); + __wt_writeunlock(session, dhandle->rwlock); WT_WITH_SCHEMA_LOCK(session, ret, WT_WITH_HANDLE_LIST_LOCK(session, @@ -536,7 +534,7 @@ __wt_session_get_btree(WT_SESSION_IMPL *session, dhandle->excl_session = NULL; dhandle->excl_ref = 0; F_CLR(dhandle, WT_DHANDLE_EXCLUSIVE); - WT_TRET(__wt_writeunlock(session, dhandle->rwlock)); + __wt_writeunlock(session, dhandle->rwlock); WT_RET(ret); } diff --git a/src/support/cond_auto.c b/src/support/cond_auto.c index ec95622f333..69114b066ae 100644 --- a/src/support/cond_auto.c +++ b/src/support/cond_auto.c @@ -58,12 +58,12 @@ __wt_cond_auto_alloc( * __wt_cond_auto_signal -- * Signal a condition variable. */ -int +void __wt_cond_auto_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) { WT_ASSERT(session, cond->min_wait != 0); - return (__wt_cond_signal(session, cond)); + __wt_cond_signal(session, cond); } /* @@ -73,7 +73,7 @@ __wt_cond_auto_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) * TODO: Can this version of the API be removed, now that we have the * auto adjusting condition variables? */ -int +void __wt_cond_auto_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, bool progress, bool *signalled) { @@ -94,15 +94,12 @@ __wt_cond_auto_wait_signal( cond->max_wait, cond->prev_wait + delta); } - WT_RET(__wt_cond_wait_signal( - session, cond, cond->prev_wait, signalled)); + __wt_cond_wait_signal(session, cond, cond->prev_wait, signalled); if (progress || *signalled) WT_STAT_FAST_CONN_INCR(session, cond_auto_wait_reset); if (*signalled) cond->prev_wait = cond->min_wait; - - return (0); } /* @@ -110,7 +107,7 @@ __wt_cond_auto_wait_signal( * Wait on a mutex, optionally timing out. If we get it before the time * out period expires, let the caller know. */ -int +void __wt_cond_auto_wait( WT_SESSION_IMPL *session, WT_CONDVAR *cond, bool progress) { @@ -120,9 +117,7 @@ __wt_cond_auto_wait( * Call the signal version so the wait period is reset if the * condition is woken explicitly. */ - WT_RET(__wt_cond_auto_wait_signal(session, cond, progress, &signalled)); - - return (0); + __wt_cond_auto_wait_signal(session, cond, progress, &signalled); } /* diff --git a/src/support/mtx_rw.c b/src/support/mtx_rw.c index dbf73bb4f13..6298a9dc52b 100644 --- a/src/support/mtx_rw.c +++ b/src/support/mtx_rw.c @@ -124,7 +124,7 @@ __wt_rwlock_alloc( { WT_RWLOCK *rwlock; - WT_RET(__wt_verbose(session, WT_VERB_MUTEX, "rwlock: alloc %s", name)); + __wt_verbose(session, WT_VERB_MUTEX, "rwlock: alloc %s", name); WT_RET(__wt_calloc_one(session, &rwlock)); @@ -143,8 +143,6 @@ __wt_try_readlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) { wt_rwlock_t *l, new, old; - WT_RET(__wt_verbose( - session, WT_VERB_MUTEX, "rwlock: try_readlock %s", rwlock->name)); WT_STAT_FAST_CONN_INCR(session, rwlock_read); l = &rwlock->rwlock; @@ -172,15 +170,13 @@ __wt_try_readlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) * __wt_readlock -- * Get a shared lock. */ -int +void __wt_readlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) { wt_rwlock_t *l; uint16_t ticket; int pause_cnt; - WT_RET(__wt_verbose( - session, WT_VERB_MUTEX, "rwlock: readlock %s", rwlock->name)); WT_STAT_FAST_CONN_INCR(session, rwlock_read); WT_DIAGNOSTIC_YIELD; @@ -220,21 +216,18 @@ __wt_readlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) * lock see consistent data. */ WT_READ_BARRIER(); - - return (0); } /* * __wt_readunlock -- * Release a shared lock. */ -int +void __wt_readunlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) { wt_rwlock_t *l; - WT_RET(__wt_verbose( - session, WT_VERB_MUTEX, "rwlock: read unlock %s", rwlock->name)); + WT_UNUSED(session); l = &rwlock->rwlock; @@ -243,8 +236,6 @@ __wt_readunlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) * sure we don't race). */ (void)__wt_atomic_add16(&l->s.writers, 1); - - return (0); } /* @@ -256,8 +247,6 @@ __wt_try_writelock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) { wt_rwlock_t *l, new, old; - WT_RET(__wt_verbose( - session, WT_VERB_MUTEX, "rwlock: try_writelock %s", rwlock->name)); WT_STAT_FAST_CONN_INCR(session, rwlock_write); l = &rwlock->rwlock; @@ -282,15 +271,13 @@ __wt_try_writelock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) * __wt_writelock -- * Wait to get an exclusive lock. */ -int +void __wt_writelock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) { wt_rwlock_t *l; uint16_t ticket; int pause_cnt; - WT_RET(__wt_verbose( - session, WT_VERB_MUTEX, "rwlock: writelock %s", rwlock->name)); WT_STAT_FAST_CONN_INCR(session, rwlock_write); l = &rwlock->rwlock; @@ -319,21 +306,18 @@ __wt_writelock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) * lock see consistent data. */ WT_READ_BARRIER(); - - return (0); } /* * __wt_writeunlock -- * Release an exclusive lock. */ -int +void __wt_writeunlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) { wt_rwlock_t *l, new; - WT_RET(__wt_verbose( - session, WT_VERB_MUTEX, "rwlock: writeunlock %s", rwlock->name)); + WT_UNUSED(session); /* * Ensure that all updates made while the lock was held are visible to @@ -356,27 +340,24 @@ __wt_writeunlock(WT_SESSION_IMPL *session, WT_RWLOCK *rwlock) l->i.wr = new.i.wr; WT_DIAGNOSTIC_YIELD; - - return (0); } /* * __wt_rwlock_destroy -- * Destroy a read/write lock. */ -int +void __wt_rwlock_destroy(WT_SESSION_IMPL *session, WT_RWLOCK **rwlockp) { WT_RWLOCK *rwlock; rwlock = *rwlockp; /* Clear our caller's reference. */ if (rwlock == NULL) - return (0); + return; *rwlockp = NULL; - WT_RET(__wt_verbose( - session, WT_VERB_MUTEX, "rwlock: destroy %s", rwlock->name)); + __wt_verbose( + session, WT_VERB_MUTEX, "rwlock: destroy %s", rwlock->name); __wt_free(session, rwlock); - return (0); } diff --git a/src/txn/txn.c b/src/txn/txn.c index 87b74433769..01e0fbbb634 100644 --- a/src/txn/txn.c +++ b/src/txn/txn.c @@ -185,7 +185,7 @@ __wt_txn_get_snapshot(WT_SESSION_IMPL *session) WT_ASSERT(session, prev_oldest_id == txn_global->oldest_id); txn_state->snap_min = snap_min; -done: WT_RET(__wt_readunlock(session, txn_global->scan_rwlock)); +done: __wt_readunlock(session, txn_global->scan_rwlock); __txn_sort_snapshot(session, n, current_id); return (0); } @@ -292,12 +292,12 @@ __wt_txn_update_oldest(WT_SESSION_IMPL *session, uint32_t flags) /* First do a read-only scan. */ if (wait) - WT_RET(__wt_readlock(session, txn_global->scan_rwlock)); + __wt_readlock(session, txn_global->scan_rwlock); else if ((ret = __wt_try_readlock(session, txn_global->scan_rwlock)) != 0) return (ret == EBUSY ? 0 : ret); __txn_oldest_scan(session, &oldest_id, &last_running, &oldest_session); - WT_RET(__wt_readunlock(session, txn_global->scan_rwlock)); + __wt_readunlock(session, txn_global->scan_rwlock); /* * If the state hasn't changed (or hasn't moved far enough for @@ -311,7 +311,7 @@ __wt_txn_update_oldest(WT_SESSION_IMPL *session, uint32_t flags) /* It looks like an update is necessary, wait for exclusive access. */ if (wait) - WT_RET(__wt_writelock(session, txn_global->scan_rwlock)); + __wt_writelock(session, txn_global->scan_rwlock); else if ((ret = __wt_try_writelock(session, txn_global->scan_rwlock)) != 0) return (ret == EBUSY ? 0 : ret); @@ -357,18 +357,18 @@ __wt_txn_update_oldest(WT_SESSION_IMPL *session, uint32_t flags) * but only when some progress is being made. */ if (WT_VERBOSE_ISSET(session, WT_VERB_TRANSACTION) && current_id - oldest_id > 10000 && oldest_session != NULL) { - WT_TRET(__wt_verbose(session, WT_VERB_TRANSACTION, + __wt_verbose(session, WT_VERB_TRANSACTION, "old snapshot %" PRIu64 " pinned in session %" PRIu32 " [%s]" " with snap_min %" PRIu64 "\n", oldest_id, oldest_session->id, oldest_session->lastop, - oldest_session->txn.snap_min)); + oldest_session->txn.snap_min); } #endif } -done: WT_TRET(__wt_writeunlock(session, txn_global->scan_rwlock)); +done: __wt_writeunlock(session, txn_global->scan_rwlock); return (ret); } @@ -782,23 +782,20 @@ __wt_txn_global_init(WT_SESSION_IMPL *session, const char *cfg[]) * __wt_txn_global_destroy -- * Destroy the global transaction state. */ -int +void __wt_txn_global_destroy(WT_SESSION_IMPL *session) { WT_CONNECTION_IMPL *conn; - WT_DECL_RET; WT_TXN_GLOBAL *txn_global; conn = S2C(session); txn_global = &conn->txn_global; if (txn_global == NULL) - return (0); + return; __wt_spin_destroy(session, &txn_global->id_lock); - WT_TRET(__wt_rwlock_destroy(session, &txn_global->scan_rwlock)); - WT_TRET(__wt_rwlock_destroy(session, &txn_global->nsnap_rwlock)); + __wt_rwlock_destroy(session, &txn_global->scan_rwlock); + __wt_rwlock_destroy(session, &txn_global->nsnap_rwlock); __wt_free(session, txn_global->states); - - return (ret); } diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c index 89fb8905653..9a062611422 100644 --- a/src/txn/txn_ckpt.c +++ b/src/txn/txn_ckpt.c @@ -493,10 +493,10 @@ __checkpoint_verbose_track(WT_SESSION_IMPL *session, * Get time diff in microseconds. */ msec = WT_TIMEDIFF_MS(stop, *start); - WT_RET(__wt_verbose(session, + __wt_verbose(session, WT_VERB_CHECKPOINT, "time: %" PRIu64 " us, gen: %" PRIu64 ": Full database checkpoint %s", - msec, S2C(session)->txn_global.checkpoint_gen, msg)); + msec, S2C(session)->txn_global.checkpoint_gen, msg); /* Update the timestamp so we are reporting intervals. */ memcpy(start, &stop, sizeof(*start)); @@ -659,7 +659,7 @@ __txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[]) * This allows ordinary visibility checks to move forward because * checkpoints often take a long time and only write to the metadata. */ - WT_ERR(__wt_writelock(session, txn_global->scan_rwlock)); + __wt_writelock(session, txn_global->scan_rwlock); txn_global->checkpoint_txnid = txn->id; txn_global->checkpoint_pinned = WT_MIN(txn->id, txn->snap_min); @@ -679,7 +679,7 @@ __txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[]) * details). */ txn_state->id = txn_state->snap_min = WT_TXN_NONE; - WT_ERR(__wt_writeunlock(session, txn_global->scan_rwlock)); + __wt_writeunlock(session, txn_global->scan_rwlock); /* * Unblock updates -- we can figure out that any updates to clean pages @@ -718,7 +718,7 @@ __txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[]) /* Mark all trees as open for business (particularly eviction). */ WT_ERR(__checkpoint_apply(session, cfg, __checkpoint_presync)); - WT_ERR(__wt_evict_server_wake(session)); + __wt_evict_server_wake(session); WT_ERR(__checkpoint_verbose_track(session, "committing transaction", &verb_timer)); @@ -1102,7 +1102,7 @@ __checkpoint_lock_tree(WT_SESSION_IMPL *session, * Hold the lock until we're done (blocking hot backups from starting), * we don't want to race with a future hot backup. */ - WT_ERR(__wt_readlock(session, conn->hot_backup_lock)); + __wt_readlock(session, conn->hot_backup_lock); hot_backup_locked = true; if (conn->hot_backup) WT_CKPT_FOREACH(ckptbase, ckpt) { @@ -1176,8 +1176,7 @@ __checkpoint_lock_tree(WT_SESSION_IMPL *session, WT_ASSERT(session, !is_checkpoint || !F_ISSET(btree, WT_BTREE_SPECIAL_FLAGS)); - hot_backup_locked = false; - WT_ERR(__wt_readunlock(session, conn->hot_backup_lock)); + __wt_readunlock(session, conn->hot_backup_lock); WT_ASSERT(session, btree->ckpt == NULL); btree->ckpt = ckptbase; @@ -1185,7 +1184,7 @@ __checkpoint_lock_tree(WT_SESSION_IMPL *session, return (0); err: if (hot_backup_locked) - WT_TRET(__wt_readunlock(session, conn->hot_backup_lock)); + __wt_readunlock(session, conn->hot_backup_lock); __wt_meta_ckptlist_free(session, ckptbase); __wt_free(session, name_alloc); @@ -1483,7 +1482,7 @@ __checkpoint_tree_helper(WT_SESSION_IMPL *session, const char *cfg[]) * progress. Without this, application threads will be stalled * until the eviction server next wakes. */ - WT_TRET(__wt_evict_server_wake(session)); + __wt_evict_server_wake(session); return (ret); } diff --git a/src/txn/txn_log.c b/src/txn/txn_log.c index e73ff00f5b7..c7d83d1db64 100644 --- a/src/txn/txn_log.c +++ b/src/txn/txn_log.c @@ -376,7 +376,7 @@ __wt_txn_checkpoint_log( * that case. */ if (!S2C(session)->hot_backup && txn->full_ckpt) - WT_ERR(__wt_log_ckpt(session, ckpt_lsn)); + __wt_log_ckpt(session, ckpt_lsn); /* FALLTHROUGH */ case WT_TXN_LOG_CKPT_CLEANUP: diff --git a/src/txn/txn_nsnap.c b/src/txn/txn_nsnap.c index 5b8fed23a9f..05c45c0dc38 100644 --- a/src/txn/txn_nsnap.c +++ b/src/txn/txn_nsnap.c @@ -256,7 +256,7 @@ __wt_txn_named_snapshot_get(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *nameval) if (session->ncursors > 0) WT_RET(__wt_session_copy_values(session)); - WT_RET(__wt_readlock(session, txn_global->nsnap_rwlock)); + __wt_readlock(session, txn_global->nsnap_rwlock); TAILQ_FOREACH(nsnap, &txn_global->nsnaph, q) if (WT_STRING_MATCH(nsnap->name, nameval->str, nameval->len)) { txn->snap_min = txn_state->snap_min = nsnap->snap_min; @@ -268,7 +268,7 @@ __wt_txn_named_snapshot_get(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *nameval) F_SET(txn, WT_TXN_HAS_SNAPSHOT); break; } - WT_RET(__wt_readunlock(session, txn_global->nsnap_rwlock)); + __wt_readunlock(session, txn_global->nsnap_rwlock); if (nsnap == NULL) WT_RET_MSG(session, EINVAL, diff --git a/src/txn/txn_recover.c b/src/txn/txn_recover.c index bd004e0f837..ae21e58d9b6 100644 --- a/src/txn/txn_recover.c +++ b/src/txn/txn_recover.c @@ -60,9 +60,9 @@ __recovery_cursor(WT_SESSION_IMPL *session, WT_RECOVERY *r, else if (id >= r->nfiles || r->files[id].uri == NULL) { /* If a file is missing, output a verbose message once. */ if (!r->missing) - WT_RET(__wt_verbose(session, WT_VERB_RECOVERY, + __wt_verbose(session, WT_VERB_RECOVERY, "No file found with ID %u (max %u)", - id, r->nfiles)); + id, r->nfiles); r->missing = true; } else if (__wt_log_cmp(lsnp, &r->files[id].ckpt_lsn) >= 0) { /* @@ -89,11 +89,11 @@ __recovery_cursor(WT_SESSION_IMPL *session, WT_RECOVERY *r, */ #define GET_RECOVERY_CURSOR(session, r, lsnp, fileid, cp) \ WT_ERR(__recovery_cursor(session, r, lsnp, fileid, false, cp)); \ - WT_ERR(__wt_verbose(session, WT_VERB_RECOVERY, \ + __wt_verbose(session, WT_VERB_RECOVERY, \ "%s op %" PRIu32 " to file %" PRIu32 " at LSN %" PRIu32 \ "/%" PRIu32, \ cursor == NULL ? "Skipping" : "Applying", \ - optype, fileid, lsnp->l.file, lsnp->l.offset)); \ + optype, fileid, lsnp->l.file, lsnp->l.offset); \ if (cursor == NULL) \ break @@ -333,9 +333,9 @@ __recovery_setup_file(WT_RECOVERY *r, const char *uri, const char *config) (int)cval.len, cval.str); r->files[fileid].ckpt_lsn = lsn; - WT_RET(__wt_verbose(r->session, WT_VERB_RECOVERY, + __wt_verbose(r->session, WT_VERB_RECOVERY, "Recovering %s with id %" PRIu32 " @ (%" PRIu32 ", %" PRIu32 ")", - uri, fileid, lsn.l.file, lsn.l.offset)); + uri, fileid, lsn.l.file, lsn.l.offset); return (0); @@ -496,9 +496,9 @@ __wt_txn_recover(WT_SESSION_IMPL *session) * Pass WT_LOGSCAN_RECOVER so that old logs get truncated. */ r.metadata_only = false; - WT_ERR(__wt_verbose(session, WT_VERB_RECOVERY, + __wt_verbose(session, WT_VERB_RECOVERY, "Main recovery loop: starting at %" PRIu32 "/%" PRIu32, - r.ckpt_lsn.l.file, r.ckpt_lsn.l.offset)); + r.ckpt_lsn.l.file, r.ckpt_lsn.l.offset); WT_ERR(__wt_log_needs_recovery(session, &r.ckpt_lsn, &needs_rec)); /* * Check if the database was shut down cleanly. If not |