summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-07-29 16:33:39 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2016-08-02 16:45:36 +1000
commit0e2688962045ecd11309f5175b77b7fb5fce7f44 (patch)
tree39758eb7cdc676030685057690f81908f3ab067d
parentf41b9ca197e703aea6a22c787a86dba81e82723e (diff)
downloadmongo-0e2688962045ecd11309f5175b77b7fb5fce7f44.tar.gz
WT-2802 Copy values during commit before releasing snapshot. (#2917)
(cherry picked from commit 8f3e5f31da8dbe2e388ae42afc602dd982808792)
-rw-r--r--src/session/session_api.c5
-rw-r--r--src/txn/txn.c18
2 files changed, 15 insertions, 8 deletions
diff --git a/src/session/session_api.c b/src/session/session_api.c
index f71ff8ea71c..cfd4c13ab2d 100644
--- a/src/session/session_api.c
+++ b/src/session/session_api.c
@@ -43,6 +43,11 @@ __wt_session_copy_values(WT_SESSION_IMPL *session)
TAILQ_FOREACH(cursor, &session->cursors, q)
if (F_ISSET(cursor, WT_CURSTD_VALUE_INT)) {
+ /* We have to do this with a transaction ID pinned. */
+ WT_ASSERT(session,
+ WT_SESSION_TXN_STATE(session)->snap_min !=
+ WT_TXN_NONE);
+
F_CLR(cursor, WT_CURSTD_VALUE_INT);
WT_RET(__wt_buf_set(session, &cursor->value,
cursor->value.data, cursor->value.size));
diff --git a/src/txn/txn.c b/src/txn/txn.c
index f9af9589172..de67ef4bdd4 100644
--- a/src/txn/txn.c
+++ b/src/txn/txn.c
@@ -408,6 +408,16 @@ __wt_txn_commit(WT_SESSION_IMPL *session, const char *cfg[])
WT_TRET(txn->notify->notify(txn->notify,
(WT_SESSION *)session, txn->id, 1));
+ /*
+ * We are about to release the snapshot: copy values into any
+ * positioned cursors so they don't point to updates that could be
+ * freed once we don't have a snapshot.
+ */
+ if (session->ncursors > 0) {
+ WT_DIAGNOSTIC_YIELD;
+ WT_RET(__wt_session_copy_values(session));
+ }
+
/* If we are logging, write a commit log record. */
if (ret == 0 && txn->mod_count > 0 &&
FLD_ISSET(S2C(session)->log_flags, WT_CONN_LOG_ENABLED) &&
@@ -437,14 +447,6 @@ __wt_txn_commit(WT_SESSION_IMPL *session, const char *cfg[])
__wt_txn_op_free(session, op);
txn->mod_count = 0;
- /*
- * We are about to release the snapshot: copy values into any
- * positioned cursors so they don't point to updates that could be
- * freed once we don't have a transaction ID pinned.
- */
- if (session->ncursors > 0)
- WT_RET(__wt_session_copy_values(session));
-
__wt_txn_release(session);
return (0);
}