summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2018-02-22 17:46:42 -0500
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2018-02-26 16:40:44 -0500
commit84da063a67fee56e7e088891dc170fd8dee4147e (patch)
tree914ed07780d9926c4bc7109ab55131b426d20363 /jstests
parentbec56c498da245a2ea16b30c03a5f3cd240d4e26 (diff)
downloadmongo-84da063a67fee56e7e088891dc170fd8dee4147e.tar.gz
SERVER-33477 Always use upsert with _id for session update.
Transactions stash the writes so the in-memory state of transaction table is out of sync during transaction. Two threads (write and chunk migration) will not update the same session entry due to the WCE generated by storage engine.
Diffstat (limited to 'jstests')
-rw-r--r--jstests/noPassthrough/readConcern_snapshot.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/jstests/noPassthrough/readConcern_snapshot.js b/jstests/noPassthrough/readConcern_snapshot.js
index 526a5c17b37..e67cf525736 100644
--- a/jstests/noPassthrough/readConcern_snapshot.js
+++ b/jstests/noPassthrough/readConcern_snapshot.js
@@ -193,17 +193,16 @@
})));
assert.eq({_id: 0, a: 1}, sessionDb.coll.findOne({_id: 0}));
- // readConcern 'snapshot' is not yet supported by multi-statement updates.
+ // readConcern 'snapshot' is supported by multi-statement updates.
assert.commandWorked(sessionDb.coll.insert({_id: 1}, {writeConcern: {w: "majority"}}));
- assert.commandFailedWithCode(sessionDb.runCommand({
+ assert.commandWorked(sessionDb.runCommand({
update: collName,
updates: [{q: {_id: 0}, u: {$inc: {a: 1}}}, {q: {_id: 1}, u: {$inc: {a: 1}}}],
readConcern: {level: "snapshot"},
txnNumber: NumberLong(txnNumber++)
- }),
- ErrorCodes.WriteConflict);
- assert.eq({_id: 0, a: 1}, sessionDb.coll.findOne({_id: 0}));
- assert.eq({_id: 1}, sessionDb.coll.findOne({_id: 1}));
+ }));
+ assert.eq({_id: 0, a: 2}, sessionDb.coll.findOne({_id: 0}));
+ assert.eq({_id: 1, a: 1}, sessionDb.coll.findOne({_id: 1}));
// readConcern 'snapshot' is not supported by delete.
// TODO SERVER-33354: Add snapshot support for delete.