summaryrefslogtreecommitdiff
path: root/src/third_party
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-11-20 16:58:56 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2015-11-20 16:58:56 +1100
commitfb959fb6020ade800db8674b598a04a1ab4c7e67 (patch)
tree18f9ac021b8b44f2515fe805b6808f109af429fc /src/third_party
parent93637565b81ee9564fd22f4544c0a516f0e73f16 (diff)
downloadmongo-fb959fb6020ade800db8674b598a04a1ab4c7e67.tar.gz
Import wiredtiger-wiredtiger-mongodb-3.2.0-rc3-192-g4898aa4.tar.gz from wiredtiger branch mongodb-3.2
Diffstat (limited to 'src/third_party')
-rw-r--r--src/third_party/wiredtiger/src/block/block_ckpt.c6
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_delete.c12
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_split.c53
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_join.c88
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_stat.c5
-rw-r--r--src/third_party/wiredtiger/src/evict/evict_lru.c2
-rw-r--r--src/third_party/wiredtiger/src/include/cursor.h4
-rw-r--r--src/third_party/wiredtiger/src/include/extern.h2
-rw-r--r--src/third_party/wiredtiger/src/log/log.c9
-rw-r--r--src/third_party/wiredtiger/src/packing/pack_impl.c7
-rw-r--r--src/third_party/wiredtiger/src/session/session_api.c69
11 files changed, 130 insertions, 127 deletions
diff --git a/src/third_party/wiredtiger/src/block/block_ckpt.c b/src/third_party/wiredtiger/src/block/block_ckpt.c
index 2c8ff89a5cf..adbcf0e3fdc 100644
--- a/src/third_party/wiredtiger/src/block/block_ckpt.c
+++ b/src/third_party/wiredtiger/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/third_party/wiredtiger/src/btree/bt_delete.c b/src/third_party/wiredtiger/src/btree/bt_delete.c
index 98c6390e0f4..910df616015 100644
--- a/src/third_party/wiredtiger/src/btree/bt_delete.c
+++ b/src/third_party/wiredtiger/src/btree/bt_delete.c
@@ -252,6 +252,18 @@ __wt_delete_page_skip(WT_SESSION_IMPL *session, WT_REF *ref, bool visible_all)
__wt_txn_visible_all(session, ref->page_del->txnid) :
__wt_txn_visible(session, ref->page_del->txnid));
+ /*
+ * The page_del structure can be freed as soon as the delete is stable:
+ * it is only read when the ref state is WT_REF_DELETED. It is worth
+ * checking every time we come through because once this is freed, we
+ * no longer need synchronization to check the ref.
+ */
+ if (skip && ref->page_del != NULL && (visible_all ||
+ __wt_txn_visible_all(session, ref->page_del->txnid))) {
+ __wt_free(session, ref->page_del->update_list);
+ __wt_free(session, ref->page_del);
+ }
+
WT_PUBLISH(ref->state, WT_REF_DELETED);
return (skip);
}
diff --git a/src/third_party/wiredtiger/src/btree/bt_split.c b/src/third_party/wiredtiger/src/btree/bt_split.c
index caba12b78f1..c025ae62bb3 100644
--- a/src/third_party/wiredtiger/src/btree/bt_split.c
+++ b/src/third_party/wiredtiger/src/btree/bt_split.c
@@ -811,8 +811,19 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, WT_REF **ref_new,
* those threads and causes them to re-calculate their position based
* on the just-updated parent page's index.
*/
- if (discard)
+ if (discard) {
+ /*
+ * Page-delete information is only read when the WT_REF state is
+ * WT_REF_DELETED. The page-delete memory wasn't added to the
+ * parent's footprint, ignore it here.
+ */
+ if (ref->page_del != NULL) {
+ __wt_free(session, ref->page_del->update_list);
+ __wt_free(session, ref->page_del);
+ }
+
WT_PUBLISH(ref->state, WT_REF_SPLIT);
+ }
/*
* Push out the changes: not required for correctness, but don't let
@@ -877,19 +888,14 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, WT_REF **ref_new,
session, split_gen, exclusive, ikey, size));
parent_decr += size;
}
- /*
- * The page_del structure can be freed immediately: it
- * is only read when the ref state is WT_REF_DELETED.
- * The size of the structure wasn't added to the parent,
- * don't decrement.
- */
- if (next_ref->page_del != NULL) {
- __wt_free(session,
- next_ref->page_del->update_list);
- __wt_free(session, next_ref->page_del);
- }
}
+ /*
+ * If this page was fast-truncated, any attached structure
+ * should have been freed before now.
+ */
+ WT_ASSERT(session, next_ref->page_del == NULL);
+
WT_TRET(__split_safe_free(
session, split_gen, exclusive, next_ref, sizeof(WT_REF)));
parent_decr += sizeof(WT_REF);
@@ -1643,21 +1649,24 @@ __split_insert(WT_SESSION_IMPL *session, WT_REF *ref)
* The first page in the split is the current page, but we still have
* to create a replacement WT_REF, the original WT_REF will be set to
* split status and eventually freed.
- */
- WT_ERR(__wt_calloc_one(session, &split_ref[0]));
- child = split_ref[0];
- *child = *ref;
-
- /*
+ *
* The new WT_REF is not quite identical: we have to instantiate a key,
* and the new reference is visible to readers once the split completes.
*
- * The key-instantiation code checks for races, clear the key fields so
- * we don't trigger them.
+ * The key-instantiation code checks for races, leave the key fields
+ * zeroed we don't trigger them.
+ *
+ * Don't copy any deleted page state: we may be splitting a page that
+ * was instantiated after a truncate and that history should not be
+ * carried onto these new child pages.
*/
- child->key.recno = WT_RECNO_OOB;
- child->key.ikey = NULL;
+ WT_ERR(__wt_calloc_one(session, &split_ref[0]));
+ child = split_ref[0];
+ child->page = ref->page;
+ child->home = ref->home;
+ child->pindex_hint = ref->pindex_hint;
child->state = WT_REF_MEM;
+ child->addr = ref->addr;
/*
* Copy the first key from the original page into first ref in the new
diff --git a/src/third_party/wiredtiger/src/cursor/cur_join.c b/src/third_party/wiredtiger/src/cursor/cur_join.c
index c5155c75a0c..395da22a80c 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_join.c
+++ b/src/third_party/wiredtiger/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
@@ -312,7 +310,7 @@ __curjoin_init_bloom(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin,
}
collator = (entry->index == NULL) ? NULL : entry->index->collator;
while (ret == 0) {
- c->get_key(c, &curkey);
+ WT_ERR(c->get_key(c, &curkey));
if (entry->index != NULL) {
cindex = (WT_CURSOR_INDEX *)c;
if (cindex->index->extractor == NULL) {
@@ -348,9 +346,9 @@ __curjoin_init_bloom(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin,
}
}
if (entry->index != NULL)
- c->get_value(c, &curvalue);
+ WT_ERR(c->get_value(c, &curvalue));
else
- c->get_key(c, &curvalue);
+ WT_ERR(c->get_key(c, &curvalue));
WT_ERR(__wt_bloom_insert(bloom, &curvalue));
entry->stats.actual_count++;
advance:
@@ -426,13 +424,12 @@ __curjoin_init_iter(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin)
WT_DECL_RET;
WT_CURSOR_JOIN_ENTRY *je, *jeend, *je2;
WT_CURSOR_JOIN_ENDPOINT *end;
- uint64_t k, m;
+ 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));
@@ -461,21 +458,21 @@ __curjoin_init_iter(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin)
* pick compatible numbers for bit counts
* and number of hashes.
*/
- m = je->bloom_bit_count;
+ f = je->bloom_bit_count;
k = je->bloom_hash_count;
for (je2 = je + 1; je2 < jeend; je2++)
if (F_ISSET(je2,
WT_CURJOIN_ENTRY_BLOOM) &&
je2->count == je->count) {
- m = WT_MAX(
- je2->bloom_bit_count, m);
+ f = WT_MAX(
+ je2->bloom_bit_count, f);
k = WT_MAX(
je2->bloom_hash_count, k);
}
- je->bloom_bit_count = m;
+ je->bloom_bit_count = f;
je->bloom_hash_count = k;
WT_RET(__wt_bloom_create(session, NULL,
- NULL, je->count, m, k, &je->bloom));
+ NULL, je->count, f, k, &je->bloom));
F_SET(je, WT_CURJOIN_ENTRY_OWN_BLOOM);
WT_RET(__curjoin_init_bloom(session, cjoin,
je, je->bloom));
@@ -490,7 +487,7 @@ __curjoin_init_iter(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin)
WT_ASSERT(session,
je2->bloom == NULL);
je2->bloom = je->bloom;
- je2->bloom_bit_count = m;
+ je2->bloom_bit_count = f;
je2->bloom_hash_count = k;
}
} else {
@@ -651,14 +648,15 @@ __curjoin_entry_member(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin,
bloom_found = true;
}
if (entry->index != NULL) {
+ memset(&v, 0, sizeof(v)); /* Keep lint quiet. */
c = entry->main;
c->set_key(c, key);
- if ((ret = c->search(c)) == 0)
+ if ((ret = c->search(c)) == 0)
ret = c->get_value(c, &v);
else if (ret == WT_NOTFOUND)
WT_ERR_MSG(session, WT_ERROR,
"main table for join is missing entry.");
- c->reset(c);
+ WT_TRET(c->reset(c));
WT_ERR(ret);
} else
v = *key;
@@ -700,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));
@@ -894,8 +891,8 @@ err: WT_TRET(__curjoin_close(cursor));
*/
int
__wt_curjoin_join(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin,
- WT_INDEX *idx, WT_CURSOR *ref_cursor, uint32_t flags, uint32_t range,
- uint64_t count, uint64_t bloom_bit_count, uint64_t bloom_hash_count)
+ WT_INDEX *idx, WT_CURSOR *ref_cursor, uint8_t flags, uint8_t range,
+ uint64_t count, uint32_t bloom_bit_count, uint32_t bloom_hash_count)
{
WT_CURSOR_JOIN_ENTRY *entry;
WT_DECL_RET;
@@ -954,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_ISSET(WT_CURJOIN_ENTRY_BLOOM) !=
- F_ISSET(entry, WT_CURJOIN_ENTRY_BLOOM)) {
- __wt_errx(session, "join has incompatible strategy "
+ if (LF_MASK(WT_CURJOIN_ENTRY_BLOOM) !=
+ 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.
@@ -991,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/third_party/wiredtiger/src/cursor/cur_stat.c b/src/third_party/wiredtiger/src/cursor/cur_stat.c
index 65d2dc81406..e1d5b8eb91a 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_stat.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_stat.c
@@ -452,7 +452,7 @@ __curstat_join_next_set(WT_SESSION_IMPL *session, WT_CURSOR_STAT *cst,
join_group = &cst->u.join_stats_group;
cjoin = join_group->join_cursor;
if (init)
- pos = forw ? 0 : cjoin->entries_next - 1;
+ pos = forw ? 0 : (ssize_t)cjoin->entries_next - 1;
else
pos = join_group->join_cursor_entry + (forw ? 1 : -1);
if (pos < 0 || (size_t)pos >= cjoin->entries_next)
@@ -543,8 +543,7 @@ __wt_curstat_init(WT_SESSION_IMPL *session,
dsrc_uri = uri + strlen("statistics:");
if (WT_STREQ(dsrc_uri, "join"))
- return (
- __curstat_join_init(session, curjoin, cfg, cst));
+ return (__curstat_join_init(session, curjoin, cfg, cst));
if (WT_PREFIX_MATCH(dsrc_uri, "colgroup:"))
return (
diff --git a/src/third_party/wiredtiger/src/evict/evict_lru.c b/src/third_party/wiredtiger/src/evict/evict_lru.c
index fa6c4f4313f..02e8bd24899 100644
--- a/src/third_party/wiredtiger/src/evict/evict_lru.c
+++ b/src/third_party/wiredtiger/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/third_party/wiredtiger/src/include/cursor.h b/src/third_party/wiredtiger/src/include/cursor.h
index 23d3f3745db..76d79d17b2a 100644
--- a/src/third_party/wiredtiger/src/include/cursor.h
+++ b/src/third_party/wiredtiger/src/include/cursor.h
@@ -291,8 +291,8 @@ struct __wt_cursor_join_entry {
WT_INDEX *index;
WT_CURSOR *main; /* raw main table cursor */
WT_BLOOM *bloom; /* Bloom filter handle */
- uint64_t bloom_bit_count; /* bits per item in bloom */
- uint64_t bloom_hash_count; /* hash functions in bloom */
+ uint32_t bloom_bit_count; /* bits per item in bloom */
+ uint32_t bloom_hash_count; /* hash functions in bloom */
uint64_t count; /* approx number of matches */
#define WT_CURJOIN_ENTRY_BLOOM 0x01 /* use a bloom filter */
diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h
index 743a3c3ac31..3cbbb7b0072 100644
--- a/src/third_party/wiredtiger/src/include/extern.h
+++ b/src/third_party/wiredtiger/src/include/extern.h
@@ -279,7 +279,7 @@ extern int __wt_curfile_open(WT_SESSION_IMPL *session, const char *uri, WT_CURSO
extern int __wt_curindex_joined(WT_CURSOR *cursor);
extern int __wt_curindex_open(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_CURSOR **cursorp);
extern int __wt_curjoin_open(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_CURSOR **cursorp);
-extern int __wt_curjoin_join(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin, WT_INDEX *idx, WT_CURSOR *ref_cursor, uint32_t flags, uint32_t range, uint64_t count, uint64_t bloom_bit_count, uint64_t bloom_hash_count);
+extern int __wt_curjoin_join(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin, WT_INDEX *idx, WT_CURSOR *ref_cursor, uint8_t flags, uint8_t range, uint64_t count, uint32_t bloom_bit_count, uint32_t bloom_hash_count);
extern int __wt_json_alloc_unpack(WT_SESSION_IMPL *session, const void *buffer, size_t size, const char *fmt, WT_CURSOR_JSON *json, bool iskey, va_list ap);
extern void __wt_json_close(WT_SESSION_IMPL *session, WT_CURSOR *cursor);
extern size_t __wt_json_unpack_char(char ch, u_char *buf, size_t bufsz, bool force_unicode);
diff --git a/src/third_party/wiredtiger/src/log/log.c b/src/third_party/wiredtiger/src/log/log.c
index 3106094e7e3..118e081c3ec 100644
--- a/src/third_party/wiredtiger/src/log/log.c
+++ b/src/third_party/wiredtiger/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/third_party/wiredtiger/src/packing/pack_impl.c b/src/third_party/wiredtiger/src/packing/pack_impl.c
index 447c887dc6f..30d28dfb63c 100644
--- a/src/third_party/wiredtiger/src/packing/pack_impl.c
+++ b/src/third_party/wiredtiger/src/packing/pack_impl.c
@@ -144,19 +144,18 @@ __wt_struct_unpack_size(WT_SESSION_IMPL *session,
*/
int
__wt_struct_repack(WT_SESSION_IMPL *session, const char *infmt,
- const char *outfmt, const WT_ITEM *inbuf, WT_ITEM *outbuf,
- void **reallocp)
+ const char *outfmt, const WT_ITEM *inbuf, WT_ITEM *outbuf, void **reallocp)
{
WT_DECL_PACK_VALUE(pvin);
WT_DECL_PACK_VALUE(pvout);
WT_DECL_RET;
WT_PACK packin, packout;
const uint8_t *before, *end, *p;
- uint8_t *newbuf, *pout;
+ uint8_t *pout;
size_t len;
const void *start;
- start = newbuf = NULL;
+ start = NULL;
p = inbuf->data;
end = p + inbuf->size;
diff --git a/src/third_party/wiredtiger/src/session/session_api.c b/src/third_party/wiredtiger/src/session/session_api.c
index db81623c613..12f7ce2ec3f 100644
--- a/src/third_party/wiredtiger/src/session/session_api.c
+++ b/src/third_party/wiredtiger/src/session/session_api.c
@@ -646,26 +646,24 @@ __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;
- uint32_t flags, range;
uint64_t count;
- uint64_t bloom_bit_count, bloom_hash_count;
+ uint32_t bloom_bit_count, bloom_hash_count;
+ uint8_t flags, range;
count = 0;
session = (WT_SESSION_IMPL *)wt_session;
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;
@@ -721,20 +714,23 @@ __session_join(WT_SESSION *wt_session, WT_CURSOR *join_cursor,
WT_ERR(EINVAL);
}
WT_ERR(__wt_config_gets(session, cfg, "bloom_bit_count", &cval));
- bloom_bit_count = (uint64_t)cval.val;
+ if ((uint64_t)cval.val > UINT32_MAX)
+ WT_ERR_MSG(session, EINVAL,
+ "bloom_bit_count: value too large");
+ bloom_bit_count = (uint32_t)cval.val;
WT_ERR(__wt_config_gets(session, cfg, "bloom_hash_count", &cval));
- bloom_hash_count = (uint64_t)cval.val;
+ if ((uint64_t)cval.val > UINT32_MAX)
+ WT_ERR_MSG(session, EINVAL,
+ "bloom_hash_count: value too large");
+ 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));
@@ -1011,10 +1007,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);