diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2019-02-13 13:45:32 -0500 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2019-02-25 15:39:00 -0500 |
commit | dbf6e7832948aef18a2bde086f6e8de20d65b2f1 (patch) | |
tree | 000b7fe2da7674ff3a4a3aa5c62632855458d31c /jstests/noPassthrough | |
parent | 369a2e0432c27b20b106056e2f2e0849cab617f0 (diff) | |
download | mongo-dbf6e7832948aef18a2bde086f6e8de20d65b2f1.tar.gz |
SERVER-39418 Ban atClusterTime with enableMajorityReadConcern=false
Diffstat (limited to 'jstests/noPassthrough')
4 files changed, 22 insertions, 4 deletions
diff --git a/jstests/noPassthrough/crud_timestamps.js b/jstests/noPassthrough/crud_timestamps.js index 390a85727a2..acefe323cac 100644 --- a/jstests/noPassthrough/crud_timestamps.js +++ b/jstests/noPassthrough/crud_timestamps.js @@ -1,4 +1,4 @@ -// @tags: [requires_replication, uses_transactions] +// @tags: [requires_replication, uses_transactions, uses_atclustertime] // Test the correct timestamping of insert, update, and delete writes along with their accompanying // index updates. diff --git a/jstests/noPassthrough/readConcern_atClusterTime.js b/jstests/noPassthrough/readConcern_atClusterTime.js index b2e5b6ac9f8..ec38d6d776a 100644 --- a/jstests/noPassthrough/readConcern_atClusterTime.js +++ b/jstests/noPassthrough/readConcern_atClusterTime.js @@ -2,7 +2,7 @@ // // Only run this test with the WiredTiger storage engine, since we expect other storage engines to // return early because they do not support snapshot read concern. -// @tags: [requires_wiredtiger, uses_transactions] +// @tags: [requires_wiredtiger, uses_transactions, uses_atclustertime] function _getClusterTime(rst) { const pingRes = assert.commandWorked(rst.getPrimary().adminCommand({ping: 1})); @@ -149,4 +149,22 @@ function _getClusterTime(rst) { rst.stopSet(); } + // readConcern with 'atClusterTime' is not allowed when enableMajorityReadConcern=false. + { + let rst = new ReplSetTest({nodes: [{"enableMajorityReadConcern": "false"}]}); + rst.startSet(); + rst.initiate(); + let session = + rst.getPrimary().getDB(dbName).getMongo().startSession({causalConsistency: false}); + let sessionDb = session.getDatabase(dbName); + session.startTransaction( + {readConcern: {level: "snapshot", atClusterTime: _getClusterTime(rst)}}); + assert.commandFailedWithCode(sessionDb.runCommand({find: collName}), + ErrorCodes.InvalidOptions); + assert.commandFailedWithCode(session.abortTransaction_forTesting(), + ErrorCodes.NoSuchTransaction); + session.endSession(); + rst.stopSet(); + } + }()); diff --git a/jstests/noPassthrough/readConcern_atClusterTime_noop_write.js b/jstests/noPassthrough/readConcern_atClusterTime_noop_write.js index 00899fc0eda..4c6308d38ee 100644 --- a/jstests/noPassthrough/readConcern_atClusterTime_noop_write.js +++ b/jstests/noPassthrough/readConcern_atClusterTime_noop_write.js @@ -1,7 +1,7 @@ // Test that 'atClusterTime' triggers a noop write to advance the lastApplied optime if // necessary. This covers the case where a read is done at a cluster time that is only present // as an actual opTime on another shard. -// @tags: [requires_sharding, uses_transactions] +// @tags: [requires_sharding, uses_transactions, uses_atclustertime] (function() { "use strict"; load("jstests/replsets/rslib.js"); diff --git a/jstests/noPassthrough/readConcern_snapshot_mongos.js b/jstests/noPassthrough/readConcern_snapshot_mongos.js index 539857a8fff..e318cf75932 100644 --- a/jstests/noPassthrough/readConcern_snapshot_mongos.js +++ b/jstests/noPassthrough/readConcern_snapshot_mongos.js @@ -1,5 +1,5 @@ // Test parsing of readConcern level 'snapshot' on mongos. -// @tags: [requires_replication,requires_sharding, uses_transactions] +// @tags: [requires_replication,requires_sharding, uses_transactions, uses_atclustertime] (function() { "use strict"; |