summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2013-08-02 00:13:19 +1000
committerDon Anderson <dda@ddanderson.com>2013-08-09 16:30:53 -0400
commitb4b2a91c394b9d9d63bd280b3ed27e4fad1e9d2e (patch)
treeac810a370f0e69575ab587fc217d226e9c82753a
parent903683ecdf948a431f86769c286272ec1d9ee5a5 (diff)
downloadmongo-b4b2a91c394b9d9d63bd280b3ed27e4fad1e9d2e.tar.gz
Make a copy of the key after a successful remove.
refs #607
-rw-r--r--src/cursor/cur_file.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c
index 68d482cd5ba..3f2fab6795d 100644
--- a/src/cursor/cur_file.c
+++ b/src/cursor/cur_file.c
@@ -268,12 +268,15 @@ __curfile_remove(WT_CURSOR *cursor)
WT_BTREE_CURSOR_SAVE_AND_RESTORE(cursor, __wt_btcur_remove(cbt), ret);
/*
- * After a successful remove, the key and value are not available.
- * This has to come after the call to resolve the cursor, it sets
- * the same flags we're clearing.
+ * After a successful remove, copy the key: the value is not available.
*/
- if (ret == 0)
- F_CLR(cursor, WT_CURSTD_KEY_RET | WT_CURSTD_VALUE_RET);
+ if (ret == 0) {
+ if (F_ISSET(cursor, WT_CURSTD_KEY_RET) &&
+ !WT_DATA_IN_ITEM(&(cursor)->key))
+ WT_ERR(__wt_buf_set(session, &cursor->key,
+ cursor->key.data, cursor->key.size));
+ F_CLR(cursor, WT_CURSTD_VALUE_SET);
+ }
err: CURSOR_UPDATE_API_END(session, ret);
return (ret);