diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2020-08-12 11:49:19 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-12 23:21:21 +0000 |
commit | 09ec1c660b2fc1753d5ee008b6a722b518cf6377 (patch) | |
tree | 890fa434cc88f2fad3a9e703d2d033f9bead8a72 /jstests | |
parent | ffd3325967460d6b41763f53ae41ec2912d6de48 (diff) | |
download | mongo-09ec1c660b2fc1753d5ee008b6a722b518cf6377.tar.gz |
SERVER-50280 Remove 'startSetIfSupportsReadMajority' test helper function in favour of the 'requires_majority_read_concern' tag
Diffstat (limited to 'jstests')
25 files changed, 64 insertions, 201 deletions
diff --git a/jstests/multiVersion/genericChangeStreams/change_streams_feature_compatibility_version.js b/jstests/multiVersion/genericChangeStreams/change_streams_feature_compatibility_version.js index 9b9688f3143..8b76a3d53c8 100644 --- a/jstests/multiVersion/genericChangeStreams/change_streams_feature_compatibility_version.js +++ b/jstests/multiVersion/genericChangeStreams/change_streams_feature_compatibility_version.js @@ -1,12 +1,11 @@ // Test that a change stream is able to survive an upgrade. This is the most basic test to // demonstrate the survival of a stream, presuming the driver will attempt to retry and resume the // stream after network errors. -// @tags: [uses_change_streams] +// @tags: [uses_change_streams, requires_majority_read_concern] (function() { "use strict"; load("jstests/multiVersion/libs/multi_rs.js"); // For upgradeSet. -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. function runTest(downgradeVersion) { jsTestLog("Running test with 'downgradeVersion': " + downgradeVersion); @@ -15,12 +14,7 @@ function runTest(downgradeVersion) { nodeOptions: {binVersion: downgradeVersion}, }); - if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; - } - + rst.startSet(); rst.initiate(); let testDB = rst.getPrimary().getDB(jsTestName()); diff --git a/jstests/multiVersion/genericChangeStreams/change_streams_multi_version_transaction.js b/jstests/multiVersion/genericChangeStreams/change_streams_multi_version_transaction.js index 9bb9c4b8383..4362c4c5a5f 100644 --- a/jstests/multiVersion/genericChangeStreams/change_streams_multi_version_transaction.js +++ b/jstests/multiVersion/genericChangeStreams/change_streams_multi_version_transaction.js @@ -2,12 +2,16 @@ // a change stream after upgrading the replica set to the "latest" mongod, even when the change // stream includes multi-statement transactions. // -// @tags: [uses_change_streams, uses_transactions, requires_replication] +// @tags: [ +// uses_change_streams, +// uses_transactions, +// requires_replication, +// requires_majority_read_concern +// ] (function() { "use strict"; load('jstests/multiVersion/libs/multi_rs.js'); // For upgradeSet. -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. const dbName = jsTestName(); const watchedCollName = "change_stream_watched"; @@ -94,13 +98,8 @@ function runTest(downgradeVersion) { nodeOptions: {binVersion: downgradeVersion}, }); - if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; - } - jsTestLog("Running test with 'downgradeVersion': " + downgradeVersion); + rst.startSet(); rst.initiate(); rst.getPrimary().getDB(dbName).createCollection(watchedCollName); diff --git a/jstests/noPassthrough/change_stream_concurrent_implicit_db_create.js b/jstests/noPassthrough/change_stream_concurrent_implicit_db_create.js index ff211b2424f..5a1e39291a1 100644 --- a/jstests/noPassthrough/change_stream_concurrent_implicit_db_create.js +++ b/jstests/noPassthrough/change_stream_concurrent_implicit_db_create.js @@ -2,17 +2,12 @@ // an order that avoids a deadlock. // This test was designed to reproduce SERVER-34333. // This test uses the WiredTiger storage engine, which does not support running without journaling. -// @tags: [requires_replication,requires_journaling] +// @tags: [requires_replication, requires_journaling, requires_majority_read_concern] (function() { "use strict"; -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. const rst = new ReplSetTest({nodes: 1}); -if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; -} +rst.startSet(); rst.initiate(); const db = rst.getPrimary().getDB("test"); diff --git a/jstests/noPassthrough/change_stream_failover.js b/jstests/noPassthrough/change_stream_failover.js index ca14d36ea0a..5851848969a 100644 --- a/jstests/noPassthrough/change_stream_failover.js +++ b/jstests/noPassthrough/change_stream_failover.js @@ -1,20 +1,14 @@ // Test resuming a change stream on a node other than the one it was started on. Accomplishes this // by triggering a stepdown. // This test uses the WiredTiger storage engine, which does not support running without journaling. -// @tags: [requires_replication,requires_journaling] +// @tags: [requires_replication, requires_journaling, requires_majority_read_concern] (function() { "use strict"; load("jstests/libs/change_stream_util.js"); // For ChangeStreamTest. load("jstests/libs/collection_drop_recreate.js"); // For assert[Drop|Create]Collection. -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. const rst = new ReplSetTest({nodes: 3}); -if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; -} - +rst.startSet(); rst.initiate(); for (let key of Object.keys(ChangeStreamWatchMode)) { diff --git a/jstests/noPassthrough/change_streams_require_majority_read_concern.js b/jstests/noPassthrough/change_streams_require_majority_read_concern.js index 8bae0bcc287..59592c32428 100644 --- a/jstests/noPassthrough/change_streams_require_majority_read_concern.js +++ b/jstests/noPassthrough/change_streams_require_majority_read_concern.js @@ -1,9 +1,8 @@ // Tests that the $changeStream requires read concern majority. -// @tags: [uses_change_streams] +// @tags: [uses_change_streams, requires_majority_read_concern] (function() { "use strict"; -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. load("jstests/libs/change_stream_util.js"); // For ChangeStreamTest. load("jstests/libs/namespace_utils.js"); // For getCollectionNameFromFullNamespace. load("jstests/libs/write_concern_util.js"); // For stopReplicationOnSecondaries. @@ -18,12 +17,7 @@ if (jsTest.options().noJournal && return; } -if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; -} - +rst.startSet(); rst.initiate(); const name = "change_stream_require_majority_read_concern"; diff --git a/jstests/noPassthrough/change_streams_required_privileges.js b/jstests/noPassthrough/change_streams_required_privileges.js index 137896a3f8f..d5f40c8fe47 100644 --- a/jstests/noPassthrough/change_streams_required_privileges.js +++ b/jstests/noPassthrough/change_streams_required_privileges.js @@ -1,17 +1,11 @@ // Tests that a change stream requires the correct privileges to be run. // This test uses the WiredTiger storage engine, which does not support running without journaling. -// @tags: [requires_replication,requires_journaling] +// @tags: [requires_replication, requires_journaling, requires_majority_read_concern] (function() { "use strict"; -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. - const rst = new ReplSetTest({nodes: 1}); -if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; -} +rst.startSet(); rst.initiate(); const password = "test_password"; rst.getPrimary().getDB("admin").createUser( diff --git a/jstests/noPassthrough/change_streams_shell_helper_resume_token.js b/jstests/noPassthrough/change_streams_shell_helper_resume_token.js index 0e62c649d00..d9c68710dc7 100644 --- a/jstests/noPassthrough/change_streams_shell_helper_resume_token.js +++ b/jstests/noPassthrough/change_streams_shell_helper_resume_token.js @@ -2,21 +2,16 @@ * Tests that the cursor.getResumeToken() shell helper behaves as expected, tracking the resume * token with each document and returning the postBatchResumeToken as soon as each batch is * exhausted. - * @tags: [requires_journaling] + * @tags: [requires_journaling, requires_majority_read_concern] */ (function() { "use strict"; load("jstests/libs/collection_drop_recreate.js"); // For assert[Drop|Create]Collection. -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. // Create a new single-node replica set, and ensure that it can support $changeStream. const rst = new ReplSetTest({nodes: 1}); -if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; -} +rst.startSet(); rst.initiate(); const db = rst.getPrimary().getDB(jsTestName()); diff --git a/jstests/noPassthrough/out_majority_read_replset.js b/jstests/noPassthrough/out_majority_read_replset.js index 9bef6fe2fb6..67b13e74443 100644 --- a/jstests/noPassthrough/out_majority_read_replset.js +++ b/jstests/noPassthrough/out_majority_read_replset.js @@ -1,9 +1,8 @@ // Tests the $out and read concern majority. -// @tags: [resumable_index_build_incompatible] +// @tags: [resumable_index_build_incompatible, requires_majority_read_concern] (function() { "use strict"; -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. load("jstests/libs/write_concern_util.js"); // For stopReplicationOnSecondaries. // This test create indexes with majority of nodes not avialable for replication. So, disabling @@ -21,12 +20,7 @@ if (jsTest.options().noJournal && return; } -if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; -} - +rst.startSet(); rst.initiate(); const name = "out_majority_read"; diff --git a/jstests/noPassthrough/report_post_batch_resume_token_mongod.js b/jstests/noPassthrough/report_post_batch_resume_token_mongod.js index 389151169a6..e1460319290 100644 --- a/jstests/noPassthrough/report_post_batch_resume_token_mongod.js +++ b/jstests/noPassthrough/report_post_batch_resume_token_mongod.js @@ -1,20 +1,15 @@ /** * Tests mongoD-specific semantics of postBatchResumeToken for $changeStream aggregations. - * @tags: [uses_transactions] + * @tags: [uses_transactions, requires_majority_read_concern] */ (function() { "use strict"; load("jstests/libs/collection_drop_recreate.js"); // For assert[Drop|Create]Collection. -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. // Create a new single-node replica set, and ensure that it can support $changeStream. const rst = new ReplSetTest({nodes: 1}); -if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; -} +rst.startSet(); rst.initiate(); const db = rst.getPrimary().getDB(jsTestName()); diff --git a/jstests/replsets/command_response_operation_time.js b/jstests/replsets/command_response_operation_time.js index fae5c8eeb65..cd5fbcd070d 100644 --- a/jstests/replsets/command_response_operation_time.js +++ b/jstests/replsets/command_response_operation_time.js @@ -7,8 +7,6 @@ (function() { "use strict"; -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. - function assertCorrectOperationTime(operationTime, expectedTimestamp, opTimeType) { assert.eq(0, timestampCmp(operationTime, expectedTimestamp), @@ -21,12 +19,7 @@ var name = "command_response_operation_time"; var replTest = new ReplSetTest( {name: name, nodes: 3, nodeOptions: {enableMajorityReadConcern: ""}, waitForKeys: true}); - -if (!startSetIfSupportsReadMajority(replTest)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - replTest.stopSet(); - return; -} +replTest.startSet(); replTest.initiate(); var res, statusRes; diff --git a/jstests/replsets/last_op_visible.js b/jstests/replsets/last_op_visible.js index 94a0b32cbf0..b3b6a7c4bcf 100644 --- a/jstests/replsets/last_op_visible.js +++ b/jstests/replsets/last_op_visible.js @@ -4,21 +4,13 @@ // We then confirm that a writeConcern majority write will be seen as the lastVisibleOp by a // majority read. // @tags: [requires_majority_read_concern] - -load("jstests/replsets/rslib.js"); - (function() { "use strict"; var name = 'lastOpVisible'; var replTest = new ReplSetTest( {name: name, nodes: 3, nodeOptions: {enableMajorityReadConcern: ''}, waitForKeys: true}); - -if (!startSetIfSupportsReadMajority(replTest)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - replTest.stopSet(); - return; -} +replTest.startSet(); replTest.initiate(); var primary = replTest.getPrimary(); diff --git a/jstests/replsets/minimum_visible_with_cluster_time.js b/jstests/replsets/minimum_visible_with_cluster_time.js index 4b9dc7aa5f2..58797e9e47f 100644 --- a/jstests/replsets/minimum_visible_with_cluster_time.js +++ b/jstests/replsets/minimum_visible_with_cluster_time.js @@ -2,19 +2,13 @@ * Tests that majority reads can complete successfully even when the cluster time is being * increased rapidly while ddl operations are happening. * - * @tags: [requires_replication] + * @tags: [requires_replication, requires_majority_read_concern] */ (function() { 'use strict'; -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. const rst = new ReplSetTest({nodes: 1}); -if (!startSetIfSupportsReadMajority(rst)) { - jsTest.log("skipping test since storage engine doesn't support committed reads"); - rst.stopSet(); - return; -} - +rst.startSet(); rst.initiate(); const primary = rst.getPrimary(); const syncName = 'sync'; diff --git a/jstests/replsets/operation_time_read_and_write_concern.js b/jstests/replsets/operation_time_read_and_write_concern.js index f5c6b8c7720..89e813faeb3 100644 --- a/jstests/replsets/operation_time_read_and_write_concern.js +++ b/jstests/replsets/operation_time_read_and_write_concern.js @@ -1,6 +1,6 @@ /** * Validates the operationTime value in the command response depends on the read/writeConcern of the - * the read/write commmand that produced it. + * the read/write command that produced it. * @tags: [requires_majority_read_concern] */ (function() { @@ -9,19 +9,13 @@ // Skip db hash check because replication is stopped on secondaries. TestData.skipCheckDBHashes = true; -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. load("jstests/libs/write_concern_util.js"); // For stopReplicationOnSecondaries, // restartReplicationOnSecondaries var name = "operation_time_read_and_write_concern"; var replTest = new ReplSetTest( {name: name, nodes: 3, nodeOptions: {enableMajorityReadConcern: ""}, waitForKeys: true}); - -if (!startSetIfSupportsReadMajority(replTest)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - replTest.stopSet(); - return; -} +replTest.startSet(); replTest.initiate(); var res; diff --git a/jstests/replsets/read_committed.js b/jstests/replsets/read_committed.js index 7260fec8698..3792d242375 100644 --- a/jstests/replsets/read_committed.js +++ b/jstests/replsets/read_committed.js @@ -4,10 +4,9 @@ * - With the only data-bearing secondary down, committed reads should not include newly inserted * data. * - When data-bearing node comes back up and catches up, writes should be readable. + * + * @tags: [requires_majority_read_concern] */ - -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. - (function() { "use strict"; @@ -56,12 +55,7 @@ var name = "read_committed"; var replTest = new ReplSetTest({name: name, nodes: 3, nodeOptions: {enableMajorityReadConcern: ''}}); -if (!startSetIfSupportsReadMajority(replTest)) { - jsTest.log("skipping test since storage engine doesn't support committed reads"); - replTest.stopSet(); - return; -} - +replTest.startSet(); var nodes = replTest.nodeList(); var config = { "_id": name, diff --git a/jstests/replsets/read_committed_after_rollback.js b/jstests/replsets/read_committed_after_rollback.js index 68d7d138040..fa4c805f0c7 100644 --- a/jstests/replsets/read_committed_after_rollback.js +++ b/jstests/replsets/read_committed_after_rollback.js @@ -1,23 +1,14 @@ /** - * * Test read committed functionality following a following a rollback. Currently we require that all * snapshots be dropped during rollback, therefore committed reads will block until a new committed * snapshot is available. + * + * @tags: [requires_majority_read_concern] */ -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. - (function() { "use strict"; -function assertCommittedReadsBlock(coll) { - var res = coll.runCommand('find', {"readConcern": {"level": "majority"}, "maxTimeMS": 3000}); - assert.commandFailedWithCode( - res, - ErrorCodes.MaxTimeMSExpired, - "Expected read of " + coll.getFullName() + ' on ' + coll.getMongo().host + " to block"); -} - function doCommittedRead(coll) { var res = coll.runCommand('find', {"readConcern": {"level": "majority"}, "maxTimeMS": 10000}); assert.commandWorked(res, 'reading from ' + coll.getFullName() + ' on ' + coll.getMongo().host); @@ -34,12 +25,7 @@ function doDirtyRead(coll) { var name = "read_committed_after_rollback"; var replTest = new ReplSetTest( {name: name, nodes: 5, useBridge: true, nodeOptions: {enableMajorityReadConcern: ''}}); - -if (!startSetIfSupportsReadMajority(replTest)) { - jsTest.log("skipping test since storage engine doesn't support committed reads"); - replTest.stopSet(); - return; -} +replTest.startSet(); var nodes = replTest.nodeList(); var config = { diff --git a/jstests/replsets/read_committed_lookup.js b/jstests/replsets/read_committed_lookup.js index 18f77f9237a..e1c15ce3ca8 100644 --- a/jstests/replsets/read_committed_lookup.js +++ b/jstests/replsets/read_committed_lookup.js @@ -1,9 +1,10 @@ /** * Tests that a $lookup and $graphLookup stage within an aggregation pipeline will read only * committed data if the pipeline is using a majority readConcern. + * + * @tags: [requires_majority_read_concern] */ -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. load("jstests/libs/read_committed_lib.js"); // For testReadCommittedLookup (function() { @@ -20,11 +21,7 @@ let rst = new ReplSetTest({ } }); -if (!startSetIfSupportsReadMajority(rst)) { - jsTest.log("skipping test since storage engine doesn't support committed reads"); - rst.stopSet(); - return; -} +rst.startSet(); const nodes = rst.nodeList(); const config = { diff --git a/jstests/replsets/read_committed_no_snapshots.js b/jstests/replsets/read_committed_no_snapshots.js index 9cb4835727c..72f468e3c03 100644 --- a/jstests/replsets/read_committed_no_snapshots.js +++ b/jstests/replsets/read_committed_no_snapshots.js @@ -3,9 +3,11 @@ * - Reads with an 'afterOpTime' snapshot >= current time should be able to see things that * happened before or at that opTime. * - Reads should time out if there are no snapshots available on secondary. + * + * @tags: [requires_majority_read_concern] */ -load("jstests/replsets/rslib.js"); // For reconfig and startSetIfSupportsReadMajority. +load("jstests/replsets/rslib.js"); // For reconfig. (function() { "use strict"; @@ -26,11 +28,7 @@ var replTest = new ReplSetTest({ settings: {protocolVersion: 1} }); -if (!startSetIfSupportsReadMajority(replTest)) { - jsTest.log("skipping test since storage engine doesn't support committed reads"); - replTest.stopSet(); - return; -} +replTest.startSet(); // Cannot wait for a stable recovery timestamp due to the no-snapshot secondary. replTest.initiateWithAnyNodeAsPrimary( diff --git a/jstests/replsets/read_committed_on_secondary.js b/jstests/replsets/read_committed_on_secondary.js index ae999799879..343fa797932 100644 --- a/jstests/replsets/read_committed_on_secondary.js +++ b/jstests/replsets/read_committed_on_secondary.js @@ -2,10 +2,9 @@ * Test basic read committed functionality on a secondary: * - Updates should not be visible until they are in the blessed snapshot. * - Updates should be visible once they are in the blessed snapshot. + * + * @tags: [requires_majority_read_concern] */ - -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. - (function() { "use strict"; @@ -32,13 +31,7 @@ function log(arg) { var name = "read_committed_on_secondary"; var replTest = new ReplSetTest({name: name, nodes: 3, nodeOptions: {enableMajorityReadConcern: ''}}); - -if (!startSetIfSupportsReadMajority(replTest)) { - log("skipping test since storage engine doesn't support committed reads"); - replTest.stopSet(); - return; -} - +replTest.startSet(); var nodes = replTest.nodeList(); var config = { "_id": name, diff --git a/jstests/replsets/read_committed_stale_history.js b/jstests/replsets/read_committed_stale_history.js index 97ea50423c6..9f868a333cf 100644 --- a/jstests/replsets/read_committed_stale_history.js +++ b/jstests/replsets/read_committed_stale_history.js @@ -1,13 +1,15 @@ /* * Tests that a node on a stale branch of history won't incorrectly mark its ops as committed even * when hearing about a commit point with a higher optime from a new primary. + * + * @tags: [requires_majority_read_concern] */ (function() { 'use strict'; load("jstests/libs/fail_point_util.js"); load("jstests/libs/write_concern_util.js"); -load("jstests/replsets/rslib.js"); +load("jstests/replsets/rslib.js"); // for reconnect. var name = "readCommittedStaleHistory"; var dbName = "wMajorityCheck"; @@ -24,12 +26,7 @@ var rst = new ReplSetTest({ useBridge: true }); -if (!startSetIfSupportsReadMajority(rst)) { - jsTest.log("skipping test since storage engine doesn't support committed reads"); - rst.stopSet(); - return; -} - +rst.startSet(); var nodes = rst.nodes; rst.initiate(); diff --git a/jstests/replsets/read_committed_with_catalog_changes.js b/jstests/replsets/read_committed_with_catalog_changes.js index a1b6bb5d3a4..3918531c416 100644 --- a/jstests/replsets/read_committed_with_catalog_changes.js +++ b/jstests/replsets/read_committed_with_catalog_changes.js @@ -20,10 +20,11 @@ * - repair database * - reindex collection * - compact collection + * + * @tags: [requires_majority_read_concern] */ load("jstests/libs/parallelTester.js"); // For Thread. -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. (function() { "use strict"; @@ -213,12 +214,7 @@ var replTest = new ReplSetTest({ nodeOptions: {enableMajorityReadConcern: '', setParameter: "enableIndexBuildCommitQuorum=false"} }); -if (!startSetIfSupportsReadMajority(replTest)) { - jsTest.log("skipping test since storage engine doesn't support committed reads"); - replTest.stopSet(); - return; -} - +replTest.startSet(); var nodes = replTest.nodeList(); var config = { "_id": name, diff --git a/jstests/replsets/read_majority_two_arbs.js b/jstests/replsets/read_majority_two_arbs.js index 53ac988b6fb..1d79f4f9b95 100644 --- a/jstests/replsets/read_majority_two_arbs.js +++ b/jstests/replsets/read_majority_two_arbs.js @@ -1,10 +1,9 @@ /** * Tests that writeConcern 'majority' writes succeed and are visible in a replica set that has one * data-bearing node and two arbiters. + * + * @tags: [requires_majority_read_concern] */ - -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. - (function() { "use strict"; @@ -17,12 +16,7 @@ var name = "read_majority_two_arbs"; var replTest = new ReplSetTest({name: name, nodes: 3, nodeOptions: {enableMajorityReadConcern: ''}}); -if (!startSetIfSupportsReadMajority(replTest)) { - jsTest.log("skipping test since storage engine doesn't support committed reads"); - replTest.stopSet(); - return; -} - +replTest.startSet(); var nodes = replTest.nodeList(); var config = { "_id": name, diff --git a/jstests/sharding/after_cluster_time.js b/jstests/sharding/after_cluster_time.js index f79bf03bf23..690c1f8b50b 100644 --- a/jstests/sharding/after_cluster_time.js +++ b/jstests/sharding/after_cluster_time.js @@ -5,8 +5,6 @@ (function() { "use strict"; -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. - function assertAfterClusterTimeReadFailsWithCode(db, readConcernObj, errorCode) { return assert.commandFailedWithCode( db.runCommand({find: "foo", readConcern: readConcernObj}), @@ -28,11 +26,7 @@ const rst = new ReplSetTest({ } }); -if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; -} +rst.startSet(); rst.initiate(); // Start the sharding test and add the majority read concern enabled replica set. diff --git a/jstests/sharding/causal_consistency_shell_support.js b/jstests/sharding/causal_consistency_shell_support.js index f2065b011e1..2f0170a5b85 100644 --- a/jstests/sharding/causal_consistency_shell_support.js +++ b/jstests/sharding/causal_consistency_shell_support.js @@ -2,12 +2,12 @@ * Tests which commands support causal consistency in the Mongo shell, that for each supported * command, the shell properly forwards its operation and cluster time and updates them based on the * response, and that the server rejects commands with afterClusterTime ahead of cluster time. + * + * @tags: [requires_majority_read_concern] */ (function() { "use strict"; -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. - // Verifies the command works and properly updates operation or cluster time. function runCommandAndCheckLogicalTimes(cmdObj, db, shouldAdvance) { const session = db.getSession(); @@ -59,11 +59,7 @@ const rst = new ReplSetTest({ } }); -if (!startSetIfSupportsReadMajority(rst)) { - jsTest.log("skipping test since storage engine doesn't support committed reads"); - rst.stopSet(); - return; -} +rst.startSet(); rst.initiate(); // Start the sharding test and add the majority readConcern enabled replica set. diff --git a/jstests/sharding/change_stream_update_lookup_read_concern.js b/jstests/sharding/change_stream_update_lookup_read_concern.js index 3dc1fb47bfd..0d777166ad3 100644 --- a/jstests/sharding/change_stream_update_lookup_read_concern.js +++ b/jstests/sharding/change_stream_update_lookup_read_concern.js @@ -1,11 +1,10 @@ // Tests that a change stream's update lookup will use the appropriate read concern. In particular, // tests that the update lookup will return a version of the document at least as recent as the // change that we're doing the lookup for, and that change will be majority-committed. -// @tags: [uses_change_streams] +// @tags: [uses_change_streams, requires_majority_read_concern] (function() { "use strict"; -load('jstests/replsets/rslib.js'); // For startSetIfSupportsReadMajority. load("jstests/libs/profiler.js"); // For profilerHas*OrThrow() helpers. load("jstests/replsets/rslib.js"); // For reconfig(). @@ -43,11 +42,7 @@ const rst = new ReplSetTest({ settings: {chainingAllowed: false}, }); -if (!startSetIfSupportsReadMajority(rst)) { - jsTestLog("Skipping test since storage engine doesn't support majority read concern."); - rst.stopSet(); - return; -} +rst.startSet(); rst.initiate(); rst.awaitSecondaryNodes(); diff --git a/jstests/sharding/read_committed_lookup.js b/jstests/sharding/read_committed_lookup.js index 72046bbf260..512850785e8 100644 --- a/jstests/sharding/read_committed_lookup.js +++ b/jstests/sharding/read_committed_lookup.js @@ -1,9 +1,10 @@ /** * Tests that a $lookup and $graphLookup stage within an aggregation pipeline will read only * committed data if the pipeline is using a majority readConcern. + * + * @tags: [requires_majority_read_concern] */ -load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. load("jstests/libs/read_committed_lib.js"); // For testReadCommittedLookup (function() { @@ -19,12 +20,7 @@ let rst = new ReplSetTest({ } }); -if (!startSetIfSupportsReadMajority(rst)) { - jsTest.log("skipping test since storage engine doesn't support committed reads"); - rst.stopSet(); - return; -} - +rst.startSet(); const nodes = rst.nodeList(); const config = { _id: replSetName, |