diff options
author | Suganthi Mani <suganthi.mani@mongodb.com> | 2018-08-09 17:53:48 -0400 |
---|---|---|
committer | Suganthi Mani <suganthi.mani@mongodb.com> | 2018-08-09 17:53:48 -0400 |
commit | b7a5ec640398ae282cbca54a5f1f482d1fb945d0 (patch) | |
tree | f9b13354bff2d64e379431056d43c7464288eae6 | |
parent | 5ce451fae4e097bb5673b73f5ff6c070e25d5d62 (diff) | |
download | mongo-b7a5ec640398ae282cbca54a5f1f482d1fb945d0.tar.gz |
SERVER-36083 Added evergreen variant with enableMajorityReadConcern set to false.
45 files changed, 262 insertions, 17 deletions
diff --git a/buildscripts/resmokelib/config.py b/buildscripts/resmokelib/config.py index aa7ab64d4fc..5a71bd9f4ec 100644 --- a/buildscripts/resmokelib/config.py +++ b/buildscripts/resmokelib/config.py @@ -73,6 +73,7 @@ DEFAULTS = { "shell_write_mode": None, "shuffle": None, "stagger_jobs": None, + "majority_read_concern": None, # Default is set on the commandline. "storage_engine": None, "storage_engine_cache_size_gb": None, "tag_file": None, @@ -314,6 +315,9 @@ SHUFFLE = None # If true, the launching of jobs is staggered in resmoke.py. STAGGER_JOBS = None +# If set to true, it enables read concern majority. Else, read concern majority is disabled. +MAJORITY_READ_CONCERN = None; + # If set, then all mongod's started by resmoke.py and by the mongo shell will use the specified # storage engine. STORAGE_ENGINE = None diff --git a/buildscripts/resmokelib/core/programs.py b/buildscripts/resmokelib/core/programs.py index 82d640eb7a2..36ca08ce309 100644 --- a/buildscripts/resmokelib/core/programs.py +++ b/buildscripts/resmokelib/core/programs.py @@ -80,6 +80,7 @@ def mongod_program(logger, executable=None, process_kwargs=None, **kwargs): _apply_set_parameters(args, suite_set_parameters) shortcut_opts = { + "enableMajorityReadConcern": config.MAJORITY_READ_CONCERN, "nojournal": config.NO_JOURNAL, "nopreallocj": config.NO_PREALLOC_JOURNAL, "serviceExecutor": config.SERVICE_EXECUTOR, @@ -177,6 +178,7 @@ def mongo_shell_program(logger, executable=None, connection_string=None, filenam global_vars = kwargs.pop("global_vars", {}).copy() shortcut_opts = { + "enableMajorityReadConcern": (config.MAJORITY_READ_CONCERN, True), "noJournal": (config.NO_JOURNAL, False), "noJournalPrealloc": (config.NO_PREALLOC_JOURNAL, False), "serviceExecutor": (config.SERVICE_EXECUTOR, ""), @@ -314,6 +316,7 @@ def dbtest_program(logger, executable=None, suites=None, process_kwargs=None, ** if suites is not None: args.extend(suites) + kwargs["enableMajorityReadConcern"] = config.MAJORITY_READ_CONCERN if config.STORAGE_ENGINE is not None: kwargs["storageEngine"] = config.STORAGE_ENGINE diff --git a/buildscripts/resmokelib/parser.py b/buildscripts/resmokelib/parser.py index afc67cec8b0..0c7ee0695d1 100644 --- a/buildscripts/resmokelib/parser.py +++ b/buildscripts/resmokelib/parser.py @@ -199,6 +199,11 @@ def parse_command_line(): help=("Enable or disable the stagger of launching resmoke jobs." " Defaults to %default.")) + parser.add_option("--majorityReadConcern", type="choice", action="store", + dest="majority_read_concern", choices=("on", "off"), metavar="ON|OFF", + help=("Enable or disable majority read concern support." + " Defaults to %default.")) + parser.add_option("--storageEngine", dest="storage_engine", metavar="ENGINE", help="The storage engine used by dbtests and jstests.") @@ -300,7 +305,8 @@ def parse_command_line(): suite_files="with_server", prealloc_journal="off", shuffle="auto", - stagger_jobs="off") + stagger_jobs="off", + majority_read_concern="on") options, args = parser.parse_args() @@ -350,6 +356,7 @@ def update_config_vars(values): _config.FAIL_FAST = not config.pop("continue_on_failure") _config.INCLUDE_WITH_ANY_TAGS = _tags_from_list(config.pop("include_with_any_tags")) _config.JOBS = config.pop("jobs") + _config.MAJORITY_READ_CONCERN = config.pop("majority_read_concern") == "on" _config.MONGO_EXECUTABLE = _expand_user(config.pop("mongo_executable")) _config.MONGOD_EXECUTABLE = _expand_user(config.pop("mongod_executable")) _config.MONGOD_SET_PARAMETERS = config.pop("mongod_set_parameters") diff --git a/etc/evergreen.yml b/etc/evergreen.yml index df19201fecf..de047a19b92 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -7367,6 +7367,176 @@ buildvariants: - ubuntu1604-packer - name: push +- name: enterprise-rhel-62-64-bit-majority-read-concern-off + display_name: "Enterprise RHEL 6.2 (majority read concern off)" + modules: + - enterprise + run_on: + - rhel62-small + expansions: + rlp_environment: MONGOD_UNITTEST_RLP_LANGUAGE_TEST_BTROOT=/opt/basis + compile_flags: --ssl MONGO_DISTMOD=rhel62 -j$(grep -c ^processor /proc/cpuinfo) --release --variables-files=etc/scons/mongodbtoolchain_gcc.vars CPPPATH="/opt/basis/rlp/rlp/include /opt/basis/rlp/utilities/include" --use-basis-tech-rosette-linguistics-platform=on + test_flags: --majorityReadConcern=off --excludeWithAnyTags=requires_mmapv1,requires_majority_read_concern + multiversion_platform: rhel62 + multiversion_edition: enterprise + num_jobs_available: $(grep -c ^processor /proc/cpuinfo) + use_scons_cache: true + gorootvars: 'PATH="/opt/go1.8/go/bin:/opt/mongodbtoolchain/v2/bin/:$PATH" GOROOT=/opt/go1.8/go' + tooltags: "-tags 'ssl sasl'" + build_mongoreplay: true + tasks: + - name: compile + distros: + - rhel62-large + - name: compile_all + distros: + - rhel62-large + - name: rollback_fuzzer_WT + - name: aggregation_WT + - name: aggregation_WT_ese + - name: aggregation_auth + - name: aggregation_facet_unwind_passthrough_WT + - name: aggregation_sharded_collections_passthrough_WT + - name: audit_WT + - name: auth_WT + - name: auth_audit_WT + - name: bulk_gle_passthrough_WT + - name: causally_consistent_jscore_passthrough_WT + - name: causally_consistent_jscore_passthrough_auth_WT + - name: sharded_causally_consistent_jscore_passthrough_WT + - name: concurrency_WT + - name: concurrency_replication_WT + - name: concurrency_sharded_WT + - name: concurrency_sharded_causal_consistency_WT + - name: concurrency_sharded_causal_consistency_and_balancer_WT + - name: concurrency_simultaneous_WT + - name: dbtest_WT + - name: disk_WT + - name: ese_WT + - name: failpoints + - name: failpoints_auth + - name: gle_auth_WT + - name: gle_auth_basics_passthrough_WT + - name: gle_auth_basics_passthrough_write_cmd_WT + - name: gle_auth_write_cmd_WT + - name: integration_tests_replset + - name: integration_tests_sharded + - name: integration_tests_standalone + - name: jsCore_WT + - name: jsCore_WT_ese + - name: jsCore_compatibility_WT + - name: jsCore_decimal_WT + - name: jsCore_minimum_batch_size_WT + - name: jsCore_op_query_WT + - name: jsonSchema + - name: aggregation_fuzzer_WT + - name: jstestfuzz_WT + - name: jstestfuzz_concurrent_WT + - name: jstestfuzz_concurrent_replication_WT + - name: jstestfuzz_concurrent_replication_session_WT + - name: jstestfuzz_concurrent_sharded_WT + - name: jstestfuzz_concurrent_sharded_causal_consistency_WT + - name: jstestfuzz_concurrent_sharded_continuous_stepdown + - name: jstestfuzz_concurrent_sharded_session_WT + - name: jstestfuzz_replication_WT + - name: jstestfuzz_replication_initsync_WT + - name: jstestfuzz_replication_session_WT + - name: jstestfuzz_sharded_WT + - name: jstestfuzz_sharded_causal_consistency_WT + - name: jstestfuzz_sharded_continuous_stepdown + - name: jstestfuzz_sharded_session_WT + - name: master_slave_WT + - name: master_slave_auth + - name: master_slave_jscore_passthrough_WT + - name: multiversion_WT + - name: multiversion_multistorage_engine + - name: noPassthroughWithMongod_WT + - name: noPassthrough_WT + - name: parallel_WT + - name: parallel_compatibility_WT + - name: read_concern_linearizable_passthrough_WT + distros: + - rhel62-large + - name: read_only_WT + - name: read_only_sharded_WT + - name: replica_sets_WT + distros: + - rhel62-large + - name: replica_sets_WT_ese + distros: + - rhel62-large + - name: replica_sets_auth + distros: + - rhel62-large + - name: replica_sets_pv0 + distros: + - rhel62-large + - name: replica_sets_rollback_refetch_no_uuid + distros: + - rhel62-large + - name: replica_sets_jscore_passthrough_WT + distros: + - rhel62-large + - name: replica_sets_initsync_jscore_passthrough_WT + distros: + - rhel62-large + - name: replica_sets_initsync_static_jscore_passthrough_WT + distros: + - rhel62-large + - name: replica_sets_resync_static_jscore_passthrough_WT + distros: + - rhel62-large + - name: replica_sets_kill_secondaries_jscore_passthrough_WT + distros: + - rhel62-large + - name: replica_sets_jscore_fcv34_passthrough_WT + distros: + - rhel62-large + - name: retryable_writes_jscore_passthrough_WT + distros: + - rhel62-large + - name: rlp_WT + - name: sasl + - name: session_jscore_passthrough_WT + - name: sharded_collections_jscore_passthrough_WT + - name: sharding_WT + distros: + - rhel62-large + - name: sharding_WT_ese + distros: + - rhel62-large + - name: sharding_auth + distros: + - rhel62-large + - name: sharding_auth_audit_WT + distros: + - rhel62-large + - name: sharding_gle_auth_basics_passthrough_WT + - name: sharding_gle_auth_basics_passthrough_write_cmd_WT + - name: sharding_jscore_passthrough_WT + - name: sharding_jscore_op_query_passthrough_WT + - name: sharding_jscore_passthrough_wire_ops_WT + - name: sharding_last_stable_mongos_and_mixed_shards + distros: + - rhel62-large + - name: sharding_op_query_WT + distros: + - rhel62-large + - name: sharding_csrs_continuous_config_stepdown_WT + distros: + - rhel62-large + - name: slow1_WT + - name: serial_run_WT + - name: snmp_WT + - name: ssl + - name: sslSpecial + - name: tool_WT + - name: update_fuzzer_WT + - name: update_fuzzer_replication_WT + - name: write_concern_majority_passthrough_WT + distros: + - rhel62-large + - name: enterprise-rhel-62-64-bit-coverage display_name: "~ Enterprise RHEL 6.2 DEBUG Code Coverage" modules: diff --git a/jstests/multiVersion/causal_consistency_downgrade_cluster.js b/jstests/multiVersion/causal_consistency_downgrade_cluster.js index c23ff0023bf..e45dba25306 100644 --- a/jstests/multiVersion/causal_consistency_downgrade_cluster.js +++ b/jstests/multiVersion/causal_consistency_downgrade_cluster.js @@ -1,6 +1,7 @@ /** * Test the downgrade of a sharded cluster from latest to last-stable version succeeds, verifying * behavior related to causal consistency at each stage. + * @tags: [requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/multiVersion/causal_consistency_upgrade_cluster.js b/jstests/multiVersion/causal_consistency_upgrade_cluster.js index 9f5c2d98414..39c8c812554 100644 --- a/jstests/multiVersion/causal_consistency_upgrade_cluster.js +++ b/jstests/multiVersion/causal_consistency_upgrade_cluster.js @@ -2,6 +2,7 @@ * Tests upgrading a cluster with two shards and two mongos servers from last stable to current * version, verifying the behavior of $clusterTime metadata and afterClusterTime commands throughout * the process. + * @tags: [requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/noPassthrough/after_cluster_time.js b/jstests/noPassthrough/after_cluster_time.js index 9bcf4598ecb..53e544bb57b 100644 --- a/jstests/noPassthrough/after_cluster_time.js +++ b/jstests/noPassthrough/after_cluster_time.js @@ -1,4 +1,5 @@ // This test verifies readConcern:afterClusterTime behavior on a standalone mongod. +// @tags: [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 c3178d20c49..49e098735fe 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/causal_consistency_feature_compatibility.js b/jstests/noPassthrough/causal_consistency_feature_compatibility.js index 91c97f1cb64..cf7f613c26a 100644 --- a/jstests/noPassthrough/causal_consistency_feature_compatibility.js +++ b/jstests/noPassthrough/causal_consistency_feature_compatibility.js @@ -1,6 +1,7 @@ /** * Tests the behavior of a sharded cluster when featureCompatibilityVersion is set to 3.4, with * respect to causal consistency. In noPassthrough to avoid issues with auth. + * @tags: [requires_majority_read_concern] */ (function() { "use strict"; diff --git a/jstests/noPassthrough/change_stream_feature_compatibility_version.js b/jstests/noPassthrough/change_stream_feature_compatibility_version.js index c698176e946..1bbf312650c 100644 --- a/jstests/noPassthrough/change_stream_feature_compatibility_version.js +++ b/jstests/noPassthrough/change_stream_feature_compatibility_version.js @@ -1,5 +1,6 @@ // Test that $changeStreams usage is disallowed when the featureCompatibilityVersion is 3.4. // and that existing streams close when FCV is set to 3.4 +// @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 df2bdd61e2e..126c7100484 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: [requires_majority_read_concern] (function() { "use strict"; diff --git a/jstests/noPassthrough/change_streams_update_lookup_collation.js b/jstests/noPassthrough/change_streams_update_lookup_collation.js index 121a41c53bd..f3914b2a272 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, requires_majority_read_concern] (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/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_majority.js b/jstests/noPassthrough/read_majority.js index fd3ceb2c35a..35e4d584e4e 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 40172ff0909..a28667abf0d 100644 --- a/jstests/noPassthrough/read_majority_reads.js +++ b/jstests/noPassthrough/read_majority_reads.js @@ -14,6 +14,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_majority_read_concern] */ (function() { diff --git a/jstests/noPassthrough/skip_sharding_configuration_checks.js b/jstests/noPassthrough/skip_sharding_configuration_checks.js index 2dc096faf8e..bec83f082df 100644 --- a/jstests/noPassthrough/skip_sharding_configuration_checks.js +++ b/jstests/noPassthrough/skip_sharding_configuration_checks.js @@ -1,6 +1,6 @@ /** * Starts standalone RS with skipShardingConfigurationChecks. - * @tags: [requires_persistence] + * @tags: [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 0f5ea72768f..294255e0a62 100644 --- a/jstests/noPassthrough/unsupported_change_stream_deployments.js +++ b/jstests/noPassthrough/unsupported_change_stream_deployments.js @@ -1,4 +1,5 @@ // Tests that the $changeStream stage returns an error when run against a standalone mongod. +// @tags: [requires_majority_read_concern] (function() { "use strict"; load("jstests/aggregation/extras/utils.js"); // For assertErrorCode. 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 743b1b1c4c1..c43c82673f1 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/mmap_disallows_rc_majority.js b/jstests/replsets/mmap_disallows_rc_majority.js index 59b5c9fdd4a..66999e4473f 100644 --- a/jstests/replsets/mmap_disallows_rc_majority.js +++ b/jstests/replsets/mmap_disallows_rc_majority.js @@ -8,6 +8,7 @@ * read concern majority request. * * This test requires mmapv1, but does not rely on the tag to ensure this. + * @tags: [requires_mmapv1] */ (function() { "use strict"; 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/read_concern_uninitated_set.js b/jstests/replsets/read_concern_uninitated_set.js index 0a4aa87b0c4..83d455e66ad 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/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..4e40d75a6d7 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: [requires_majority_read_concern] (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 bc22369bd8e..23295bf77cc 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: [requires_majority_read_concern] (function() { "use strict"; diff --git a/jstests/sharding/change_stream_invalidation.js b/jstests/sharding/change_stream_invalidation.js index f4904d5182e..6e5b9727787 100644 --- a/jstests/sharding/change_stream_invalidation.js +++ b/jstests/sharding/change_stream_invalidation.js @@ -1,4 +1,5 @@ // Tests invalidation of change streams on sharded collections. +// @tags: [requires_majority_read_concern] (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 02766b7b592..78ba996b8fe 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: [requires_majority_read_concern] (function() { "use strict"; @@ -46,4 +47,4 @@ stream.close(); st.stop(); -})();
\ No newline at end of file +})(); diff --git a/jstests/sharding/change_stream_read_preference.js b/jstests/sharding/change_stream_read_preference.js index 572ecf82424..d2e78869f3c 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: [requires_majority_read_concern] (function() { "use strict"; diff --git a/jstests/sharding/change_stream_update_lookup_collation.js b/jstests/sharding/change_stream_update_lookup_collation.js index 707fe59708f..2e3c615e1c6 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, requires_majority_read_concern] (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 ec64b9a2842..2525b48299e 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: [requires_majority_read_concern] (function() { "use strict"; diff --git a/jstests/sharding/change_streams.js b/jstests/sharding/change_streams.js index 404b73c72ef..58d264d3ff6 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: [requires_majority_read_concern] (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..c6e678e5d01 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: [requires_majority_read_concern] (function() { 'use strict'; diff --git a/jstests/sharding/change_streams_primary_shard_unaware.js b/jstests/sharding/change_streams_primary_shard_unaware.js index 4c7329c85e3..203de19d88b 100644 --- a/jstests/sharding/change_streams_primary_shard_unaware.js +++ b/jstests/sharding/change_streams_primary_shard_unaware.js @@ -1,7 +1,7 @@ // Tests the behavior of a change stream on a collection that becomes sharded, however the primary // shard is unaware and still sees the collection as unsharded. // -// @tags: [requires_persistence] +// @tags: [requires_persistence, requires_majority_read_concern] (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 3ed7d3fe98a..ea2e04169d0 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: [requires_majority_read_concern] (function() { "use strict"; diff --git a/jstests/sharding/change_streams_unsharded_becomes_sharded.js b/jstests/sharding/change_streams_unsharded_becomes_sharded.js index c59ae695486..74dd080592f 100644 --- a/jstests/sharding/change_streams_unsharded_becomes_sharded.js +++ b/jstests/sharding/change_streams_unsharded_becomes_sharded.js @@ -1,6 +1,7 @@ // Tests the behavior of change streams on a collection that was initially unsharded but then // becomes sharded. In particular, test that post-shardCollection inserts update their cached // 'documentKey' to include the new shard key. +// @tags: [requires_majority_read_concern] (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 3c89fd6b85c..7ca746dfea3 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: [requires_majority_read_concern] (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 613ca8f2b33..2be44c6ec3e 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: [requires_majority_read_concern] (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 0f16c4928a1..4243b6caac4 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: [requires_majority_read_concern] (function() { "use strict"; diff --git a/jstests/sharding/resume_change_stream.js b/jstests/sharding/resume_change_stream.js index 41a2426796a..0e885550350 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, requires_majority_read_concern] (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..f75082623e8 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: [requires_majority_read_concern] (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 b65690412e0..dc53c169dac 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 @@ // Designed to reproduce SERVER-32088, this tests that resuming a change stream on a sharded // collection where not all shards have a chunk in the collection will not work. +// @tags: [requires_majority_read_concern] (function() { "use strict"; diff --git a/src/mongo/dbtests/framework_options.cpp b/src/mongo/dbtests/framework_options.cpp index 0d2a4768213..56397d2d7ad 100644 --- a/src/mongo/dbtests/framework_options.cpp +++ b/src/mongo/dbtests/framework_options.cpp @@ -101,6 +101,14 @@ Status addTestFrameworkOptions(moe::OptionSection* options) { options->addOptionChaining( "perfHist", "perfHist", moe::Unsigned, "number of back runs of perf stats to display"); + // If set to true, storage engine maintains the data history. Else, it won't maintain the data + // history. This setting applies only to 'wiredTiger' storage engine. + options + ->addOptionChaining("replication.enableMajorityReadConcern", + "enableMajorityReadConcern", + moe::Bool, + "enables majority readConcern") + .setDefault(moe::Value(true)); options ->addOptionChaining( "storage.engine", "storageEngine", moe::String, "what storage engine to use") @@ -232,6 +240,12 @@ Status storeTestFrameworkOptions(const moe::Environment& params, storageGlobalParams.engine = params["storage.engine"].as<string>(); + if (storageGlobalParams.engine == "wiredTiger" && + params.count("replication.enableMajorityReadConcern")) { + serverGlobalParams.enableMajorityReadConcern = + params["replication.enableMajorityReadConcern"].as<bool>(); + } + if (params.count("suites")) { frameworkGlobalParams.suites = params["suites"].as<vector<string>>(); } diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp index 7e15647cf05..94af6494f7e 100644 --- a/src/mongo/dbtests/storage_timestamp_tests.cpp +++ b/src/mongo/dbtests/storage_timestamp_tests.cpp @@ -64,7 +64,8 @@ public: LogicalClock* _clock = LogicalClock::get(_opCtx); StorageTimestampTest() { - if (mongo::storageGlobalParams.engine != "wiredTiger") { + if (!(mongo::storageGlobalParams.engine == "wiredTiger" && + mongo::serverGlobalParams.enableMajorityReadConcern)) { return; } @@ -90,7 +91,8 @@ public: } ~StorageTimestampTest() { - if (mongo::storageGlobalParams.engine != "wiredTiger") { + if (!(mongo::storageGlobalParams.engine == "wiredTiger" && + mongo::serverGlobalParams.enableMajorityReadConcern)) { return; } @@ -199,7 +201,8 @@ class SecondaryInsertTimes : public StorageTimestampTest { public: void run() { // Only run on 'wiredTiger'. No other storage engines to-date timestamp writes. - if (mongo::storageGlobalParams.engine != "wiredTiger") { + if (!(mongo::storageGlobalParams.engine == "wiredTiger" && + mongo::serverGlobalParams.enableMajorityReadConcern)) { return; } @@ -262,7 +265,8 @@ class SecondaryArrayInsertTimes : public StorageTimestampTest { public: void run() { // Only run on 'wiredTiger'. No other storage engines to-date timestamp writes. - if (mongo::storageGlobalParams.engine != "wiredTiger") { + if (!(mongo::storageGlobalParams.engine == "wiredTiger" && + mongo::serverGlobalParams.enableMajorityReadConcern)) { return; } @@ -344,7 +348,8 @@ class SecondaryDeleteTimes : public StorageTimestampTest { public: void run() { // Only run on 'wiredTiger'. No other storage engines to-date timestamp writes. - if (mongo::storageGlobalParams.engine != "wiredTiger") { + if (!(mongo::storageGlobalParams.engine == "wiredTiger" && + mongo::serverGlobalParams.enableMajorityReadConcern)) { return; } @@ -408,7 +413,8 @@ class SecondaryUpdateTimes : public StorageTimestampTest { public: void run() { // Only run on 'wiredTiger'. No other storage engines to-date timestamp writes. - if (mongo::storageGlobalParams.engine != "wiredTiger") { + if (!(mongo::storageGlobalParams.engine == "wiredTiger" && + mongo::serverGlobalParams.enableMajorityReadConcern)) { return; } @@ -488,7 +494,8 @@ class SecondaryInsertToUpsert : public StorageTimestampTest { public: void run() { // Only run on 'wiredTiger'. No other storage engines to-date timestamp writes. - if (mongo::storageGlobalParams.engine != "wiredTiger") { + if (!(mongo::storageGlobalParams.engine == "wiredTiger" && + mongo::serverGlobalParams.enableMajorityReadConcern)) { return; } @@ -561,7 +568,8 @@ class SecondaryAtomicApplyOps : public StorageTimestampTest { public: void run() { // Only run on 'wiredTiger'. No other storage engines to-date timestamp writes. - if (mongo::storageGlobalParams.engine != "wiredTiger") { + if (!(mongo::storageGlobalParams.engine == "wiredTiger" && + mongo::serverGlobalParams.enableMajorityReadConcern)) { return; } @@ -624,7 +632,8 @@ class SecondaryAtomicApplyOpsWCEToNonAtomic : public StorageTimestampTest { public: void run() { // Only run on 'wiredTiger'. No other storage engines to-date timestamp writes. - if (mongo::storageGlobalParams.engine != "wiredTiger") { + if (!(mongo::storageGlobalParams.engine == "wiredTiger" && + mongo::serverGlobalParams.enableMajorityReadConcern)) { return; } diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js index a9f7cee143e..3310fc48103 100644 --- a/src/mongo/shell/servers.js +++ b/src/mongo/shell/servers.js @@ -1092,6 +1092,11 @@ var MongoRunner, _startMongod, startMongoProgram, runMongoProgram, startMongoPro if (programName.endsWith('mongod')) { if (jsTest.options().storageEngine === "wiredTiger" || !jsTest.options().storageEngine) { + if (!argArrayContains("--enableMajorityReadConcern")) { + argArray.push( + ...['--enableMajorityReadConcern', + jsTest.options().enableMajorityReadConcern.toString()]); + } if (jsTest.options().storageEngineCacheSizeGB && !argArrayContains('--wiredTigerCacheSizeGB')) { argArray.push(...['--wiredTigerCacheSizeGB', |