summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Anderson <dda@ddanderson.com>2015-11-19 10:54:33 -0500
committerDon Anderson <dda@ddanderson.com>2015-11-19 10:54:33 -0500
commit859bd928ea7a40022ee9c810b9a7dd9deda852fb (patch)
treef3279fb963eeba51a08783599eca413f4ec6167e
parenteaeda1e316d2d2813ed980a0be62205e107f3bd9 (diff)
parent2b1f1332c123431bc5e46b35f4ad5a942e681f4b (diff)
downloadmongo-859bd928ea7a40022ee9c810b9a7dd9deda852fb.tar.gz
Merge branch 'develop' into wt-2227-join-lint
-rw-r--r--src/block/block_ckpt.c6
-rw-r--r--src/cursor/cur_join.c57
-rw-r--r--src/evict/evict_lru.c2
-rw-r--r--src/log/log.c9
-rw-r--r--src/session/session_api.c55
5 files changed, 53 insertions, 76 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 71044b0cd0a..395da22a80c 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;
uint32_t f, k;
- 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));
@@ -701,10 +698,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));
@@ -955,18 +951,17 @@ __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_MASK(WT_CURJOIN_ENTRY_BLOOM) !=
- F_MASK(entry, WT_CURJOIN_ENTRY_BLOOM)) {
- __wt_errx(session, "join has incompatible strategy "
+ F_MASK(entry, WT_CURJOIN_ENTRY_BLOOM))
+ WT_ERR_MSG(session, EINVAL,
+ "join has incompatible strategy "
"values for the same index");
- WT_ERR(EINVAL);
- }
+
/*
* Check against other comparisons (we call them endpoints)
* already set up for this index.
@@ -992,19 +987,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));
diff --git a/src/session/session_api.c b/src/session/session_api.c
index f088ffc6150..c23a1f78e6d 100644
--- a/src/session/session_api.c
+++ b/src/session/session_api.c
@@ -646,12 +646,12 @@ __session_join(WT_SESSION *wt_session, WT_CURSOR *join_cursor,
WT_CURSOR *ref_cursor, const char *config)
{
WT_CONFIG_ITEM cval;
- WT_DECL_RET;
- WT_SESSION_IMPL *session;
WT_CURSOR_INDEX *cindex;
WT_CURSOR_JOIN *cjoin;
WT_CURSOR_TABLE *ctable;
+ WT_DECL_RET;
WT_INDEX *idx;
+ WT_SESSION_IMPL *session;
WT_TABLE *table;
uint8_t flags;
uint32_t bloom_bit_count, bloom_hash_count, range;
@@ -662,10 +662,8 @@ __session_join(WT_SESSION *wt_session, WT_CURSOR *join_cursor,
SESSION_API_CALL(session, join, config, cfg);
table = NULL;
- if (!WT_PREFIX_MATCH(join_cursor->uri, "join:")) {
- __wt_errx(session, "not a join cursor");
- WT_ERR(EINVAL);
- }
+ if (!WT_PREFIX_MATCH(join_cursor->uri, "join:"))
+ WT_ERR_MSG(session, EINVAL, "not a join cursor");
if (WT_PREFIX_MATCH(ref_cursor->uri, "index:")) {
cindex = (WT_CURSOR_INDEX *)ref_cursor;
@@ -677,21 +675,16 @@ __session_join(WT_SESSION *wt_session, WT_CURSOR *join_cursor,
ctable = (WT_CURSOR_TABLE *)ref_cursor;
table = ctable->table;
WT_CURSOR_CHECKKEY(ctable->cg_cursors[0]);
- } else {
- __wt_errx(session, "not an index or table cursor");
- WT_ERR(EINVAL);
- }
+ } else
+ WT_ERR_MSG(session, EINVAL, "not an index or table cursor");
cjoin = (WT_CURSOR_JOIN *)join_cursor;
- if (cjoin->table != table) {
- __wt_errx(session, "table for join cursor does not match "
- "table for index");
- WT_ERR(EINVAL);
- }
- if (F_ISSET(ref_cursor, WT_CURSTD_JOINED)) {
- __wt_errx(session, "index cursor already used in a join");
- WT_ERR(EINVAL);
- }
+ if (cjoin->table != table)
+ WT_ERR_MSG(session, EINVAL,
+ "table for join cursor does not match table for index");
+ if (F_ISSET(ref_cursor, WT_CURSTD_JOINED))
+ WT_ERR_MSG(session, EINVAL,
+ "index cursor already used in a join");
/* "ge" is the default */
range = WT_CURJOIN_END_GT | WT_CURJOIN_END_EQ;
@@ -733,16 +726,13 @@ __session_join(WT_SESSION *wt_session, WT_CURSOR *join_cursor,
}
bloom_hash_count = (uint32_t)cval.val;
if (LF_ISSET(WT_CURJOIN_ENTRY_BLOOM)) {
- if (count == 0) {
- __wt_errx(session, "count must be nonzero when "
- "strategy=bloom");
- WT_ERR(EINVAL);
- }
- if (cjoin->entries_next == 0) {
- __wt_errx(session, "the first joined cursor cannot "
- "specify strategy=bloom");
- WT_ERR(EINVAL);
- }
+ if (count == 0)
+ WT_ERR_MSG(session, EINVAL,
+ "count must be nonzero when strategy=bloom");
+ if (cjoin->entries_next == 0)
+ WT_ERR_MSG(session, EINVAL,
+ "the first joined cursor cannot specify "
+ "strategy=bloom");
}
WT_ERR(__wt_curjoin_join(session, cjoin, idx, ref_cursor, flags,
range, count, bloom_bit_count, bloom_hash_count));
@@ -1019,10 +1009,9 @@ __session_commit_transaction(WT_SESSION *wt_session, const char *config)
WT_STAT_FAST_CONN_INCR(session, txn_commit);
txn = &session->txn;
- if (F_ISSET(txn, WT_TXN_ERROR) && txn->mod_count != 0) {
- __wt_errx(session, "failed transaction requires rollback");
- ret = EINVAL;
- }
+ if (F_ISSET(txn, WT_TXN_ERROR) && txn->mod_count != 0)
+ WT_ERR_MSG(session, EINVAL,
+ "failed transaction requires rollback");
if (ret == 0)
ret = __wt_txn_commit(session, cfg);