diff options
Diffstat (limited to 'jstests')
83 files changed, 328 insertions, 53 deletions
diff --git a/jstests/core/restart_catalog.js b/jstests/core/restart_catalog.js index 245c30e0469..b5ed4421acf 100644 --- a/jstests/core/restart_catalog.js +++ b/jstests/core/restart_catalog.js @@ -2,7 +2,7 @@ * Forces the server to restart the catalog and rebuild its in-memory catalog data structures, then * asserts that the server works normally. * @tags: [ - * assumes_read_concern_unchanged, + * assumes_read_concern_unchanged, requires_majority_read_concern, * * # restartCatalog command is not available on embedded * incompatible_with_embedded diff --git a/jstests/core/txns/abort_prepared_transaction.js b/jstests/core/txns/abort_prepared_transaction.js index 0f0cbc7289a..f89c7e3c686 100644 --- a/jstests/core/txns/abort_prepared_transaction.js +++ b/jstests/core/txns/abort_prepared_transaction.js @@ -1,7 +1,7 @@ /** * Tests prepared transaction abort support. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/core/txns/commit_prepared_transaction.js b/jstests/core/txns/commit_prepared_transaction.js index 51240440564..c14c9c607bf 100644 --- a/jstests/core/txns/commit_prepared_transaction.js +++ b/jstests/core/txns/commit_prepared_transaction.js @@ -1,7 +1,7 @@ /** * Tests prepared transaction commit support. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/core/txns/commit_prepared_transaction_errors.js b/jstests/core/txns/commit_prepared_transaction_errors.js index 4b24752e511..52d3ec35e04 100644 --- a/jstests/core/txns/commit_prepared_transaction_errors.js +++ b/jstests/core/txns/commit_prepared_transaction_errors.js @@ -1,7 +1,7 @@ /** * Test error cases for committing prepared transactions. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/core/txns/disallow_operations_on_prepared_transaction.js b/jstests/core/txns/disallow_operations_on_prepared_transaction.js index f44b069cee5..9e02f4ddbb9 100644 --- a/jstests/core/txns/disallow_operations_on_prepared_transaction.js +++ b/jstests/core/txns/disallow_operations_on_prepared_transaction.js @@ -3,7 +3,7 @@ * be allowed to be called on a prepared transaction. All other cases should fail with * PreparedTransactionInProgress. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { diff --git a/jstests/core/txns/empty_prepare.js b/jstests/core/txns/empty_prepare.js index f2e8ae392b3..1c8b8aa323f 100644 --- a/jstests/core/txns/empty_prepare.js +++ b/jstests/core/txns/empty_prepare.js @@ -1,7 +1,7 @@ /** * Tests transactions that are prepared after no writes. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/core/txns/ensure_active_txn_for_prepare_transaction.js b/jstests/core/txns/ensure_active_txn_for_prepare_transaction.js index 3695f7a9955..52e756f6b45 100644 --- a/jstests/core/txns/ensure_active_txn_for_prepare_transaction.js +++ b/jstests/core/txns/ensure_active_txn_for_prepare_transaction.js @@ -1,7 +1,7 @@ /** * Test that we can't call prepareTransaction if there isn't an active transaction on the session. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { diff --git a/jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js b/jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js index 0ac0dbd23bd..0da96c8d8cb 100644 --- a/jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js +++ b/jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js @@ -1,6 +1,6 @@ /** * Tests that we cannot start a new transaction when a prepared transaction exists on the session. - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] * */ diff --git a/jstests/core/txns/no_writes_to_config_transactions_with_prepared_transaction.js b/jstests/core/txns/no_writes_to_config_transactions_with_prepared_transaction.js index c21f189cfac..b7edeade302 100644 --- a/jstests/core/txns/no_writes_to_config_transactions_with_prepared_transaction.js +++ b/jstests/core/txns/no_writes_to_config_transactions_with_prepared_transaction.js @@ -2,7 +2,7 @@ * Tests that other than insertions, it is illegal to modify config.transactions while the session * has a prepared transaction. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { diff --git a/jstests/core/txns/prepare_committed_transaction.js b/jstests/core/txns/prepare_committed_transaction.js index cec363471e1..57b3c719075 100644 --- a/jstests/core/txns/prepare_committed_transaction.js +++ b/jstests/core/txns/prepare_committed_transaction.js @@ -1,7 +1,7 @@ /** * Test error cases when calling prepare on a committed transaction. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/core/txns/prepare_conflict.js b/jstests/core/txns/prepare_conflict.js index a06ddd296f0..f41fa802d43 100644 --- a/jstests/core/txns/prepare_conflict.js +++ b/jstests/core/txns/prepare_conflict.js @@ -1,7 +1,7 @@ /** * Tests that prepare conflicts for prepared transactions are retried. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/core/txns/prepare_conflict_read_concern_behavior.js b/jstests/core/txns/prepare_conflict_read_concern_behavior.js index db7776673a0..ce5a506c82f 100644 --- a/jstests/core/txns/prepare_conflict_read_concern_behavior.js +++ b/jstests/core/txns/prepare_conflict_read_concern_behavior.js @@ -2,7 +2,7 @@ * Test calling reads with various read concerns on a prepared transaction. Snapshot, linearizable * and afterClusterTime reads are the only reads that should block on a prepared transaction. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { diff --git a/jstests/core/txns/prepare_nonexistent_transaction.js b/jstests/core/txns/prepare_nonexistent_transaction.js index 8b4c256c8ed..e688f92af56 100644 --- a/jstests/core/txns/prepare_nonexistent_transaction.js +++ b/jstests/core/txns/prepare_nonexistent_transaction.js @@ -1,7 +1,7 @@ /** * Test error cases when calling prepare on a non-existent transaction. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/core/txns/prepare_prepared_transaction.js b/jstests/core/txns/prepare_prepared_transaction.js index 7ba6ab7bf2b..c436d342fba 100644 --- a/jstests/core/txns/prepare_prepared_transaction.js +++ b/jstests/core/txns/prepare_prepared_transaction.js @@ -1,7 +1,7 @@ /** * Tests that we can successfully prepare a prepared transaction. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/core/txns/prepare_requires_fcv42.js b/jstests/core/txns/prepare_requires_fcv42.js index b7cffaa441f..1328405701a 100644 --- a/jstests/core/txns/prepare_requires_fcv42.js +++ b/jstests/core/txns/prepare_requires_fcv42.js @@ -1,7 +1,7 @@ /** * Tests that 'prepareTransaction' only succeeds in FCV 4.2. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/core/txns/statement_ids_accepted.js b/jstests/core/txns/statement_ids_accepted.js index e42c5e0dced..689fff75013 100644 --- a/jstests/core/txns/statement_ids_accepted.js +++ b/jstests/core/txns/statement_ids_accepted.js @@ -1,6 +1,6 @@ // Makes sure all commands which are supposed to take statement ids do. This should test the // commands in the sessionCheckOutWhiteList in service_entry_point_common.cpp. -// @tags: [uses_transactions] +// @tags: [uses_transactions, uses_prepare_transaction] (function() { "use strict"; diff --git a/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js b/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js index 7899a1c7a14..2cc6b26deb0 100644 --- a/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js +++ b/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js @@ -2,7 +2,7 @@ * Tests that timestamped reads, reads with snapshot and afterClusterTime, wait for the prepare * transaction oplog entry to be visible before choosing a read timestamp. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { 'use strict'; diff --git a/jstests/core_standalone/read_concern.js b/jstests/core_standalone/read_concern.js index 17db9b689cd..1646ac71d11 100644 --- a/jstests/core_standalone/read_concern.js +++ b/jstests/core_standalone/read_concern.js @@ -1,5 +1,5 @@ // This test verifies readConcern behavior on a standalone mongod or embedded - +// @tags: [requires_majority_read_concern] (function() { 'use strict'; diff --git a/jstests/multiVersion/change_streams_feature_compatibility_version.js b/jstests/multiVersion/change_streams_feature_compatibility_version.js index 69615ff0a30..23c489893e8 100644 --- a/jstests/multiVersion/change_streams_feature_compatibility_version.js +++ b/jstests/multiVersion/change_streams_feature_compatibility_version.js @@ -1,6 +1,7 @@ // 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] (function() { "use strict"; diff --git a/jstests/noPassthrough/after_cluster_time.js b/jstests/noPassthrough/after_cluster_time.js index 718a9633a0c..1137e8495f2 100644 --- a/jstests/noPassthrough/after_cluster_time.js +++ b/jstests/noPassthrough/after_cluster_time.js @@ -1,5 +1,5 @@ // This test verifies readConcern:afterClusterTime behavior on a standalone mongod. -// @tags: [requires_replication] +// @tags: [requires_replication, requires_majority_read_concern] (function() { "use strict"; var standalone = diff --git a/jstests/noPassthrough/agg_explain_read_concern.js b/jstests/noPassthrough/agg_explain_read_concern.js index 0bac93f2eef..e3f0d7b8d94 100644 --- a/jstests/noPassthrough/agg_explain_read_concern.js +++ b/jstests/noPassthrough/agg_explain_read_concern.js @@ -1,5 +1,6 @@ /** * Test that explained aggregation commands behave correctly with the readConcern option. + * @tags: [requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/noPassthrough/change_streams_require_majority_read_concern.js b/jstests/noPassthrough/change_streams_require_majority_read_concern.js index f9dbe2f3b9f..8481ba586f1 100644 --- a/jstests/noPassthrough/change_streams_require_majority_read_concern.js +++ b/jstests/noPassthrough/change_streams_require_majority_read_concern.js @@ -1,4 +1,5 @@ // Tests that the $changeStream requires read concern majority. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/noPassthrough/change_streams_update_lookup_collation.js b/jstests/noPassthrough/change_streams_update_lookup_collation.js index 55df63bbc6a..b82ad384cde 100644 --- a/jstests/noPassthrough/change_streams_update_lookup_collation.js +++ b/jstests/noPassthrough/change_streams_update_lookup_collation.js @@ -2,7 +2,7 @@ // collation, regardless of the collation on the change stream. // // Collation is only supported with the find command, not with op query. -// @tags: [requires_find_command] +// @tags: [requires_find_command, uses_change_streams] (function() { "use strict"; diff --git a/jstests/noPassthrough/command_line_parsing.js b/jstests/noPassthrough/command_line_parsing.js index bd1b1ff0e8b..c68b050a676 100644 --- a/jstests/noPassthrough/command_line_parsing.js +++ b/jstests/noPassthrough/command_line_parsing.js @@ -35,6 +35,7 @@ delete m2result.parsed.storage.engine; delete m2result.parsed.storage.journal; delete m2result.parsed.storage.rocksdb; delete m2result.parsed.storage.wiredTiger; +delete m2result.parsed.replication; // Removes enableMajorityReadConcern setting. assert.docEq(m2expected.parsed, m2result.parsed); // test JSON config file @@ -62,4 +63,5 @@ delete m3result.parsed.storage.engine; delete m3result.parsed.storage.journal; delete m3result.parsed.storage.rocksdb; delete m3result.parsed.storage.wiredTiger; +delete m3result.parsed.replication; // Removes enableMajorityReadConcern setting. assert.docEq(m3expected.parsed, m3result.parsed); diff --git a/jstests/noPassthrough/disable_majority_reads_restart.js b/jstests/noPassthrough/disable_majority_reads_restart.js new file mode 100644 index 00000000000..596eabad052 --- /dev/null +++ b/jstests/noPassthrough/disable_majority_reads_restart.js @@ -0,0 +1,82 @@ +/** + * Tests restarting mongod with 'enableMajorityReadConcern' varying between true and false. + * + * @tags: [requires_persistence, requires_replication, requires_majority_read_concern, + * requires_wiredtiger] + */ +(function() { + "use strict"; + + const dbName = "test"; + const collName = "coll"; + + const rst = new ReplSetTest({nodes: 1}); + rst.startSet(); + rst.initiate(); + + // Insert a document and ensure it is in the stable checkpoint by restarting. + let coll = rst.getPrimary().getDB(dbName)[collName]; + assert.commandWorked(coll.insert({_id: 0}, {writeConcern: {w: "majority"}})); + rst.stopSet(undefined, true); + rst.startSet(undefined, true); + + // Disable snapshotting on all members of the replica set so that further operations do not + // enter the majority snapshot. + assert.commandWorked(rst.getPrimary().adminCommand( + {configureFailPoint: "disableSnapshotting", mode: "alwaysOn"})); + + // Insert a document that will not be in a stable checkpoint. + coll = rst.getPrimary().getDB(dbName)[collName]; + assert.commandWorked(coll.insert({_id: 1})); + + // Restart the node with enableMajorityReadConcern:false. + rst.stopSet(undefined, true); + rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"}); + + // Both inserts should be reflected in the data and the oplog. + coll = rst.getPrimary().getDB(dbName)[collName]; + assert.eq([{_id: 0}, {_id: 1}], coll.find().sort({_id: 1}).toArray()); + let oplog = rst.getPrimary().getDB("local").oplog.rs; + assert.eq(1, oplog.find({o: {_id: 0}}).itcount()); + assert.eq(1, oplog.find({o: {_id: 1}}).itcount()); + + // Restart the node with enableMajorityReadConcern:false without adding any documents. + rst.stopSet(undefined, true); + rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"}); + + // Both inserts should still be reflected in the data and the oplog. + coll = rst.getPrimary().getDB(dbName)[collName]; + assert.eq([{_id: 0}, {_id: 1}], coll.find().sort({_id: 1}).toArray()); + oplog = rst.getPrimary().getDB("local").oplog.rs; + assert.eq(1, oplog.find({o: {_id: 0}}).itcount()); + assert.eq(1, oplog.find({o: {_id: 1}}).itcount()); + + // Insert another document. + assert.commandWorked(coll.insert({_id: 2}, {writeConcern: {w: "majority"}})); + + // Restart the node with enableMajorityReadConcern:false. + rst.stopSet(undefined, true); + rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"}); + + // All three inserts should be reflected in the data and the oplog. + coll = rst.getPrimary().getDB(dbName)[collName]; + assert.eq([{_id: 0}, {_id: 1}, {_id: 2}], coll.find().sort({_id: 1}).toArray()); + oplog = rst.getPrimary().getDB("local").oplog.rs; + assert.eq(1, oplog.find({o: {_id: 0}}).itcount()); + assert.eq(1, oplog.find({o: {_id: 1}}).itcount()); + assert.eq(1, oplog.find({o: {_id: 2}}).itcount()); + + // Restart the node with enableMajorityReadConcern:true. + rst.stopSet(undefined, true); + rst.startSet({noCleanData: true, enableMajorityReadConcern: "false"}); + + // All three inserts should still be reflected in the data and the oplog. + coll = rst.getPrimary().getDB(dbName)[collName]; + assert.eq([{_id: 0}, {_id: 1}, {_id: 2}], coll.find().sort({_id: 1}).toArray()); + oplog = rst.getPrimary().getDB("local").oplog.rs; + assert.eq(1, oplog.find({o: {_id: 0}}).itcount()); + assert.eq(1, oplog.find({o: {_id: 1}}).itcount()); + assert.eq(1, oplog.find({o: {_id: 2}}).itcount()); + + rst.stopSet(); +})(); diff --git a/jstests/noPassthrough/do_not_rebuild_indexes_before_repair.js b/jstests/noPassthrough/do_not_rebuild_indexes_before_repair.js index 265bc478c46..12fd52a09f2 100644 --- a/jstests/noPassthrough/do_not_rebuild_indexes_before_repair.js +++ b/jstests/noPassthrough/do_not_rebuild_indexes_before_repair.js @@ -3,7 +3,7 @@ * indexes before repairing the instance. Replication is used to get the database into a state where * an index has been dropped on disk, but still exists in the catalog. * - * @tags: [requires_persistence, requires_replication] + * @tags: [requires_persistence, requires_replication, requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/noPassthrough/readConcern_atClusterTime_snapshot_selection.js b/jstests/noPassthrough/readConcern_atClusterTime_snapshot_selection.js index 85206f15650..a9a5bc022b7 100644 --- a/jstests/noPassthrough/readConcern_atClusterTime_snapshot_selection.js +++ b/jstests/noPassthrough/readConcern_atClusterTime_snapshot_selection.js @@ -2,7 +2,7 @@ // to be majority committed. If 'atClusterTime' is older than the oldest available snapshot, the // error code SnapshotTooOld is returned. // -// @tags: [uses_transactions] +// @tags: [uses_transactions, requires_majority_read_concern] (function() { "use strict"; diff --git a/jstests/noPassthrough/readConcern_snapshot.js b/jstests/noPassthrough/readConcern_snapshot.js index 7c3800ca689..3798cb8efe9 100644 --- a/jstests/noPassthrough/readConcern_snapshot.js +++ b/jstests/noPassthrough/readConcern_snapshot.js @@ -24,14 +24,14 @@ assert.commandFailedWithCode(sessionDb.runCommand({find: collName}), ErrorCodes.IllegalOperation); assert.commandFailedWithCode(session.abortTransaction_forTesting(), - ErrorCodes.NoSuchTransaction); + [ErrorCodes.NoSuchTransaction, ErrorCodes.IllegalOperation]); // Transactions without readConcern snapshot fail. session.startTransaction(); assert.commandFailedWithCode(sessionDb.runCommand({find: collName}), ErrorCodes.IllegalOperation); assert.commandFailedWithCode(session.abortTransaction_forTesting(), - ErrorCodes.NoSuchTransaction); + [ErrorCodes.NoSuchTransaction, ErrorCodes.IllegalOperation]); rst.stopSet(); return; diff --git a/jstests/noPassthrough/readConcern_snapshot_mongos.js b/jstests/noPassthrough/readConcern_snapshot_mongos.js index 1fb9a2631c8..a624a14c235 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_single_shard_transaction] (function() { "use strict"; diff --git a/jstests/noPassthrough/read_concern_helper.js b/jstests/noPassthrough/read_concern_helper.js index 2f9e2c4807b..b83b48bdf34 100644 --- a/jstests/noPassthrough/read_concern_helper.js +++ b/jstests/noPassthrough/read_concern_helper.js @@ -1,4 +1,5 @@ // This tests readConcern handling for the find/findOne shell helpers. +// @tags: [requires_majority_read_concern] (function() { "use strict"; var testServer = MongoRunner.runMongod(); diff --git a/jstests/noPassthrough/read_concern_snapshot_aggregation.js b/jstests/noPassthrough/read_concern_snapshot_aggregation.js index 9a8d4fa9863..838b3ddd9b2 100644 --- a/jstests/noPassthrough/read_concern_snapshot_aggregation.js +++ b/jstests/noPassthrough/read_concern_snapshot_aggregation.js @@ -38,8 +38,11 @@ } // Test that $changeStream is disallowed with transactions. - testSnapshotAggFailsWithCode( - kCollName, [{$changeStream: {}}], ErrorCodes.OperationNotSupportedInTransaction); + // TODO SERVER-37221: Remove the check for 'supportsCommittedReads'. + if (sessionDB.serverStatus().storageEngine.supportsCommittedReads) { + testSnapshotAggFailsWithCode( + kCollName, [{$changeStream: {}}], ErrorCodes.OperationNotSupportedInTransaction); + } // Test that $collStats is disallowed with transactions. testSnapshotAggFailsWithCode( diff --git a/jstests/noPassthrough/read_majority.js b/jstests/noPassthrough/read_majority.js index f9ee8d01607..30e7b078ad8 100644 --- a/jstests/noPassthrough/read_majority.js +++ b/jstests/noPassthrough/read_majority.js @@ -12,6 +12,7 @@ * * All of this requires support for committed reads, so this test will be skipped if the storage * engine does not support them. + * @tags: [requires_majority_read_concern] */ load("jstests/libs/analyze_plan.js"); diff --git a/jstests/noPassthrough/read_majority_reads.js b/jstests/noPassthrough/read_majority_reads.js index 5f0ea2012e8..578f17d748f 100644 --- a/jstests/noPassthrough/read_majority_reads.js +++ b/jstests/noPassthrough/read_majority_reads.js @@ -11,7 +11,7 @@ * Each operation is tested on a single node, and (if supported) through mongos on both sharded and * unsharded collections. Mongos doesn't directly handle readConcern majority, but these tests * should ensure that it correctly propagates the setting to the shards when running commands. - * @tags: [requires_sharding] + * @tags: [requires_sharding, requires_majority_read_concern] */ (function() { diff --git a/jstests/noPassthrough/recovery_wt_cache_full.js b/jstests/noPassthrough/recovery_wt_cache_full.js index 2b26e475f82..dff22ad959a 100644 --- a/jstests/noPassthrough/recovery_wt_cache_full.js +++ b/jstests/noPassthrough/recovery_wt_cache_full.js @@ -1,6 +1,7 @@ /** * Fills WiredTiger cache during recovery oplog application. - * @tags: [requires_persistence, requires_replication, requires_wiredtiger] + * @tags: [requires_persistence, requires_replication, requires_wiredtiger, + * requires_majority_read_concern] */ (function() { 'use strict'; diff --git a/jstests/noPassthrough/restart_catalog_sharded_cluster.js b/jstests/noPassthrough/restart_catalog_sharded_cluster.js index 04ee63ce0de..696d62c2af8 100644 --- a/jstests/noPassthrough/restart_catalog_sharded_cluster.js +++ b/jstests/noPassthrough/restart_catalog_sharded_cluster.js @@ -1,6 +1,6 @@ /** * Tests restarting the catalog in a sharded cluster on the config server and the shards. - * @tags: [requires_replication, requires_sharding] + * @tags: [requires_replication, requires_sharding, requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/noPassthrough/skip_sharding_configuration_checks.js b/jstests/noPassthrough/skip_sharding_configuration_checks.js index bbb0d2b868b..eb067f94a52 100644 --- a/jstests/noPassthrough/skip_sharding_configuration_checks.js +++ b/jstests/noPassthrough/skip_sharding_configuration_checks.js @@ -1,6 +1,7 @@ /** * Starts standalone RS with skipShardingConfigurationChecks. - * @tags: [requires_persistence, requires_replication, requires_sharding] + * @tags: [requires_persistence, requires_replication, requires_sharding, + * requires_majority_read_concern] */ (function() { 'use strict'; diff --git a/jstests/noPassthrough/standalone_replication_recovery.js b/jstests/noPassthrough/standalone_replication_recovery.js index 67a5da61170..1def927772c 100644 --- a/jstests/noPassthrough/standalone_replication_recovery.js +++ b/jstests/noPassthrough/standalone_replication_recovery.js @@ -2,7 +2,8 @@ * Tests that a standalone succeeds when passed the 'recoverFromOplogAsStandalone' parameter. * * This test only makes sense for storage engines that support recover to stable timestamp. - * @tags: [requires_wiredtiger, requires_persistence, requires_journaling, requires_replication] + * @tags: [requires_wiredtiger, requires_persistence, requires_journaling, requires_replication, + * requires_majority_read_concern] */ (function() { diff --git a/jstests/noPassthrough/timestamp_index_builds.js b/jstests/noPassthrough/timestamp_index_builds.js index b55b1805e00..e5ffa405d45 100644 --- a/jstests/noPassthrough/timestamp_index_builds.js +++ b/jstests/noPassthrough/timestamp_index_builds.js @@ -15,7 +15,7 @@ * timestamping, merely that the catalog state is not corrupted due to the existence of background * index builds. * - * @tags: [requires_replication, requires_persistence] + * @tags: [requires_replication, requires_persistence, requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/noPassthrough/unsupported_change_stream_deployments.js b/jstests/noPassthrough/unsupported_change_stream_deployments.js index 6bc969abca7..3f24a8b0f2c 100644 --- a/jstests/noPassthrough/unsupported_change_stream_deployments.js +++ b/jstests/noPassthrough/unsupported_change_stream_deployments.js @@ -1,5 +1,5 @@ // Tests that the $changeStream stage returns an error when run against a standalone mongod. -// @tags: [requires_sharding] +// @tags: [requires_sharding, uses_change_streams] (function() { "use strict"; diff --git a/jstests/noPassthrough/wt_disable_majority_reads.js b/jstests/noPassthrough/wt_disable_majority_reads.js new file mode 100644 index 00000000000..57249723d2c --- /dev/null +++ b/jstests/noPassthrough/wt_disable_majority_reads.js @@ -0,0 +1,32 @@ +// @tags: [requires_wiredtiger, requires_replication] +(function() { + "use strict"; + + var rst = new ReplSetTest({ + nodes: [ + {"enableMajorityReadConcern": ""}, + {"enableMajorityReadConcern": "false"}, + {"enableMajorityReadConcern": "true"} + ] + }); + rst.startSet(); + rst.initiate(); + rst.awaitSecondaryNodes(); + + rst.getPrimary().getDB("test").getCollection("test").insert({}); + rst.awaitReplication(); + + // Node 0 is using the default, which is `enableMajorityReadConcern: true`. Thus a majority + // read should succeed. + assert.commandWorked(rst.nodes[0].getDB("test").runCommand( + {"find": "test", "readConcern": {"level": "majority"}})); + // Node 1 disables majority reads. Check for the appropriate error code. + assert.commandFailedWithCode(rst.nodes[1].getDB("test").runCommand( + {"find": "test", "readConcern": {"level": "majority"}}), + ErrorCodes.ReadConcernMajorityNotEnabled); + // Same as Node 0. + assert.commandWorked(rst.nodes[2].getDB("test").runCommand( + {"find": "test", "readConcern": {"level": "majority"}})); + + rst.stopSet(); +})(); diff --git a/jstests/replsets/clean_shutdown_oplog_state.js b/jstests/replsets/clean_shutdown_oplog_state.js index 2bd4be04439..e7239b0f78e 100644 --- a/jstests/replsets/clean_shutdown_oplog_state.js +++ b/jstests/replsets/clean_shutdown_oplog_state.js @@ -3,7 +3,7 @@ // present without this test failing. In particular if the rst.stop(1) doesn't execute mid-batch, // it isn't fully exercising the code. However, if the test fails there is definitely a bug. // -// @tags: [requires_persistence] +// @tags: [requires_persistence, requires_majority_read_concern] (function() { "use strict"; diff --git a/jstests/replsets/command_response_operation_time.js b/jstests/replsets/command_response_operation_time.js index cd889e0b090..d4aecdb2248 100644 --- a/jstests/replsets/command_response_operation_time.js +++ b/jstests/replsets/command_response_operation_time.js @@ -2,6 +2,7 @@ * Tests that reads and writes in a replica set return the correct operationTime for their * read/write concern level. Majority reads and writes return the last committed optime's timestamp * and local reads and writes return the last applied optime's timestamp. + * @tags: [requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/replsets/last_op_visible.js b/jstests/replsets/last_op_visible.js index 471669b9853..4b8b70a24b4 100644 --- a/jstests/replsets/last_op_visible.js +++ b/jstests/replsets/last_op_visible.js @@ -3,6 +3,7 @@ // lastOpVisible, and that majority read with afterOpTime of lastOpVisible will return it as well. // 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"); diff --git a/jstests/replsets/operation_time_read_and_write_concern.js b/jstests/replsets/operation_time_read_and_write_concern.js index 235db85aab3..c1661db1d7e 100644 --- a/jstests/replsets/operation_time_read_and_write_concern.js +++ b/jstests/replsets/operation_time_read_and_write_concern.js @@ -1,6 +1,7 @@ /** * Validates the operationTime value in the command response depends on the read/writeConcern of the * the read/write commmand that produced it. + * @tags: [requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/replsets/prepare_prepared_transaction_wc_timeout.js b/jstests/replsets/prepare_prepared_transaction_wc_timeout.js index c7e71d2786c..09f7cf69a8c 100644 --- a/jstests/replsets/prepare_prepared_transaction_wc_timeout.js +++ b/jstests/replsets/prepare_prepared_transaction_wc_timeout.js @@ -2,7 +2,7 @@ * Tests that when preparing a prepared transaction, we wait for writeConcern if the client optime * is behind the prepareTimestamp. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/replsets/read_concern_majority_getmore_secondaries.js b/jstests/replsets/read_concern_majority_getmore_secondaries.js index d21560b6510..6db3658733e 100644 --- a/jstests/replsets/read_concern_majority_getmore_secondaries.js +++ b/jstests/replsets/read_concern_majority_getmore_secondaries.js @@ -1,4 +1,5 @@ // Test that getMore for a majority read on a secondary only reads committed data. +// @tags: [requires_majority_read_concern] (function() { "use strict"; // For supportsMajorityReadConcern(). diff --git a/jstests/replsets/read_concern_uninitated_set.js b/jstests/replsets/read_concern_uninitated_set.js index 1e59359b683..0737b88e229 100644 --- a/jstests/replsets/read_concern_uninitated_set.js +++ b/jstests/replsets/read_concern_uninitated_set.js @@ -2,7 +2,7 @@ * Test to ensure that specifying non-local read concern with an uninitiated set does not crash * node. * - * @tags: [requires_persistence] + * @tags: [requires_persistence, requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/replsets/rollback_waits_for_bgindex_completion.js b/jstests/replsets/rollback_waits_for_bgindex_completion.js index 041cc9404a9..eb76dd7ddcd 100644 --- a/jstests/replsets/rollback_waits_for_bgindex_completion.js +++ b/jstests/replsets/rollback_waits_for_bgindex_completion.js @@ -2,7 +2,7 @@ * Test to ensure that rollback waits for in-progress background index builds to finish before * starting the rollback process. Only applies to Recoverable Rollback via WiredTiger checkpoints. * - * @tags: [requires_wiredtiger, requires_journaling] + * @tags: [requires_wiredtiger, requires_journaling, requires_majority_read_concern] */ (function() { 'use strict'; diff --git a/jstests/replsets/secondary_reads_timestamp_visibility.js b/jstests/replsets/secondary_reads_timestamp_visibility.js index 6ebbe527cec..f91a8d56c46 100644 --- a/jstests/replsets/secondary_reads_timestamp_visibility.js +++ b/jstests/replsets/secondary_reads_timestamp_visibility.js @@ -58,6 +58,10 @@ let levels = ["local", "available", "majority"]; + if (!primaryDB.serverStatus().storageEngine.supportsCommittedReads) { + levels = ["local", "available"]; + } + // We should see the previous, un-replicated state on the secondary with every readconcern. for (let i in levels) { print("Checking that no new updates are visible yet for readConcern: " + levels[i]); diff --git a/jstests/replsets/shutdown_with_prepared_transaction.js b/jstests/replsets/shutdown_with_prepared_transaction.js index 387d7474ef3..f8844b21074 100644 --- a/jstests/replsets/shutdown_with_prepared_transaction.js +++ b/jstests/replsets/shutdown_with_prepared_transaction.js @@ -1,7 +1,7 @@ /** * Tests that a server can still be shut down while it has prepared transactions pending. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/replsets/speculative_transaction.js b/jstests/replsets/speculative_transaction.js index d1e5f14c3cc..6bfc427369d 100644 --- a/jstests/replsets/speculative_transaction.js +++ b/jstests/replsets/speculative_transaction.js @@ -3,7 +3,7 @@ * the same document can run back to back without waiting for the first transaction to * commit to a majority. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/replsets/stepdown_with_prepared_transaction.js b/jstests/replsets/stepdown_with_prepared_transaction.js index f1b738af4f9..1b30041c313 100644 --- a/jstests/replsets/stepdown_with_prepared_transaction.js +++ b/jstests/replsets/stepdown_with_prepared_transaction.js @@ -1,7 +1,7 @@ /** * Tests that it is possible to step down a primary while there are transactions in prepare. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/replsets/temp_namespace_restart_as_standalone.js b/jstests/replsets/temp_namespace_restart_as_standalone.js index d6453576bb8..a566a6b1309 100644 --- a/jstests/replsets/temp_namespace_restart_as_standalone.js +++ b/jstests/replsets/temp_namespace_restart_as_standalone.js @@ -2,7 +2,7 @@ * Tests that temporary collections are not dropped when a member of a replica set is started up as * a stand-alone mongod, i.e. without the --replSet parameter. * - * @tags: [requires_persistence] + * @tags: [requires_persistence, requires_majority_read_concern] */ (function() { var rst = new ReplSetTest({nodes: 2}); diff --git a/jstests/replsets/transactions_after_rollback_via_refetch.js b/jstests/replsets/transactions_after_rollback_via_refetch.js new file mode 100644 index 00000000000..5d5ba119ecd --- /dev/null +++ b/jstests/replsets/transactions_after_rollback_via_refetch.js @@ -0,0 +1,122 @@ +/** + * Basic test that transactions are able to run against a node immediately after it has executed a + * refetch based rollback of a few basic CRUD and DDL ops. Local writes done during the rollback + * process are not timestamped, so we want to ensure that transactions can be started against a + * valid snapshot post-rollback and read data correctly. + * + * @tags: [uses_transactions] + */ +(function() { + 'use strict'; + + load("jstests/replsets/libs/rollback_test.js"); + + let name = "transactions_after_rollback_via_refetch"; + let dbName = name; + let crudCollName = "crudColl"; + let collToDropName = "collToDrop"; + + let CommonOps = (node) => { + // Insert a couple of documents that will initially be present on all nodes. + let crudColl = node.getDB(dbName)[crudCollName]; + assert.commandWorked(crudColl.insert({_id: 0})); + assert.commandWorked(crudColl.insert({_id: 1})); + + // Create a collection so it can be dropped on the rollback node. + node.getDB(dbName)[collToDropName].insert({_id: 0}); + }; + + // We want to have the rollback node perform some inserts, updates, and deletes locally + // during the rollback process, so we can ensure that transactions will read correct data + // post-rollback, even though these writes will be un-timestamped. + let RollbackOps = (node) => { + let crudColl = node.getDB(dbName)[crudCollName]; + // Roll back an update (causes refetch and local update). + assert.commandWorked(crudColl.update({_id: 0}, {$set: {rollbackNode: 0}})); + // Roll back a delete (causes refetch and local insert). + assert.commandWorked(crudColl.remove({_id: 1})); + // Roll back an insert (causes local delete). + assert.commandWorked(crudColl.insert({_id: 2})); + + // Roll back a drop (re-creates the collection). + node.getDB(dbName)[collToDropName].drop(); + }; + + let SyncSourceOps = (node) => { + let coll = node.getDB(dbName)[crudCollName]; + // Update these docs so the rollback node will refetch them. + assert.commandWorked(coll.update({_id: 0}, {$set: {syncSource: 0}})); + assert.commandWorked(coll.update({_id: 1}, {$set: {syncSource: 1}})); + }; + + // Set up a replica set for use in RollbackTest. We disable majority reads on all nodes so that + // they will use the "rollbackViaRefetch" algorithm. + let replTest = new ReplSetTest( + {name, nodes: 3, useBridge: true, nodeOptions: {enableMajorityReadConcern: "false"}}); + replTest.startSet(); + const nodes = replTest.nodeList(); + replTest.initiate({ + _id: name, + members: [ + {_id: 0, host: nodes[0]}, + {_id: 1, host: nodes[1]}, + {_id: 2, host: nodes[2], arbiterOnly: true} + ] + }); + + let rollbackTest = new RollbackTest(name, replTest); + + CommonOps(rollbackTest.getPrimary()); + + let rollbackNode = rollbackTest.transitionToRollbackOperations(); + RollbackOps(rollbackNode); + + let syncSourceNode = rollbackTest.transitionToSyncSourceOperationsBeforeRollback(); + SyncSourceOps(syncSourceNode); + + // Wait for rollback to finish. + rollbackTest.transitionToSyncSourceOperationsDuringRollback(); + rollbackTest.transitionToSteadyStateOperations(); + + // Make the rollback node primary so we can run transactions against it. + rollbackTest.getTestFixture().stepUp(rollbackNode); + + jsTestLog("Testing transactions against the node that just rolled back."); + const sessionOptions = {causalConsistency: false}; + let session = rollbackNode.getDB(dbName).getMongo().startSession(sessionOptions); + let sessionDb = session.getDatabase(dbName); + let sessionColl = sessionDb[crudCollName]; + + // Make sure we can do basic CRUD ops inside a transaction and read the data back correctly, pre + // and post-commit. + session.startTransaction(); + // Make sure we read from the snapshot correctly. + assert.docEq(sessionColl.find().sort({_id: 1}).toArray(), + [{_id: 0, syncSource: 0}, {_id: 1, syncSource: 1}]); + // Do some basic ops. + assert.commandWorked(sessionColl.update({_id: 0}, {$set: {inTxn: 1}})); + assert.commandWorked(sessionColl.remove({_id: 1})); + assert.commandWorked(sessionColl.insert({_id: 2})); + // Make sure we read the updated data correctly. + assert.docEq(sessionColl.find().sort({_id: 1}).toArray(), + [{_id: 0, syncSource: 0, inTxn: 1}, {_id: 2}]); + session.commitTransaction(); + + // Make sure data is visible after commit. + assert.docEq(sessionColl.find().sort({_id: 1}).toArray(), + [{_id: 0, syncSource: 0, inTxn: 1}, {_id: 2}]); + + // Run a transaction that touches the collection that was re-created during rollback. + sessionColl = sessionDb[collToDropName]; + session.startTransaction(); + assert.docEq(sessionColl.find().sort({_id: 1}).toArray(), [{_id: 0}]); + assert.commandWorked(sessionColl.update({_id: 0}, {$set: {inTxn: 1}})); + session.commitTransaction(); + + // Make sure data is visible after commit. + assert.docEq(sessionColl.find().sort({_id: 1}).toArray(), [{_id: 0, inTxn: 1}]); + + // Check the replica set. + rollbackTest.stop(); + +}()); diff --git a/jstests/sharding/after_cluster_time.js b/jstests/sharding/after_cluster_time.js index fea0a573bac..3c99680ebe8 100644 --- a/jstests/sharding/after_cluster_time.js +++ b/jstests/sharding/after_cluster_time.js @@ -1,5 +1,6 @@ /** * Tests readConcern: afterClusterTime behavior in a sharded cluster. + * @tags: [requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/sharding/change_stream_chunk_migration.js b/jstests/sharding/change_stream_chunk_migration.js index e5eaa0460fc..64f7d860c2a 100644 --- a/jstests/sharding/change_stream_chunk_migration.js +++ b/jstests/sharding/change_stream_chunk_migration.js @@ -1,5 +1,6 @@ // Tests that change stream returns the stream of results continuously and in the right order when // it's migrating a chunk to a new shard. +// @tags: [uses_change_streams] (function() { 'use strict'; diff --git a/jstests/sharding/change_stream_enforce_max_time_ms_on_mongos.js b/jstests/sharding/change_stream_enforce_max_time_ms_on_mongos.js index 2295086a18c..d97e88f62a1 100644 --- a/jstests/sharding/change_stream_enforce_max_time_ms_on_mongos.js +++ b/jstests/sharding/change_stream_enforce_max_time_ms_on_mongos.js @@ -3,6 +3,7 @@ // so allows the shards to regularly report their advancing optimes in the absence of any new data, // which in turn allows the AsyncResultsMerger to return sorted results retrieved from the other // shards. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/change_stream_lookup_single_shard_cluster.js b/jstests/sharding/change_stream_lookup_single_shard_cluster.js index f642064cd57..ac00ea33d34 100644 --- a/jstests/sharding/change_stream_lookup_single_shard_cluster.js +++ b/jstests/sharding/change_stream_lookup_single_shard_cluster.js @@ -1,6 +1,7 @@ // Tests that a $changeStream pipeline is split rather than forwarded even in the case where the // cluster only has a single shard, and that it can therefore successfully look up a document in a // sharded collection. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/change_stream_read_preference.js b/jstests/sharding/change_stream_read_preference.js index d60b35a84b7..25a7b5ef061 100644 --- a/jstests/sharding/change_stream_read_preference.js +++ b/jstests/sharding/change_stream_read_preference.js @@ -1,5 +1,6 @@ // Tests that change streams and their update lookups obey the read preference specified by the // user. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/change_stream_resume_from_different_mongos.js b/jstests/sharding/change_stream_resume_from_different_mongos.js index 0ec7ab2d00c..7efe9e06a36 100644 --- a/jstests/sharding/change_stream_resume_from_different_mongos.js +++ b/jstests/sharding/change_stream_resume_from_different_mongos.js @@ -1,4 +1,5 @@ // Test resuming a change stream on a mongos other than the one the change stream was started on. +// @tags: [uses_change_streams] (function() { "use strict"; // For supportsMajorityReadConcern(). diff --git a/jstests/sharding/change_stream_shard_failover.js b/jstests/sharding/change_stream_shard_failover.js index ade85d27086..27a141bcfed 100644 --- a/jstests/sharding/change_stream_shard_failover.js +++ b/jstests/sharding/change_stream_shard_failover.js @@ -1,6 +1,7 @@ /** * Test resuming a change stream on a node other than the one it was started on. Accomplishes this * by triggering a stepdown. + * @tags: [uses_change_streams] */ // Checking UUID consistency uses cached connections, which are not valid across restarts or diff --git a/jstests/sharding/change_stream_update_lookup_collation.js b/jstests/sharding/change_stream_update_lookup_collation.js index 0cdd59cf131..6c57aba30e0 100644 --- a/jstests/sharding/change_stream_update_lookup_collation.js +++ b/jstests/sharding/change_stream_update_lookup_collation.js @@ -2,7 +2,7 @@ // use the collection's default collation once it gets to the shards. // // Collation is only supported with the find command, not with op query. -// @tags: [requires_find_command] +// @tags: [requires_find_command, uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/change_stream_update_lookup_read_concern.js b/jstests/sharding/change_stream_update_lookup_read_concern.js index 58cd8904870..e537484f63c 100644 --- a/jstests/sharding/change_stream_update_lookup_read_concern.js +++ b/jstests/sharding/change_stream_update_lookup_read_concern.js @@ -1,6 +1,7 @@ // 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] (function() { "use strict"; diff --git a/jstests/sharding/change_streams.js b/jstests/sharding/change_streams.js index 1000d047cd0..cd13f86678c 100644 --- a/jstests/sharding/change_streams.js +++ b/jstests/sharding/change_streams.js @@ -1,4 +1,5 @@ // Tests the behavior of change streams on sharded collections. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/change_streams_establishment_finds_new_shards.js b/jstests/sharding/change_streams_establishment_finds_new_shards.js index e66e80ec6d4..8b8bd4fd5a9 100644 --- a/jstests/sharding/change_streams_establishment_finds_new_shards.js +++ b/jstests/sharding/change_streams_establishment_finds_new_shards.js @@ -1,5 +1,6 @@ // Tests that change streams is able to find and return results from new shards which are added // during cursor establishment. +// @tags: [uses_change_streams] (function() { 'use strict'; diff --git a/jstests/sharding/change_streams_primary_shard_unaware.js b/jstests/sharding/change_streams_primary_shard_unaware.js index 27d7ef9bfa3..0dade0d553c 100644 --- a/jstests/sharding/change_streams_primary_shard_unaware.js +++ b/jstests/sharding/change_streams_primary_shard_unaware.js @@ -3,7 +3,7 @@ // // This test triggers a compiler bug that causes a crash when compiling with optimizations on, see // SERVER-36321. -// @tags: [requires_persistence], [blacklist_from_rhel_67_s390x] +// @tags: [requires_persistence, blacklist_from_rhel_67_s390x, uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/change_streams_shards_start_in_sync.js b/jstests/sharding/change_streams_shards_start_in_sync.js index 93e26ec9e7c..c3c3fb07e73 100644 --- a/jstests/sharding/change_streams_shards_start_in_sync.js +++ b/jstests/sharding/change_streams_shards_start_in_sync.js @@ -5,6 +5,7 @@ // could occur, followed by write 'B' to shard 1, and then the change stream could be established on // shard 1, then some third write 'C' could occur. This test ensures that in that case, both 'A' // and 'B' will be seen in the changestream before 'C'. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/change_streams_unsharded_becomes_sharded.js b/jstests/sharding/change_streams_unsharded_becomes_sharded.js index ea5178601b1..e865fb709d5 100644 --- a/jstests/sharding/change_streams_unsharded_becomes_sharded.js +++ b/jstests/sharding/change_streams_unsharded_becomes_sharded.js @@ -3,6 +3,7 @@ // 'documentKey' to include the new shard key, and that a resume token obtained prior to the // shardCollection command can be used to resume the stream even after the collection has been // sharded. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/change_streams_whole_db.js b/jstests/sharding/change_streams_whole_db.js index bc7d559610a..4051493c04f 100644 --- a/jstests/sharding/change_streams_whole_db.js +++ b/jstests/sharding/change_streams_whole_db.js @@ -1,4 +1,5 @@ // Tests the behavior of a change stream on a whole database in a sharded cluster. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/lookup_change_stream_post_image_compound_shard_key.js b/jstests/sharding/lookup_change_stream_post_image_compound_shard_key.js index 29689156c87..a1bce25ad81 100644 --- a/jstests/sharding/lookup_change_stream_post_image_compound_shard_key.js +++ b/jstests/sharding/lookup_change_stream_post_image_compound_shard_key.js @@ -1,5 +1,6 @@ // Tests the behavior of looking up the post image for change streams on collections which are // sharded with a compound shard key. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/lookup_change_stream_post_image_hashed_shard_key.js b/jstests/sharding/lookup_change_stream_post_image_hashed_shard_key.js index db8ac5ed31d..f1e9e6da502 100644 --- a/jstests/sharding/lookup_change_stream_post_image_hashed_shard_key.js +++ b/jstests/sharding/lookup_change_stream_post_image_hashed_shard_key.js @@ -1,5 +1,6 @@ // Tests the behavior of looking up the post image for change streams on collections which are // sharded with a hashed shard key. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/lookup_change_stream_post_image_id_shard_key.js b/jstests/sharding/lookup_change_stream_post_image_id_shard_key.js index a6dd9631dac..843dda1c524 100644 --- a/jstests/sharding/lookup_change_stream_post_image_id_shard_key.js +++ b/jstests/sharding/lookup_change_stream_post_image_id_shard_key.js @@ -1,5 +1,6 @@ // Tests the behavior of looking up the post image for change streams on collections which are // sharded with a key which is just the "_id" field. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/restart_transactions.js b/jstests/sharding/restart_transactions.js index 8d4089e266a..ebf93496762 100644 --- a/jstests/sharding/restart_transactions.js +++ b/jstests/sharding/restart_transactions.js @@ -2,7 +2,7 @@ * Verify the states that a multi-statement transaction can be restarted on at the active * transaction number for servers in a sharded cluster. * - * @tags: [requires_sharding, uses_transactions] + * @tags: [requires_sharding, uses_transactions, uses_prepare_transaction] */ (function() { "use strict"; diff --git a/jstests/sharding/resume_change_stream.js b/jstests/sharding/resume_change_stream.js index 53396973a7c..9b5e33d0173 100644 --- a/jstests/sharding/resume_change_stream.js +++ b/jstests/sharding/resume_change_stream.js @@ -1,6 +1,6 @@ // Tests resuming change streams on sharded collections. // We need to use a readConcern in this test, which requires read commands. -// @tags: [requires_find_command] +// @tags: [requires_find_command, uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/resume_change_stream_from_stale_mongos.js b/jstests/sharding/resume_change_stream_from_stale_mongos.js index 68ec7799242..7b8dd9cf673 100644 --- a/jstests/sharding/resume_change_stream_from_stale_mongos.js +++ b/jstests/sharding/resume_change_stream_from_stale_mongos.js @@ -1,6 +1,7 @@ // Tests that resuming a change stream that has become sharded via a mongos that believes the // collection is still unsharded will end up targeting the change stream to all shards after getting // a stale shard version. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/resume_change_stream_on_subset_of_shards.js b/jstests/sharding/resume_change_stream_on_subset_of_shards.js index 2690c32b85b..3c51004ed3c 100644 --- a/jstests/sharding/resume_change_stream_on_subset_of_shards.js +++ b/jstests/sharding/resume_change_stream_on_subset_of_shards.js @@ -1,5 +1,6 @@ // This tests resuming a change stream on a sharded collection where not all shards have a chunk in // the collection. +// @tags: [uses_change_streams] (function() { "use strict"; diff --git a/jstests/sharding/snapshot_cursor_commands_mongos.js b/jstests/sharding/snapshot_cursor_commands_mongos.js index 30cee7728d1..6609cbc4376 100644 --- a/jstests/sharding/snapshot_cursor_commands_mongos.js +++ b/jstests/sharding/snapshot_cursor_commands_mongos.js @@ -1,5 +1,5 @@ // Tests snapshot isolation on readConcern level snapshot reads through mongos. -// @tags: [requires_sharding, uses_transactions] +// @tags: [requires_sharding, uses_transactions, uses_multi_shard_transaction] (function() { "use strict"; diff --git a/jstests/sharding/transactions_snapshot_errors_first_statement.js b/jstests/sharding/transactions_snapshot_errors_first_statement.js index 7e31480d520..7d8e3dabeb2 100644 --- a/jstests/sharding/transactions_snapshot_errors_first_statement.js +++ b/jstests/sharding/transactions_snapshot_errors_first_statement.js @@ -6,7 +6,7 @@ // Runs against an unsharded collection, a sharded collection with all chunks on one shard, and a // sharded collection with one chunk on both shards. // -// @tags: [requires_sharding, uses_transactions] +// @tags: [requires_sharding, uses_transactions, uses_multi_shard_transaction] (function() { "use strict"; diff --git a/jstests/sharding/transactions_snapshot_errors_subsequent_statements.js b/jstests/sharding/transactions_snapshot_errors_subsequent_statements.js index f346a8eea48..28a6e861fee 100644 --- a/jstests/sharding/transactions_snapshot_errors_subsequent_statements.js +++ b/jstests/sharding/transactions_snapshot_errors_subsequent_statements.js @@ -5,7 +5,7 @@ // Runs against an unsharded collection, a sharded collection with all chunks on one shard, and a // sharded collection with one chunk on both shards. // -// @tags: [requires_sharding, uses_transactions] +// @tags: [requires_sharding, uses_transactions, uses_multi_shard_transaction] (function() { "use strict"; diff --git a/jstests/sharding/transactions_stale_database_version_errors.js b/jstests/sharding/transactions_stale_database_version_errors.js index 02f1d37c113..6c3329c5400 100644 --- a/jstests/sharding/transactions_stale_database_version_errors.js +++ b/jstests/sharding/transactions_stale_database_version_errors.js @@ -1,6 +1,6 @@ // Tests mongos behavior on stale database version errors received in a transaction. // -// @tags: [requires_sharding, uses_transactions] +// @tags: [requires_sharding, uses_transactions, uses_multi_shard_transaction] (function() { "use strict"; diff --git a/jstests/sharding/transactions_stale_shard_version_errors.js b/jstests/sharding/transactions_stale_shard_version_errors.js index 4d9b7f7edf3..7e796ca80a0 100644 --- a/jstests/sharding/transactions_stale_shard_version_errors.js +++ b/jstests/sharding/transactions_stale_shard_version_errors.js @@ -1,6 +1,6 @@ // Tests mongos behavior on stale shard version errors received in a transaction. // -// @tags: [requires_sharding, uses_transactions] +// @tags: [requires_sharding, uses_transactions, uses_multi_shard_transaction] (function() { "use strict"; diff --git a/jstests/sharding/txn_agg.js b/jstests/sharding/txn_agg.js index 58a61ed87d9..eff1304a1cb 100644 --- a/jstests/sharding/txn_agg.js +++ b/jstests/sharding/txn_agg.js @@ -1,4 +1,4 @@ -// @tags: [uses_transactions, requires_find_command] +// @tags: [uses_transactions, requires_find_command, uses_multi_shard_transaction] (function() { "use strict"; diff --git a/jstests/sharding/txn_basic_two_phase_commit.js b/jstests/sharding/txn_basic_two_phase_commit.js index 182f653eb7e..677224c88b3 100644 --- a/jstests/sharding/txn_basic_two_phase_commit.js +++ b/jstests/sharding/txn_basic_two_phase_commit.js @@ -2,7 +2,7 @@ * Exercises the coordinator commands logic by simulating a basic two phase commit and basic two * phase abort. * - * @tags: [uses_transactions] + * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { const dbName = "test"; |