summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2015-11-19 09:18:28 -0500
committerKeith Bostic <keith@wiredtiger.com>2015-11-19 09:18:28 -0500
commitb44e0e5441b35939494530021f5a580a3b13e60b (patch)
treecd99b44d784815ec097958bb2587d7f8f8c8d995
parent8c03764154862e5a2b586d70464bf711e13ef685 (diff)
downloadmongo-b44e0e5441b35939494530021f5a580a3b13e60b.tar.gz
Replace some __wt_errx/WT_ERR pairs with WT_ERR_MSG, __wt_errx/WT_RET
pairs with WT_RET_MSG.
-rw-r--r--src/block/block_ckpt.c6
-rw-r--r--src/cursor/cur_join.c58
-rw-r--r--src/evict/evict_lru.c2
-rw-r--r--src/log/log.c9
4 files changed, 31 insertions, 44 deletions
diff --git a/src/block/block_ckpt.c b/src/block/block_ckpt.c
index 2c8ff89a5cf..adbcf0e3fdc 100644
--- a/src/block/block_ckpt.c
+++ b/src/block/block_ckpt.c
@@ -657,12 +657,10 @@ live_update:
break;
if ((a = ckpt->bpriv) == NULL)
a = &block->live;
- if (a->discard.entries != 0) {
- __wt_errx(session,
+ if (a->discard.entries != 0)
+ WT_ERR_MSG(session, WT_ERROR,
"first checkpoint incorrectly has blocks on the discard "
"list");
- WT_ERR(WT_ERROR);
- }
#endif
block->ckpt_inprogress = true;
diff --git a/src/cursor/cur_join.c b/src/cursor/cur_join.c
index c5155c75a0c..8ddf988e940 100644
--- a/src/cursor/cur_join.c
+++ b/src/cursor/cur_join.c
@@ -200,10 +200,9 @@ __curjoin_get_key(WT_CURSOR *cursor, ...)
CURSOR_API_CALL(cursor, session, get_key, NULL);
if (!F_ISSET(cjoin, WT_CURJOIN_INITIALIZED) ||
- !__curjoin_entry_iter_ready(cjoin->iter)) {
- __wt_errx(session, "join cursor must be advanced with next()");
- WT_ERR(EINVAL);
- }
+ !__curjoin_entry_iter_ready(cjoin->iter))
+ WT_ERR_MSG(session, EINVAL,
+ "join cursor must be advanced with next()");
WT_ERR(__wt_cursor_get_keyv(cursor, cursor->flags, ap));
err: va_end(ap);
@@ -230,10 +229,9 @@ __curjoin_get_value(WT_CURSOR *cursor, ...)
CURSOR_API_CALL(cursor, session, get_value, NULL);
if (!F_ISSET(cjoin, WT_CURJOIN_INITIALIZED) ||
- !__curjoin_entry_iter_ready(iter)) {
- __wt_errx(session, "join cursor must be advanced with next()");
- WT_ERR(EINVAL);
- }
+ !__curjoin_entry_iter_ready(iter))
+ WT_ERR_MSG(session, EINVAL,
+ "join cursor must be advanced with next()");
if (iter->entry->index != NULL)
WT_ERR(__wt_curindex_get_valuev(iter->cursor, ap));
else
@@ -428,11 +426,10 @@ __curjoin_init_iter(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin)
WT_CURSOR_JOIN_ENDPOINT *end;
uint64_t k, m;
- if (cjoin->entries_next == 0) {
- __wt_errx(session, "join cursor has not yet been joined "
- "with any other cursors");
- return (EINVAL);
- }
+ if (cjoin->entries_next == 0)
+ WT_RET_MSG(session, EINVAL,
+ "join cursor has not yet been joined with any other "
+ "cursors");
je = &cjoin->entries[0];
WT_RET(__curjoin_entry_iter_init(session, cjoin, je, &cjoin->iter));
@@ -700,10 +697,9 @@ __curjoin_next(WT_CURSOR *cursor)
CURSOR_API_CALL(cursor, session, next, NULL);
- if (F_ISSET(cjoin, WT_CURJOIN_ERROR)) {
- __wt_errx(session, "join cursor encountered previous error");
- WT_ERR(WT_ERROR);
- }
+ if (F_ISSET(cjoin, WT_CURJOIN_ERROR))
+ WT_ERR_MSG(session, WT_ERROR,
+ "join cursor encountered previous error");
if (!F_ISSET(cjoin, WT_CURJOIN_INITIALIZED))
WT_ERR(__curjoin_init_iter(session, cjoin));
@@ -954,18 +950,16 @@ __wt_curjoin_join(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin,
++cjoin->entries_next;
} else {
/* Merge the join into an existing entry for this index */
- if (count != 0 && entry->count != 0 && entry->count != count) {
- __wt_errx(session, "count=%" PRIu64 " does not match "
+ if (count != 0 && entry->count != 0 && entry->count != count)
+ WT_ERR_MSG(session, EINVAL,
+ "count=%" PRIu64 " does not match "
"previous count=%" PRIu64 " for this index",
count, entry->count);
- WT_ERR(EINVAL);
- }
if (LF_ISSET(WT_CURJOIN_ENTRY_BLOOM) !=
- F_ISSET(entry, WT_CURJOIN_ENTRY_BLOOM)) {
- __wt_errx(session, "join has incompatible strategy "
- "values for the same index");
- WT_ERR(EINVAL);
- }
+ F_ISSET(entry, WT_CURJOIN_ENTRY_BLOOM))
+ WT_ERR_MSG(session, EINVAL,
+ "join has incompatible strategy values for the "
+ "same index");
/*
* Check against other comparisons (we call them endpoints)
* already set up for this index.
@@ -991,19 +985,15 @@ __wt_curjoin_join(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin,
((range & WT_CURJOIN_END_LT) != 0 || range_eq)) ||
(end->flags == WT_CURJOIN_END_EQ &&
(range & (WT_CURJOIN_END_LT | WT_CURJOIN_END_GT))
- != 0)) {
- __wt_errx(session,
+ != 0))
+ WT_ERR_MSG(session, EINVAL,
"join has overlapping ranges");
- WT_ERR(EINVAL);
- }
if (range == WT_CURJOIN_END_EQ &&
end->flags == WT_CURJOIN_END_EQ &&
- !F_ISSET(entry, WT_CURJOIN_ENTRY_DISJUNCTION)) {
- __wt_errx(session,
+ !F_ISSET(entry, WT_CURJOIN_ENTRY_DISJUNCTION))
+ WT_ERR_MSG(session, EINVAL,
"compare=eq can only be combined "
"using operation=or");
- WT_ERR(EINVAL);
- }
/*
* Sort "gt"/"ge" to the front, followed by any number
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c
index fa6c4f4313f..02e8bd24899 100644
--- a/src/evict/evict_lru.c
+++ b/src/evict/evict_lru.c
@@ -211,7 +211,7 @@ __evict_server(void *arg)
/* After being stuck for 5 minutes, give up. */
WT_ERR(__wt_epoch(session, &now));
if (WT_TIMEDIFF_SEC(now, stuck_ts) > 300) {
- __wt_errx(session,
+ __wt_err(session, ETIMEDOUT,
"Cache stuck for too long, giving up");
(void)__wt_cache_dump(session, NULL);
WT_ERR(ETIMEDOUT);
diff --git a/src/log/log.c b/src/log/log.c
index 3106094e7e3..118e081c3ec 100644
--- a/src/log/log.c
+++ b/src/log/log.c
@@ -1860,12 +1860,11 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp,
conn = S2C(session);
log = conn->log;
- if (record->size > UINT32_MAX) {
- __wt_errx(session, "Log record size of %" WT_SIZET_FMT
- " exceeds the maximum supported size of %" PRIu32,
+ if (record->size > UINT32_MAX)
+ WT_RET_MSG(session, EFBIG,
+ "Log record size of %" WT_SIZET_FMT " exceeds the maximum "
+ "supported size of %" PRIu32,
record->size, UINT32_MAX);
- return (EFBIG);
- }
WT_INIT_LSN(&lsn);
myslot.slot = NULL;
memset(&myslot, 0, sizeof(myslot));