diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-08-28 12:13:08 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-08-28 12:13:08 -0400 |
commit | ce60193ba145450021e2872552d64da50b7c0d87 (patch) | |
tree | c48e3c14d508a54d3f1465a9fa9f98de4433907b | |
parent | c8bddd13b8cc16ae014f326ec44764c86e47f07f (diff) | |
download | mongo-ce60193ba145450021e2872552d64da50b7c0d87.tar.gz |
The column-store modify code needs the same error path test the row-store
modify code has, don't free the local WT_UPDATE structure on error unless
we actually allocated one.
-rw-r--r-- | src/btree/col_modify.c | 12 | ||||
-rw-r--r-- | src/include/extern.h | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/btree/col_modify.c b/src/btree/col_modify.c index f98c62830e5..cbc5143698b 100644 --- a/src/btree/col_modify.c +++ b/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. */ @@ -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)); @@ -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); diff --git a/src/include/extern.h b/src/include/extern.h index 00967e4fe79..f5ba24b2b97 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -164,7 +164,7 @@ extern int __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]); extern int __wt_verify_dsk_image(WT_SESSION_IMPL *session, const char *tag, const WT_PAGE_HEADER *dsk, size_t size, int empty_page_ok); extern int __wt_verify_dsk(WT_SESSION_IMPL *session, const char *tag, WT_ITEM *buf); extern int __wt_tree_walk(WT_SESSION_IMPL *session, WT_REF **refp, uint64_t *walkcntp, uint32_t flags); -extern int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, uint64_t recno, WT_ITEM *value, WT_UPDATE *upd, int is_remove); +extern int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, uint64_t recno, WT_ITEM *value, WT_UPDATE *upd_arg, int is_remove); extern int __wt_col_search(WT_SESSION_IMPL *session, uint64_t recno, WT_REF *leaf, WT_CURSOR_BTREE *cbt); extern int __wt_row_leaf_keys(WT_SESSION_IMPL *session, WT_PAGE *page); extern int __wt_row_leaf_key_copy( WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip, WT_ITEM *key); |