summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/btree/col_modify.c
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-09-11 16:23:54 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-09-11 16:23:54 +1000
commit58c7ad85c90619d4fa0e7e4df3b9f4d643b9b73b (patch)
tree63cfbe95d22f14a3d3366d68976df0d739318e9c /src/third_party/wiredtiger/src/btree/col_modify.c
parent8b205afd0ae74fd7351bc183e39b8931044f3987 (diff)
downloadmongo-58c7ad85c90619d4fa0e7e4df3b9f4d643b9b73b.tar.gz
Import wiredtiger-wiredtiger-2.6.1-1056-g5205bb1.tar.gz from wiredtiger branch mongodb-3.2
Diffstat (limited to 'src/third_party/wiredtiger/src/btree/col_modify.c')
-rw-r--r--src/third_party/wiredtiger/src/btree/col_modify.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/third_party/wiredtiger/src/btree/col_modify.c b/src/third_party/wiredtiger/src/btree/col_modify.c
index fb7c9a1ce90..cbc5143698b 100644
--- a/src/third_party/wiredtiger/src/btree/col_modify.c
+++ b/src/third_party/wiredtiger/src/btree/col_modify.c
@@ -17,7 +17,7 @@ static int __col_insert_alloc(
*/
int
__wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
- uint64_t recno, WT_ITEM *value, WT_UPDATE *upd, int is_remove)
+ uint64_t recno, WT_ITEM *value, WT_UPDATE *upd_arg, int is_remove)
{
WT_BTREE *btree;
WT_DECL_RET;
@@ -25,7 +25,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
WT_INSERT_HEAD *ins_head, **ins_headp;
WT_ITEM _value;
WT_PAGE *page;
- WT_UPDATE *old_upd;
+ WT_UPDATE *old_upd, *upd;
size_t ins_size, upd_size;
u_int i, skipdepth;
int append, logged;
@@ -33,6 +33,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
btree = cbt->btree;
ins = NULL;
page = cbt->ref->page;
+ upd = upd_arg;
append = logged = 0;
/* This code expects a remove to have a NULL value. */
@@ -48,10 +49,10 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
* There's some chance the application specified a record past
* the last record on the page. If that's the case, and we're
* inserting a new WT_INSERT/WT_UPDATE pair, it goes on the
- * append list, not the update list. In addition, a recno of 0
+ * append list, not the update list. Also, an out-of-band recno
* implies an append operation, we're allocating a new row.
*/
- if (recno == 0 ||
+ if (recno == WT_RECNO_OOB ||
recno > (btree->type == BTREE_COL_VAR ?
__col_var_last_recno(page) : __col_fix_last_recno(page)))
append = 1;
@@ -76,7 +77,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
* If we are restoring updates that couldn't be evicted, the
* key must not exist on the new page.
*/
- WT_ASSERT(session, upd == NULL);
+ WT_ASSERT(session, upd_arg == NULL);
/* Make sure the update can proceed. */
WT_ERR(__wt_txn_update_check(
@@ -134,7 +135,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
cbt->ins_head = ins_head;
cbt->ins = ins;
- if (upd == NULL) {
+ if (upd_arg == NULL) {
WT_ERR(
__wt_update_alloc(session, value, &upd, &upd_size));
WT_ERR(__wt_txn_modify(session, upd));
@@ -160,7 +161,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt,
* The serial mutex acts as our memory barrier to flush these
* writes before inserting them into the list.
*/
- if (cbt->ins_stack[0] == NULL || recno == 0)
+ if (cbt->ins_stack[0] == NULL || recno == WT_RECNO_OOB)
for (i = 0; i < skipdepth; i++) {
cbt->ins_stack[i] = &ins_head->head[i];
ins->next[i] = cbt->next_stack[i] = NULL;
@@ -192,7 +193,8 @@ err: /*
if (logged)
__wt_txn_unmodify(session);
__wt_free(session, ins);
- __wt_free(session, upd);
+ if (upd_arg == NULL)
+ __wt_free(session, upd);
}
return (ret);