Skip to content

Commit

Permalink
WT-2592 Fix joins for the non-recno, non-raw case (#2705)
Browse files Browse the repository at this point in the history
WT-2592 Fix joins for the non-recno, non-raw case.  Also detect a failed search as the last step of the WT_CURSOR::next() operation, and distinguish it from WT_NOTFOUND.
  • Loading branch information
ddanderson committed May 2, 2016
1 parent 29c36f5 commit 9249703
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/cursor/cur_join.c
Expand Up @@ -1076,7 +1076,6 @@ __curjoin_next(WT_CURSOR *cursor)
WT_CURSOR_JOIN_ITER *iter;
WT_DECL_RET;
WT_SESSION_IMPL *session;
const uint8_t *p;
int tret;

cjoin = (WT_CURSOR_JOIN *)cursor;
Expand Down Expand Up @@ -1104,19 +1103,17 @@ __curjoin_next(WT_CURSOR *cursor)

if (ret == 0) {
/*
* Position the 'main' cursor, this will be used to
* retrieve values from the cursor join.
* Position the 'main' cursor, this will be used to retrieve
* values from the cursor join. The key we have is raw, but
* the main cursor may not be raw.
*/
c = cjoin->main;
if (WT_CURSOR_RECNO(cursor) &&
!F_ISSET(cursor, WT_CURSTD_RAW)) {
p = (const uint8_t *)iter->curkey->data;
WT_ERR(__wt_vunpack_uint(&p, iter->curkey->size,
&cjoin->iface.recno));
c->set_key(c, cjoin->iface.recno);
} else
c->set_key(c, iter->curkey);
WT_ERR(c->search(c));
__wt_cursor_set_raw_key(c, iter->curkey);

/* A failed search is not expected, don't return WT_NOTFOUND. */
if ((ret = c->search(c)) == WT_NOTFOUND)
ret = WT_ERROR;
WT_ERR(ret);
F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT);
} else if (ret == WT_NOTFOUND &&
(tret = __curjoin_iter_close_all(iter)) != 0)
Expand Down

0 comments on commit 9249703

Please sign in to comment.