diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2018-02-14 17:27:55 -0500 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2018-02-14 17:27:55 -0500 |
commit | 6408164d14181b8717bdcb462456a90c16020a42 (patch) | |
tree | 422895fc515dd5138c3b227db956d545ffbfd830 | |
parent | 7585ab8e5a5fd1b1c2f5926a98cf12387d717fa9 (diff) | |
download | mongo-6408164d14181b8717bdcb462456a90c16020a42.tar.gz |
SERVER-32691 Add write_concern_majority_passthrough_WT task in Evergreen.
Modifies the usages of DBCommandCursor to work around how if the
CursorTracker is registered on the replica set connection (i.e. the
DBClientRS instance), then it'll trigger a verify() failure when garbage
collection occurs.
Also changes the aggregation_read_concern_majority_passthrough.yml,
read_concern_majority_passthrough.yml, and
write_concern_majority_passthrough.yml test suites to skip any
JavaScript tests that use the "collMod" command because it only supports
a w=1 writeConcern.
(cherry picked from commit bb8ac01f052a7b4b5c042085334ce640a1ab8dd1)
27 files changed, 85 insertions, 25 deletions
diff --git a/buildscripts/resmokeconfig/suites/aggregation_read_concern_majority_passthrough.yml b/buildscripts/resmokeconfig/suites/aggregation_read_concern_majority_passthrough.yml index f5f4df39ecd..72b838b3c07 100644 --- a/buildscripts/resmokeconfig/suites/aggregation_read_concern_majority_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/aggregation_read_concern_majority_passthrough.yml @@ -26,6 +26,7 @@ selector: - assumes_write_concern_unchanged # "Cowardly refusing to run test with overridden write concern when it uses a command that can # only perform w=1 writes: ..." + - requires_collmod_command - requires_eval_command executor: diff --git a/buildscripts/resmokeconfig/suites/read_concern_majority_passthrough.yml b/buildscripts/resmokeconfig/suites/read_concern_majority_passthrough.yml index 7091cfb06fc..22e84bc9c63 100644 --- a/buildscripts/resmokeconfig/suites/read_concern_majority_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/read_concern_majority_passthrough.yml @@ -23,6 +23,7 @@ selector: - assumes_write_concern_unchanged # "Cowardly refusing to run test with overridden write concern when it uses a command that can # only perform w=1 writes: ..." + - requires_collmod_command - requires_eval_command executor: diff --git a/buildscripts/resmokeconfig/suites/write_concern_majority_passthrough.yml b/buildscripts/resmokeconfig/suites/write_concern_majority_passthrough.yml index 614e0834e67..388046d2782 100644 --- a/buildscripts/resmokeconfig/suites/write_concern_majority_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/write_concern_majority_passthrough.yml @@ -32,6 +32,7 @@ selector: - assumes_write_concern_unchanged # "Cowardly refusing to run test with overridden write concern when it uses a command that can # only perform w=1 writes: ..." + - requires_collmod_command - requires_eval_command ## # The next tag corresponds to the special error thrown by the set_read_preference_secondary.js diff --git a/etc/evergreen.yml b/etc/evergreen.yml index d75dd715ae2..68f9203db28 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -2737,6 +2737,17 @@ tasks: run_multiple_jobs: true - <<: *task_template + name: write_concern_majority_passthrough_WT + depends_on: + - name: jsCore_WT + commands: + - func: "do setup" + - func: "run tests" + vars: + resmoke_args: --suites=write_concern_majority_passthrough --storageEngine=wiredTiger + run_multiple_jobs: true + +- <<: *task_template name: replica_sets commands: - func: "do setup" @@ -3665,6 +3676,7 @@ buildvariants: - name: tool - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: push - name: linux-64-repeated-execution @@ -3782,6 +3794,7 @@ buildvariants: - name: tool - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: linux-64-duroff display_name: Linux (No Journal) @@ -4586,6 +4599,7 @@ buildvariants: - name: sslSpecial - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: push distros: - ubuntu1604-test @@ -5020,6 +5034,7 @@ buildvariants: - name: tool - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: push distros: - rhel70-small @@ -5159,6 +5174,9 @@ buildvariants: - name: tool - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT + distros: + - windows-64-vs2015-large - name: enterprise-windows-64 display_name: "* Enterprise Windows" @@ -5609,6 +5627,7 @@ buildvariants: - name: tool - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: push distros: - rhel70-small @@ -5926,6 +5945,9 @@ buildvariants: - name: tool - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT + distros: + - rhel62-large - name: package distros: - ubuntu1604-packer @@ -6078,6 +6100,7 @@ buildvariants: - name: ssl - name: sslSpecial - name: unittests + - name: write_concern_majority_passthrough_WT - name: enterprise-rhel-70-64-bit display_name: Enterprise RHEL 7.0 @@ -6491,6 +6514,7 @@ buildvariants: - name: sslSpecial - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: push distros: - rhel70-small @@ -6593,6 +6617,7 @@ buildvariants: - name: sslSpecial - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: push distros: - rhel70-small @@ -6728,6 +6753,7 @@ buildvariants: # - name: tool - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: push distros: - rhel62-small @@ -7109,6 +7135,7 @@ buildvariants: - name: sslSpecial - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: push distros: - suse12-test @@ -7381,6 +7408,7 @@ buildvariants: - name: sslSpecial - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: push distros: - suse11-test @@ -7955,6 +7983,7 @@ buildvariants: - name: sslSpecial - name: tool - name: unittests + - name: write_concern_majority_passthrough_WT - name: linux-64-ephemeralForTest display_name: Linux (ephemeralForTest) @@ -8112,6 +8141,7 @@ buildvariants: - name: sslSpecial - name: tool - name: unittests + - name: write_concern_majority_passthrough_WT - name: enterprise-rhel-72-s390x-inmem display_name: Enterprise RHEL 7.2 s390x (inMemory) DEBUG @@ -8199,6 +8229,7 @@ buildvariants: - name: sslSpecial - name: tool - name: unittests + - name: write_concern_majority_passthrough_WT ########################################### # Experimental buildvariants # @@ -8350,6 +8381,7 @@ buildvariants: - name: tool - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: ubuntu1604-asan display_name: ~ ASAN SSL Ubuntu 16.04 @@ -8526,6 +8558,7 @@ buildvariants: - name: tool - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: enterprise-ubuntu-dynamic-1604-64-bit display_name: "* Shared Library Enterprise Ubuntu 16.04" @@ -8676,6 +8709,7 @@ buildvariants: - name: tool - name: tool_WT - name: unittests + - name: write_concern_majority_passthrough_WT - name: initsync-3dot2-rhel-62 display_name: "~ Initial Sync 3.2 Enterprise RHEL 6.2" @@ -8777,3 +8811,6 @@ buildvariants: - rhel62-large - name: slow1 - name: slow1_WT + - name: write_concern_majority_passthrough_WT + distros: + - rhel62-large diff --git a/jstests/aggregation/extras/utils.js b/jstests/aggregation/extras/utils.js index 2dd1038388c..68b2597c533 100644 --- a/jstests/aggregation/extras/utils.js +++ b/jstests/aggregation/extras/utils.js @@ -276,7 +276,7 @@ function assertErrorCode(coll, pipe, code, errmsg) { var cursorRes = coll.runCommand("aggregate", cmd); if (cursorRes.ok) { var followupBatchSize = 0; // default - var cursor = new DBCommandCursor(coll.getMongo(), cursorRes, followupBatchSize); + var cursor = new DBCommandCursor(cursorRes._mongo, cursorRes, followupBatchSize); var error = assert.throws(function() { cursor.itcount(); diff --git a/jstests/core/bypass_doc_validation.js b/jstests/core/bypass_doc_validation.js index d9bca81ab6d..c2cdfff0bc9 100644 --- a/jstests/core/bypass_doc_validation.js +++ b/jstests/core/bypass_doc_validation.js @@ -1,5 +1,7 @@ // Test the bypassDocumentValidation flag with some database commands. The test uses relevant shell // helpers when they're available for the respective server commands. +// +// @tags: [requires_collmod_command] (function() { 'use strict'; diff --git a/jstests/core/collmod.js b/jstests/core/collmod.js index 16f9694560c..e366041bd99 100644 --- a/jstests/core/collmod.js +++ b/jstests/core/collmod.js @@ -1,5 +1,7 @@ // Basic js tests for the collMod command. // Test setting the usePowerOf2Sizes flag, and modifying TTL indexes. +// +// @tags: [requires_collmod_command] function debug(x) { // printjson( x ); diff --git a/jstests/core/collmod_bad_spec.js b/jstests/core/collmod_bad_spec.js index ccce81fd4b1..c3d5e7a148e 100644 --- a/jstests/core/collmod_bad_spec.js +++ b/jstests/core/collmod_bad_spec.js @@ -2,6 +2,8 @@ // // Tests that a collMod with a bad specification does not cause any changes, and does not crash the // server. +// +// @tags: [requires_collmod_command] (function() { "use strict"; diff --git a/jstests/core/doc_validation.js b/jstests/core/doc_validation.js index a30763869e7..95dbae1b219 100644 --- a/jstests/core/doc_validation.js +++ b/jstests/core/doc_validation.js @@ -1,4 +1,6 @@ // Test basic inserts and updates with document validation. +// +// @tags: [requires_collmod_command] (function() { "use strict"; diff --git a/jstests/core/doc_validation_invalid_validators.js b/jstests/core/doc_validation_invalid_validators.js index b78b31c0977..70262f5de43 100644 --- a/jstests/core/doc_validation_invalid_validators.js +++ b/jstests/core/doc_validation_invalid_validators.js @@ -1,5 +1,7 @@ // Verify invalid validator statements won't work and that we // can't create validated collections on restricted databases. +// +// @tags: [requires_collmod_command] (function() { "use strict"; diff --git a/jstests/core/doc_validation_options.js b/jstests/core/doc_validation_options.js index 8a96685e48f..d1434af6d45 100644 --- a/jstests/core/doc_validation_options.js +++ b/jstests/core/doc_validation_options.js @@ -1,3 +1,4 @@ +// @tags: [requires_collmod_command] (function() { "use strict"; diff --git a/jstests/core/list_collections1.js b/jstests/core/list_collections1.js index c8c3f92fbc9..ff1aac304ff 100644 --- a/jstests/core/list_collections1.js +++ b/jstests/core/list_collections1.js @@ -72,8 +72,8 @@ // var getListCollectionsCursor = function(options, subsequentBatchSize) { - return new DBCommandCursor( - mydb.getMongo(), mydb.runCommand("listCollections", options), subsequentBatchSize); + var res = mydb.runCommand("listCollections", options); + return new DBCommandCursor(res._mongo, res, subsequentBatchSize); }; var cursorCountMatching = function(cursor, pred) { @@ -282,9 +282,9 @@ assert.commandWorked(mydb.createCollection("quux")); res = mydb.runCommand("listCollections", {cursor: {batchSize: 0}}); - cursor = new DBCommandCursor(mydb.getMongo(), res, 2); + cursor = new DBCommandCursor(res._mongo, res, 2); cursor.close(); - cursor = new DBCommandCursor(mydb.getMongo(), res, 2); + cursor = new DBCommandCursor(res._mongo, res, 2); assert.throws(function() { cursor.hasNext(); }); diff --git a/jstests/core/list_collections_filter.js b/jstests/core/list_collections_filter.js index e0d18f055d0..0516d57a417 100644 --- a/jstests/core/list_collections_filter.js +++ b/jstests/core/list_collections_filter.js @@ -19,8 +19,8 @@ filter = {}; } - var cursor = new DBCommandCursor(mydb.getMongo(), - mydb.runCommand("listCollections", {filter: filter})); + var res = mydb.runCommand("listCollections", {filter: filter}); + var cursor = new DBCommandCursor(res._mongo, res); function stripToName(result) { return result.name; } diff --git a/jstests/core/list_indexes.js b/jstests/core/list_indexes.js index de0f4473980..6ec9a7a13e1 100644 --- a/jstests/core/list_indexes.js +++ b/jstests/core/list_indexes.js @@ -27,8 +27,8 @@ // var getListIndexesCursor = function(coll, options, subsequentBatchSize) { - return new DBCommandCursor( - coll.getDB().getMongo(), coll.runCommand("listIndexes", options), subsequentBatchSize); + var res = coll.runCommand("listIndexes", options); + return new DBCommandCursor(res._mongo, res, subsequentBatchSize); }; var cursorGetIndexSpecs = function(cursor) { @@ -163,9 +163,9 @@ assert.commandWorked(coll.ensureIndex({c: 1}, {unique: true})); res = coll.runCommand("listIndexes", {cursor: {batchSize: 0}}); - cursor = new DBCommandCursor(coll.getDB().getMongo(), res, 2); + cursor = new DBCommandCursor(res._mongo, res, 2); cursor.close(); - cursor = new DBCommandCursor(coll.getDB().getMongo(), res, 2); + cursor = new DBCommandCursor(res._mongo, res, 2); assert.throws(function() { cursor.hasNext(); }); diff --git a/jstests/core/list_indexes_invalidation.js b/jstests/core/list_indexes_invalidation.js index b8cbe5eb134..9fe94de5efc 100644 --- a/jstests/core/list_indexes_invalidation.js +++ b/jstests/core/list_indexes_invalidation.js @@ -19,7 +19,7 @@ printjson(res); // Ensure the cursor has data, rename or drop the collection, and exhaust the cursor. - let cursor = new DBCommandCursor(db.getMongo(), res); + let cursor = new DBCommandCursor(res._mongo, res); let errMsg = 'expected more data from command ' + tojson(cmd) + ', with result ' + tojson(res); assert(cursor.hasNext(), errMsg); diff --git a/jstests/core/list_namespaces_invalidation.js b/jstests/core/list_namespaces_invalidation.js index 6f8033b5fe4..85eb26510bb 100644 --- a/jstests/core/list_namespaces_invalidation.js +++ b/jstests/core/list_namespaces_invalidation.js @@ -1,4 +1,6 @@ // SERVER-27996/SERVER-28022 Missing invalidation for system.namespaces writes +// +// @tags: [requires_collmod_command] (function() { 'use strict'; let dbInvalidName = 'system_namespaces_invalidations'; diff --git a/jstests/core/max_time_ms.js b/jstests/core/max_time_ms.js index 0cc7c684605..efe3dabcc6d 100644 --- a/jstests/core/max_time_ms.js +++ b/jstests/core/max_time_ms.js @@ -5,6 +5,7 @@ // # failpoint. The former operations may be routed to a secondary in the replica set, whereas the // # latter must be routed to the primary. // assumes_read_preference_unchanged, +// requires_collmod_command, // ] var t = db.max_time_ms; diff --git a/jstests/core/no_db_created.js b/jstests/core/no_db_created.js index 3491914d470..b67b193494c 100644 --- a/jstests/core/no_db_created.js +++ b/jstests/core/no_db_created.js @@ -1,4 +1,6 @@ // checks that operations do not create a database +// +// @tags: [requires_collmod_command] (function() { "use strict"; @@ -32,4 +34,4 @@ noDB(mydb); assert.writeOK(coll.insert({})); mydb.dropDatabase(); -}());
\ No newline at end of file +}()); diff --git a/jstests/core/rename_stayTemp.js b/jstests/core/rename_stayTemp.js index d8451af2d2d..8dee8f89fea 100644 --- a/jstests/core/rename_stayTemp.js +++ b/jstests/core/rename_stayTemp.js @@ -11,7 +11,7 @@ function ns(coll) { function istemp(name) { var result = db.runCommand("listCollections", {filter: {name: name}}); assert(result.ok); - var collections = new DBCommandCursor(db.getMongo(), result).toArray(); + var collections = new DBCommandCursor(result._mongo, result).toArray(); assert.eq(1, collections.length); return collections[0].options.temp ? true : false; } diff --git a/jstests/core/views/invalid_system_views.js b/jstests/core/views/invalid_system_views.js index 3ba282d2ca1..49ac600ba8b 100644 --- a/jstests/core/views/invalid_system_views.js +++ b/jstests/core/views/invalid_system_views.js @@ -1,6 +1,8 @@ /** * Tests that invalid view definitions in system.views do not impact valid commands on existing * collections. + * + * @tags: [requires_collmod_command] */ (function() { "use strict"; diff --git a/jstests/core/views/views_all_commands.js b/jstests/core/views/views_all_commands.js index 3d90bd24d32..e1798803a1b 100644 --- a/jstests/core/views/views_all_commands.js +++ b/jstests/core/views/views_all_commands.js @@ -48,6 +48,8 @@ * * skipStandalone * If true, do not run this command on a standalone mongod. + * + * @tags: [requires_collmod_command] */ (function() { @@ -294,19 +296,14 @@ }, command: function(conn) { // First get and check a partial result for an aggregate command. - let aggCmd = { - aggregate: "view", - pipeline: [{$sort: {_id: 1}}], - cursor: {batchSize: 2} - }; + let aggCmd = {aggregate: "view", pipeline: [], cursor: {batchSize: 2}}; let res = conn.runCommand(aggCmd); assert.commandWorked(res, aggCmd); let cursor = res.cursor; assert.eq( cursor.ns, "test.view", "expected view namespace in cursor: " + tojson(cursor)); let expectedFirstBatch = [{_id: 1}, {_id: 2}]; - assert.eq( - cursor.firstBatch, expectedFirstBatch, "aggregate returned wrong firstBatch"); + assert.eq(cursor.firstBatch, expectedFirstBatch, "find returned wrong firstBatch"); // Then check correct execution of the killCursors command. let killCursorsCmd = {killCursors: "view", cursors: [cursor.id]}; diff --git a/jstests/core/views/views_basic.js b/jstests/core/views/views_basic.js index d6032b105df..b4a2f177982 100644 --- a/jstests/core/views/views_basic.js +++ b/jstests/core/views/views_basic.js @@ -13,7 +13,7 @@ let res = viewsDB.runCommand(cmd); assert.commandWorked(res); - let cursor = new DBCommandCursor(db.getMongo(), res, 5); + let cursor = new DBCommandCursor(res._mongo, res, 5); let actual = cursor.toArray(); assert(arrayEq(actual, expected), "actual: " + tojson(cursor.toArray()) + ", expected:" + tojson(expected)); diff --git a/jstests/core/views/views_change.js b/jstests/core/views/views_change.js index 002284095c5..a62e7e7f04f 100644 --- a/jstests/core/views/views_change.js +++ b/jstests/core/views/views_change.js @@ -1,6 +1,7 @@ /** * Tests the behavior of views when the backing view or collection is changed. - * @tags: [requires_find_command] + * + * @tags: [requires_collmod_command, requires_find_command] */ (function() { "use strict"; diff --git a/jstests/core/views/views_collation.js b/jstests/core/views/views_collation.js index c6b58e81db9..38557358ce9 100644 --- a/jstests/core/views/views_collation.js +++ b/jstests/core/views/views_collation.js @@ -1,5 +1,7 @@ /** * Tests the behavior of operations when interacting with a view's default collation. + * + * @tags: [requires_collmod_command] */ (function() { "use strict"; diff --git a/jstests/core/views/views_find.js b/jstests/core/views/views_find.js index c196e980ce5..53c9d4e8b98 100644 --- a/jstests/core/views/views_find.js +++ b/jstests/core/views/views_find.js @@ -15,7 +15,7 @@ let assertFindResultEq = function(cmd, expected, ordered) { let res = viewsDB.runCommand(cmd); assert.commandWorked(res); - let arr = new DBCommandCursor(db.getMongo(), res, 5).toArray(); + let arr = new DBCommandCursor(res._mongo, res, 5).toArray(); let errmsg = tojson({expected: expected, got: arr}); if (typeof(ordered) === "undefined" || !ordered) diff --git a/jstests/core/views/views_validation.js b/jstests/core/views/views_validation.js index 84c7f1d3510..b32750a082f 100644 --- a/jstests/core/views/views_validation.js +++ b/jstests/core/views/views_validation.js @@ -1,3 +1,4 @@ +// @tags: [requires_collmod_command] (function() { "use strict"; let viewsDb = db.getSiblingDB("views_validation"); diff --git a/jstests/libs/override_methods/set_read_and_write_concerns.js b/jstests/libs/override_methods/set_read_and_write_concerns.js index a00b030d9f0..f371644c8f7 100644 --- a/jstests/libs/override_methods/set_read_and_write_concerns.js +++ b/jstests/libs/override_methods/set_read_and_write_concerns.js @@ -65,6 +65,7 @@ "createRole", "createUser", "delete", + "deleteIndexes", "drop", "dropAllRolesFromDatabase", "dropAllUsersFromDatabase", @@ -108,7 +109,7 @@ commandName = Object.keys(commandObjUnwrapped)[0]; } - if (commandName === "eval" || commandName === "$eval") { + if (commandName === "collMod" || commandName === "eval" || commandName === "$eval") { throw new Error("Cowardly refusing to run test with overridden write concern when it" + " uses a command that can only perform w=1 writes: " + tojson(commandObj)); |