diff options
author | Matt Kangas <matt.kangas@mongodb.com> | 2014-11-09 21:46:51 -0500 |
---|---|---|
committer | Matt Kangas <matt.kangas@mongodb.com> | 2014-11-09 21:46:51 -0500 |
commit | 4d7a2c7dd8c29059a2f8b7f6c74aec9817e02de7 (patch) | |
tree | 42402ef263816679254a7d6211c4fb8d26aa1e78 /src/third_party/wiredtiger/src/cursor/cur_table.c | |
parent | ec899cc692d4edfe128130fa5fc7d778e494dee7 (diff) | |
download | mongo-4d7a2c7dd8c29059a2f8b7f6c74aec9817e02de7.tar.gz |
Import wiredtiger-wiredtiger-2.4.0-275-gc4f14ea.tar.gz from wiredtiger branch develop
Diffstat (limited to 'src/third_party/wiredtiger/src/cursor/cur_table.c')
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_table.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/third_party/wiredtiger/src/cursor/cur_table.c b/src/third_party/wiredtiger/src/cursor/cur_table.c index 4ab55b10f5a..0146e0999a4 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_table.c +++ b/src/third_party/wiredtiger/src/cursor/cur_table.c @@ -505,6 +505,7 @@ static int __curtable_update(WT_CURSOR *cursor) { WT_CURSOR_TABLE *ctable; + WT_DECL_ITEM(value_copy); WT_DECL_RET; WT_SESSION_IMPL *session; @@ -519,28 +520,32 @@ __curtable_update(WT_CURSOR *cursor) * old index keys, so we make a temporary copy of the new value. */ if (ctable->table->nindices > 0) { + WT_ERR(__wt_scr_alloc( + session, ctable->cg_cursors[0]->value.size, &value_copy)); WT_ERR(__wt_schema_project_merge(session, ctable->cg_cursors, ctable->plan, - cursor->value_format, &cursor->value)); + cursor->value_format, value_copy)); APPLY_CG(ctable, search); - /* - * Remove only if the key exists. - */ + + /* Remove only if the key exists. */ if (ret == 0) { WT_ERR( __apply_idx(ctable, offsetof(WT_CURSOR, remove))); WT_ERR(__wt_schema_project_slice(session, ctable->cg_cursors, ctable->plan, 0, - cursor->value_format, &cursor->value)); + cursor->value_format, value_copy)); } else WT_ERR_NOTFOUND_OK(ret); } + APPLY_CG(ctable, update); WT_ERR(ret); - if (ctable->idx_cursors != NULL) + + if (ctable->table->nindices > 0) WT_ERR(__apply_idx(ctable, offsetof(WT_CURSOR, insert))); err: CURSOR_UPDATE_API_END(session, ret); + __wt_scr_free(&value_copy); return (ret); } |