summaryrefslogtreecommitdiff
path: root/src/include/cursor.i
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2015-04-15 09:44:13 -0400
committerKeith Bostic <keith@wiredtiger.com>2015-04-15 09:44:13 -0400
commit72ccd267fea9e491fcf3506e85191f71471cf51a (patch)
treef20b00a9957f6d3e63a1da9d0d8c01e30ad8132e /src/include/cursor.i
parent5482d15c0eccdf0d171ca83f9cd540a37e37213f (diff)
downloadmongo-72ccd267fea9e491fcf3506e85191f71471cf51a.tar.gz
A WT_CURSOR.next operation followed by a WT_CURSOR.search has the same
problem as referenced in #1887: the key returned to the application is in WT_CURSOR_BTREE.tmp, and that WT_ITEM is used as temporary storage during the search of a row-store leaf page, so the search can overwrite the search key while it's still in use. Change WT_CURSOR.next to return the ey in WT_CURSOR_BTREE.search_key. Rename WT_CURSOR_BTREE.search_key to be WT_CURSOR_BTREE.row_key, it's exclusive to row-store, and no longer exclusive to search.
Diffstat (limited to 'src/include/cursor.i')
-rw-r--r--src/include/cursor.i17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/include/cursor.i b/src/include/cursor.i
index 687255430d0..57c19f50417 100644
--- a/src/include/cursor.i
+++ b/src/include/cursor.i
@@ -264,7 +264,7 @@ __cursor_row_slot_return(WT_CURSOR_BTREE *cbt, WT_ROW *rip, WT_UPDATE *upd)
__wt_cell_unpack(cell, unpack);
if (unpack->type == WT_CELL_KEY &&
cbt->rip_saved != NULL && cbt->rip_saved == rip - 1) {
- WT_ASSERT(session, cbt->tmp->size >= unpack->prefix);
+ WT_ASSERT(session, cbt->row_key->size >= unpack->prefix);
/*
* Grow the buffer as necessary as well as ensure data has been
@@ -274,21 +274,22 @@ __cursor_row_slot_return(WT_CURSOR_BTREE *cbt, WT_ROW *rip, WT_UPDATE *upd)
* Don't grow the buffer unnecessarily or copy data we don't
* need, truncate the item's data length to the prefix bytes.
*/
- cbt->tmp->size = unpack->prefix;
+ cbt->row_key->size = unpack->prefix;
WT_RET(__wt_buf_grow(
- session, cbt->tmp, cbt->tmp->size + unpack->size));
- memcpy((uint8_t *)cbt->tmp->data + cbt->tmp->size,
+ session, cbt->row_key, cbt->row_key->size + unpack->size));
+ memcpy((uint8_t *)cbt->row_key->data + cbt->row_key->size,
unpack->data, unpack->size);
- cbt->tmp->size += unpack->size;
+ cbt->row_key->size += unpack->size;
} else {
/*
* Call __wt_row_leaf_key_work instead of __wt_row_leaf_key: we
* already did __wt_row_leaf_key's fast-path checks inline.
*/
-slow: WT_RET(__wt_row_leaf_key_work(session, page, rip, cbt->tmp, 0));
+slow: WT_RET(__wt_row_leaf_key_work(
+ session, page, rip, cbt->row_key, 0));
}
- kb->data = cbt->tmp->data;
- kb->size = cbt->tmp->size;
+ kb->data = cbt->row_key->data;
+ kb->size = cbt->row_key->size;
cbt->rip_saved = rip;
value: