diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2018-03-13 19:50:49 -0400 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2018-03-15 18:51:03 -0400 |
commit | b762003b0b692fe78658e675f06495f132af442c (patch) | |
tree | ae6acbc0270ec93adfb8f9654ea830839b42dc6e /jstests/noPassthrough/readConcern_snapshot.js | |
parent | d0dea93d632ce451b66b57b538e66f3e1378b049 (diff) | |
download | mongo-b762003b0b692fe78658e675f06495f132af442c.tar.gz |
SERVER-33591 Cleanup interaction of write concerns and transactions
Diffstat (limited to 'jstests/noPassthrough/readConcern_snapshot.js')
-rw-r--r-- | jstests/noPassthrough/readConcern_snapshot.js | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/jstests/noPassthrough/readConcern_snapshot.js b/jstests/noPassthrough/readConcern_snapshot.js index 429488b6cd9..e7ff6b63b40 100644 --- a/jstests/noPassthrough/readConcern_snapshot.js +++ b/jstests/noPassthrough/readConcern_snapshot.js @@ -161,22 +161,18 @@ }), ErrorCodes.InvalidOptions); - // TODO SERVER-33592 Move all write related commands out of this test file when writes + // TODO SERVER-33412 Move all write related commands out of this test file when writes // with snapshot read concern are only allowed in transactions. // readConcern 'snapshot' is supported by insert. assert.commandWorked(sessionDb.runCommand({ insert: collName, documents: [{_id: "single-insert"}], readConcern: {level: "snapshot"}, + writeConcern: {w: "majority"}, txnNumber: NumberLong(txnNumber++) })); assert.eq({_id: "single-insert"}, sessionDb.coll.findOne({_id: "single-insert"})); - // Wait for the last write to be committed since they will update the same session entry. - // TODO SERVER-33592 remove the following write when writes with snapshot read concern - // are only allowed in transactions. - assert.commandWorked( - sessionDb.coll.insert({_id: "dummy-insert"}, {writeConcern: {w: "majority"}})); // readConcern 'snapshot' is supported by batch insert. assert.commandWorked(sessionDb.runCommand({ insert: collName, @@ -214,29 +210,21 @@ delete: collName, deletes: [{q: {}, limit: 1}], readConcern: {level: "snapshot"}, + writeConcern: {w: "majority"}, txnNumber: NumberLong(txnNumber++) })); - // TODO SERVER-33591: Remove once snapshot writes use majority writeConcern. - // Perform majority write to ensure any previous writes are part of the majority commit - // snapshot. - assert.commandWorked(sessionDb.coll.insert({}, {writeConcern: {w: "majority"}})); - // readConcern 'snapshot' is supported by findAndModify. assert.commandWorked(sessionDb.runCommand({ findAndModify: collName, query: {_id: 1}, update: {$set: {b: 1}}, readConcern: {level: "snapshot"}, + writeConcern: {w: "majority"}, txnNumber: NumberLong(txnNumber++), })); assert.eq({_id: 1, a: 1, b: 1}, sessionDb.coll.findOne({_id: 1})); - // TODO SERVER-33591: Remove once snapshot writes use majority writeConcern. - // Perform majority write to ensure any previous writes are part of the majority commit - // snapshot. - assert.commandWorked(sessionDb.coll.insert({}, {writeConcern: {w: "majority"}})); - assert.commandWorked(sessionDb.runCommand({ findAndModify: collName, query: {_id: 1}, |