From 657074a4ea7219886f35124632a2f3c8da4513d0 Mon Sep 17 00:00:00 2001 From: Jonathan Abrahams Date: Thu, 25 Aug 2016 09:40:16 -0400 Subject: [PATCH] SERVER-24248 Run multiversion tests with different storage engines This reverts commit 45d31b50bd1669116248bae73d25769505e62acb. --- .../resmokeconfig/suites/multiversion.yml | 7 +- .../multiversion_multistorage_engine.yml | 13 +++ etc/evergreen.yml | 45 +++++++++- jstests/multiVersion/downgrade_replset.js | 8 +- jstests/multiVersion/dumprestore.js | 3 +- jstests/multiVersion/dumprestore_sharded.js | 6 +- jstests/multiVersion/geo_2dsphere_v2_to_v3.js | 17 ++-- .../invalid_key_pattern_upgrade.js | 1 + .../multiVersion/libs/dumprestore_helpers.js | 27 ++++-- jstests/multiVersion/libs/multi_cluster.js | 4 +- .../minor_version_downgrade_replset.js | 7 +- ...mmapv1_overrides_default_storage_engine.js | 7 ++ .../multiVersion/multikey_paths_downgrade.js | 2 +- jstests/multiVersion/partial_index_upgrade.js | 1 + .../multiVersion/readmode_compatibility.js | 6 +- jstests/multiVersion/server-23299-2.js | 9 +- .../wt_index_option_defaults_replset.js | 2 + src/mongo/shell/servers.js | 82 ++++++++++--------- 18 files changed, 179 insertions(+), 68 deletions(-) create mode 100644 buildscripts/resmokeconfig/suites/multiversion_multistorage_engine.yml diff --git a/buildscripts/resmokeconfig/suites/multiversion.yml b/buildscripts/resmokeconfig/suites/multiversion.yml index f38be92e75f..95c81adcc12 100644 --- a/buildscripts/resmokeconfig/suites/multiversion.yml +++ b/buildscripts/resmokeconfig/suites/multiversion.yml @@ -2,8 +2,11 @@ selector: js_test: roots: - jstests/multiVersion/*.js - exclude_files: -# TODO: SERVER-21578 + exclude_files: + # Multi storageEngine tests + - jstests/multiVersion/mixed_storage_version_replication.js + - jstests/multiVersion/transitioning_to_and_from_WT.js + # TODO: SERVER-21578 - jstests/multiVersion/balancer_multiVersion_detect.js # Multiversion tests start their own mongod's. diff --git a/buildscripts/resmokeconfig/suites/multiversion_multistorage_engine.yml b/buildscripts/resmokeconfig/suites/multiversion_multistorage_engine.yml new file mode 100644 index 00000000000..855720d8e43 --- /dev/null +++ b/buildscripts/resmokeconfig/suites/multiversion_multistorage_engine.yml @@ -0,0 +1,13 @@ +selector: + js_test: + roots: + - jstests/multiVersion/mixed_storage_version_replication.js + - jstests/multiVersion/transitioning_to_and_from_WT.js + +# Multiversion tests start their own mongod's. +executor: + js_test: + config: + shell_options: + eval: "load('jstests/libs/override_methods/multiversion_override_balancer_control.js');" + nodb: '' diff --git a/etc/evergreen.yml b/etc/evergreen.yml index 64c79820a01..588a7a62373 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -1773,7 +1773,29 @@ tasks: - func: "run tests" vars: path_prefix: PATH=$PATH:/data/multiversion - resmoke_args: --suites=multiversion + resmoke_args: --suites=multiversion --storageEngine=mmapv1 --excludeWithAnyTags=requires_wiredtiger + run_multiple_jobs: true + +- <<: *task_template + name: multiversion_WT + commands: + - func: "do setup" + - func: "do multiversion setup" + - func: "run tests" + vars: + path_prefix: PATH=$PATH:/data/multiversion + resmoke_args: --suites=multiversion --storageEngine=wiredTiger --excludeWithAnyTags=requires_mmapv1 + run_multiple_jobs: true + +- <<: *task_template + name: multiversion_multistorage_engine + commands: + - func: "do setup" + - func: "do multiversion setup" + - func: "run tests" + vars: + path_prefix: PATH=$PATH:/data/multiversion + resmoke_args: --suites=multiversion_multistorage_engine run_multiple_jobs: true - <<: *task_template @@ -2970,6 +2992,8 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT + - name: multiversion_multistorage_engine - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -3364,6 +3388,7 @@ buildvariants: - name: mongosTest - name: mmap - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -3484,6 +3509,7 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -3601,6 +3627,7 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -4133,6 +4160,7 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -4361,6 +4389,8 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT + - name: multiversion_multistorage_engine - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -5166,6 +5196,8 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT + - name: multiversion_multistorage_engine - name: noPassthrough - name: noPassthroughWithMongod - name: noPassthroughWithMongod_WT @@ -5387,6 +5419,7 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -5505,6 +5538,7 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -6294,6 +6328,7 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -6555,6 +6590,7 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -6874,6 +6910,7 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -6994,6 +7031,7 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthrough_WT - name: noPassthroughWithMongod @@ -7529,6 +7567,8 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT + - name: multiversion_multistorage_engine - name: noPassthrough - name: noPassthroughWithMongod - name: noPassthroughWithMongod_WT @@ -7695,6 +7735,8 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT + - name: multiversion_multistorage_engine - name: noPassthrough - name: noPassthroughWithMongod - name: noPassthroughWithMongod_WT @@ -7842,6 +7884,7 @@ buildvariants: - name: mmap - name: mongosTest - name: multiversion + - name: multiversion_WT - name: noPassthrough - name: noPassthroughWithMongod - name: noPassthroughWithMongod_WT diff --git a/jstests/multiVersion/downgrade_replset.js b/jstests/multiVersion/downgrade_replset.js index abffcf3875e..8ee5e0986ba 100644 --- a/jstests/multiVersion/downgrade_replset.js +++ b/jstests/multiVersion/downgrade_replset.js @@ -1,5 +1,8 @@ // Test the downgrade of a replica set from latest version // to last-stable version succeeds, while reads and writes continue. +// +// @tags: [requires_mmapv1] +// Note - downgrade from 3.3 to 3.2 is not possible for wiredTiger (SERVER-19703 & SERVER-23960). load('./jstests/multiVersion/libs/multi_rs.js'); load('./jstests/libs/test_background_ops.js'); @@ -14,7 +17,8 @@ var nodes = { n3: {binVersion: newVersion} }; -var rst = new ReplSetTest({name: name, nodes: nodes, nodeOptions: {storageEngine: 'mmapv1'}}); +var storageEngine = "mmapv1"; +var rst = new ReplSetTest({name: name, nodes: nodes, nodeOptions: {storageEngine: storageEngine}}); rst.startSet(); var replSetConfig = rst.getReplSetConfig(); replSetConfig.protocolVersion = 0; @@ -41,7 +45,7 @@ jsTest.log("Starting parallel operations during downgrade.."); var joinFindInsert = startParallelOps(primary, insertDocuments, [rst.getURL(), coll]); jsTest.log("Downgrading replica set.."); -rst.upgradeSet({binVersion: oldVersion}); +rst.upgradeSet({binVersion: oldVersion, storageEngine: storageEngine}); jsTest.log("Downgrade complete."); primary = rst.getPrimary(); diff --git a/jstests/multiVersion/dumprestore.js b/jstests/multiVersion/dumprestore.js index 8d692e4abb6..db82b7abaa6 100644 --- a/jstests/multiVersion/dumprestore.js +++ b/jstests/multiVersion/dumprestore.js @@ -18,6 +18,7 @@ var singleNodeTests = { 'dumpDir': [dumpDir], 'testDbpath': [testDbpath], 'dumpType': ["mongod"], - 'restoreType': ["mongod"] + 'restoreType': ["mongod"], + 'storageEngine': [jsTest.options().storageEngine || "wiredTiger"] }; runAllDumpRestoreTests(singleNodeTests); diff --git a/jstests/multiVersion/dumprestore_sharded.js b/jstests/multiVersion/dumprestore_sharded.js index 8f3c61d3f2d..6e5658e61fc 100644 --- a/jstests/multiVersion/dumprestore_sharded.js +++ b/jstests/multiVersion/dumprestore_sharded.js @@ -16,7 +16,8 @@ var shardedDumpTests = { 'dumpDir': [dumpDir], 'testDbpath': [testDbpath], 'dumpType': ["mongos"], - 'restoreType': ["mongod"] + 'restoreType': ["mongod"], + 'storageEngine': [jsTest.options().storageEngine || "wiredTiger"] }; runAllDumpRestoreTests(shardedDumpTests); @@ -29,6 +30,7 @@ var shardedRestoreTests = { 'dumpDir': [dumpDir], 'testDbpath': [testDbpath], 'dumpType': ["mongod"], - 'restoreType': ["mongos"] + 'restoreType': ["mongos"], + 'storageEngine': [jsTest.options().storageEngine || "wiredTiger"] }; runAllDumpRestoreTests(shardedRestoreTests); diff --git a/jstests/multiVersion/geo_2dsphere_v2_to_v3.js b/jstests/multiVersion/geo_2dsphere_v2_to_v3.js index c00612a492f..624ec1997db 100644 --- a/jstests/multiVersion/geo_2dsphere_v2_to_v3.js +++ b/jstests/multiVersion/geo_2dsphere_v2_to_v3.js @@ -1,5 +1,7 @@ // Tests upgrade/downgrade between 2dsphere index versions 2 and 3 +// @tags: [requires_mmapv1] + function generatePoint() { var longitude = Math.random() * 10 - 5; var latitude = Math.random() * 10 - 5; @@ -49,7 +51,9 @@ function get2dsphereIndexVersion(coll) { var nearQuery = {geometry: {$near: {$geometry: {type: "Point", coordinates: [0, 0]}}}}; -var mongod = MongoRunner.runMongod({binVersion: "3.0"}); +// SERVER-25129 - Only runs in mmapv1 +var storageEngine = "mmapv1"; +var mongod = MongoRunner.runMongod({binVersion: "3.0", storageEngine: storageEngine}); var coll = getCollection(mongod); var res = coll.insert(generatePoints(10)); res = coll.insert(generatePolygons(10)); @@ -60,7 +64,8 @@ assert.eq(res.itcount(), 20); // Version 2 index should still work fine in latest MongoRunner.stopMongod(mongod); -mongod = MongoRunner.runMongod({binVersion: "latest", restart: mongod}); +mongod = + MongoRunner.runMongod({binVersion: "latest", restart: mongod, storageEngine: storageEngine}); coll = getCollection(mongod); assert.eq(2, get2dsphereIndexVersion(coll)); res = coll.find(nearQuery); @@ -75,18 +80,20 @@ assert.eq(res.itcount(), 20); // downgrading shouldn't be able to startup because of assertion error MongoRunner.stopMongod(mongod); -var failed_mongod = MongoRunner.runMongod({binVersion: "3.0", restart: mongod}); +var failed_mongod = + MongoRunner.runMongod({binVersion: "3.0", restart: mongod, storageEngine: storageEngine}); assert.eq(failed_mongod, null); // upgrade, reindex, then downgrade to fix -mongod = MongoRunner.runMongod({binVersion: "latest", restart: mongod}); +mongod = + MongoRunner.runMongod({binVersion: "latest", restart: mongod, storageEngine: storageEngine}); coll = getCollection(mongod); assert.eq(3, get2dsphereIndexVersion(coll)); res = coll.dropIndex({geometry: "2dsphere"}); res = coll.createIndex({geometry: "2dsphere"}, {"2dsphereIndexVersion": 2}); assert.eq(2, get2dsphereIndexVersion(coll)); MongoRunner.stopMongod(mongod); -mongod = MongoRunner.runMongod({binVersion: "3.0", restart: mongod}); +mongod = MongoRunner.runMongod({binVersion: "3.0", restart: mongod, storageEngine: storageEngine}); assert.neq(mongod, null); coll = getCollection(mongod); assert.eq(2, get2dsphereIndexVersion(coll)); diff --git a/jstests/multiVersion/invalid_key_pattern_upgrade.js b/jstests/multiVersion/invalid_key_pattern_upgrade.js index a3098e34c0a..16fffdfb136 100644 --- a/jstests/multiVersion/invalid_key_pattern_upgrade.js +++ b/jstests/multiVersion/invalid_key_pattern_upgrade.js @@ -25,6 +25,7 @@ var defaultOptions = { dbpath: dbpath, noCleanData: true, + storageEngine: jsTest.options().storageEngine }; // Start the old version. diff --git a/jstests/multiVersion/libs/dumprestore_helpers.js b/jstests/multiVersion/libs/dumprestore_helpers.js index 4b2eda47b8a..3709a0414c2 100644 --- a/jstests/multiVersion/libs/dumprestore_helpers.js +++ b/jstests/multiVersion/libs/dumprestore_helpers.js @@ -14,7 +14,8 @@ load('./jstests/multiVersion/libs/verify_collection_data.js'); // 'dumpDir' : dumpDir, // 'testDbpath' : testDbpath, // 'dumpType' : "mongos", -// 'restoreType' : "mongod" // "mongos" also supported +// 'restoreType' : "mongod", // "mongos" also supported +// 'storageEngine': [ "mmapv1" ] // } // // The first four fields are which versions of the various binaries to use in the test. @@ -37,7 +38,8 @@ function multiVersionDumpRestoreTest(configObj) { 'dumpDir', 'testDbpath', 'dumpType', - 'restoreType' + 'restoreType', + 'storageEngine' ]; var i; @@ -53,7 +55,10 @@ function multiVersionDumpRestoreTest(configObj) { var shardingTestConfig = { name: testBaseName + "_sharded_source", mongos: [{binVersion: configObj.serverSourceVersion}], - shards: [{binVersion: configObj.serverSourceVersion}], + shards: [{ + binVersion: configObj.serverSourceVersion, + storageEngine: configObj.storageEngine + }], config: [{binVersion: configObj.serverSourceVersion}], // TODO: SERVER-24163 remove after v3.4 waitForCSRSSecondaries: false @@ -61,8 +66,11 @@ function multiVersionDumpRestoreTest(configObj) { var shardingTest = new ShardingTest(shardingTestConfig); var serverSource = shardingTest.s; } else { - var serverSource = MongoRunner.runMongod( - {binVersion: configObj.serverSourceVersion, dbpath: configObj.testDbpath}); + var serverSource = MongoRunner.runMongod({ + binVersion: configObj.serverSourceVersion, + dbpath: configObj.testDbpath, + storageEngine: configObj.storageEngine + }); } var sourceDB = serverSource.getDB(testBaseName); @@ -102,7 +110,8 @@ function multiVersionDumpRestoreTest(configObj) { // Restore using the specified version of mongorestore if (configObj.restoreType === "mongod") { - var serverDest = MongoRunner.runMongod({binVersion: configObj.serverDestVersion}); + var serverDest = MongoRunner.runMongod( + {binVersion: configObj.serverDestVersion, storageEngine: configObj.storageEngine}); MongoRunner.runMongoTool("mongorestore", { dir: configObj.dumpDir + "/" + testBaseName, @@ -114,7 +123,8 @@ function multiVersionDumpRestoreTest(configObj) { var shardingTestConfig = { name: testBaseName + "_sharded_dest", mongos: [{binVersion: configObj.serverDestVersion}], - shards: [{binVersion: configObj.serverDestVersion}], + shards: + [{binVersion: configObj.serverDestVersion, storageEngine: configObj.storageEngine}], config: [{binVersion: configObj.serverDestVersion}], // TODO: SERVER-24163 remove after v3.4 waitForCSRSSecondaries: false @@ -234,7 +244,8 @@ function getPermutationIterator(permsObj) { // 'dumpDir' : [ dumpDir ], // 'testDbpath' : [ testDbpath ], // 'dumpType' : [ "mongod", "mongos" ], -// 'restoreType' : [ "mongod", "mongos" ] +// 'restoreType' : [ "mongod", "mongos" ], +// 'storageEngine': [ "mmapv1" ] // } // // This function will run a test for each possible combination of the parameters. See comments on diff --git a/jstests/multiVersion/libs/multi_cluster.js b/jstests/multiVersion/libs/multi_cluster.js index 5d98f942546..2937d0d4d6d 100644 --- a/jstests/multiVersion/libs/multi_cluster.js +++ b/jstests/multiVersion/libs/multi_cluster.js @@ -3,8 +3,8 @@ // /** - * Restarts the specified binaries in options to the binVersion. Note: this does not - * perform any upgrade operations. + * Restarts the specified binaries in options with the specified binVersion. + * Note: this does not perform any upgrade operations. * * @param binVersion {string} * @param options {Object} format: diff --git a/jstests/multiVersion/minor_version_downgrade_replset.js b/jstests/multiVersion/minor_version_downgrade_replset.js index e0cc1fe5812..3c67a237075 100644 --- a/jstests/multiVersion/minor_version_downgrade_replset.js +++ b/jstests/multiVersion/minor_version_downgrade_replset.js @@ -1,5 +1,6 @@ // Test the downgrade of a replica set from latest version // to last-stable version succeeds, while reads and writes continue. +// @tags: [requires_mmapv1] load('./jstests/multiVersion/libs/multi_rs.js'); load('./jstests/libs/test_background_ops.js'); @@ -15,7 +16,9 @@ var nodes = { n3: {binVersion: newVersion} }; -var rst = new ReplSetTest({name: name, nodes: nodes, nodeOptions: {storageEngine: 'mmapv1'}}); +// SERVER-25132 - Only runs in mmapv1 +var storageEngine = "mmapv1"; +var rst = new ReplSetTest({name: name, nodes: nodes, nodeOptions: {storageEngine: storageEngine}}); rst.startSet(); var replSetConfig = rst.getReplSetConfig(); replSetConfig.protocolVersion = 0; @@ -42,7 +45,7 @@ jsTest.log("Starting parallel operations during downgrade.."); var joinFindInsert = startParallelOps(primary, insertDocuments, [rst.getURL(), coll]); jsTest.log("Downgrading replica set.."); -rst.upgradeSet({binVersion: oldVersion}); +rst.upgradeSet({binVersion: oldVersion, storageEngine: storageEngine}); jsTest.log("Downgrade complete."); primary = rst.getPrimary(); diff --git a/jstests/multiVersion/mmapv1_overrides_default_storage_engine.js b/jstests/multiVersion/mmapv1_overrides_default_storage_engine.js index 7e6d61e9f1d..371e2c552ab 100644 --- a/jstests/multiVersion/mmapv1_overrides_default_storage_engine.js +++ b/jstests/multiVersion/mmapv1_overrides_default_storage_engine.js @@ -1,6 +1,8 @@ /** * Test the upgrade process for 2.6 ~~> 3.2 and 3.0 ~~> 3.2, where mmapv1 should continue to be the * default storage engine. Repeat the process with --directoryperdb set. + * + * @tags: [requires_mmapv1] */ (function() { 'use strict'; @@ -22,6 +24,11 @@ }, ]; + // Since this test requires not specifying the storageEngine, delete it before invoking test. + if (typeof TestData === "object" && TestData !== null) { + delete TestData.storageEngine; + } + // The mongod should start up with mmapv1 when the --storageEngine flag is omitted, or when // --storageEngine=mmapv1 is explicitly specified. testCases.forEach(function(testCase) { diff --git a/jstests/multiVersion/multikey_paths_downgrade.js b/jstests/multiVersion/multikey_paths_downgrade.js index ec15f5c9222..bcc8ba15009 100644 --- a/jstests/multiVersion/multikey_paths_downgrade.js +++ b/jstests/multiVersion/multikey_paths_downgrade.js @@ -30,7 +30,7 @@ noCleanData: true, // We explicitly set the storage engine as part of the options because not all versions // being tested automatically detect it from the storage.bson file. - storageEngine: jsTest.options().storageEngine || "wiredTiger", + storageEngine: jsTest.options().storageEngine, }; if (defaultOptions.storageEngine === "mmapv1") { diff --git a/jstests/multiVersion/partial_index_upgrade.js b/jstests/multiVersion/partial_index_upgrade.js index b19631ae3b3..81a45779953 100644 --- a/jstests/multiVersion/partial_index_upgrade.js +++ b/jstests/multiVersion/partial_index_upgrade.js @@ -31,6 +31,7 @@ var defaultOptions = { dbpath: dbpath, noCleanData: true, + storageEngine: jsTest.options().storageEngine }; // Start the old version. diff --git a/jstests/multiVersion/readmode_compatibility.js b/jstests/multiVersion/readmode_compatibility.js index ae6f9c7d56d..2e2ca2774cb 100644 --- a/jstests/multiVersion/readmode_compatibility.js +++ b/jstests/multiVersion/readmode_compatibility.js @@ -4,7 +4,9 @@ (function() { 'use strict'; - var conn30 = MongoRunner.runMongod({binVersion: '3.0'}); + var storageEngine = jsTest.options().storageEngine; + + var conn30 = MongoRunner.runMongod({binVersion: '3.0', storageEngine: storageEngine}); assert.neq(conn30, null, 'unable to start 3.0 mongod'); // Force writeMode to "commands" so that we can check the results of write operations. @@ -32,7 +34,7 @@ // With the latest version of mongod, forcing the readMode to "compatibility" and then asking // for the readMode should cause the shell to resolve the readMode to "commands". - var connLatest = MongoRunner.runMongod({}); + var connLatest = MongoRunner.runMongod({storageEngine: storageEngine}); assert.neq(connLatest, null, 'unable to start 3.2 mongod'); connLatest.forceReadMode('compatibility'); assert.eq('commands', connLatest.readMode()); diff --git a/jstests/multiVersion/server-23299-2.js b/jstests/multiVersion/server-23299-2.js index 0c54b8cdc97..ea6ae368996 100644 --- a/jstests/multiVersion/server-23299-2.js +++ b/jstests/multiVersion/server-23299-2.js @@ -15,9 +15,11 @@ load('./jstests/multiVersion/libs/verify_versions.js'); var versionsNotSubjectToSERVER23299 = ['latest', '3.0']; function doTest(priorVersion, expectTempToDrop) { + var storageEngine = jsTest.options().storageEngine; jsTest.log((expectTempToDrop ? "" : " not") + " expecting temp collections created in " + priorVersion + " to be dropped when starting latest mongod version"); - var mongod = MongoRunner.runMongod({binVersion: priorVersion}); + var mongod = + MongoRunner.runMongod({binVersion: priorVersion, storageEngine: storageEngine}); assert.binVersion(mongod, priorVersion); assert.commandWorked(mongod.getDB("test").createCollection("tempcoll", {temp: true})); assert.writeOK(mongod.getDB("test").tempcoll.insert({_id: 0})); @@ -25,8 +27,9 @@ load('./jstests/multiVersion/libs/verify_versions.js'); MongoRunner.stopMongod(mongod); var newOpts = Object.extend({}, mongod.fullOptions); - mongod = MongoRunner.runMongod(Object.extend(Object.extend({}, mongod.fullOptions), - {restart: true, binVersion: "latest"})); + mongod = MongoRunner.runMongod( + Object.extend(Object.extend({}, mongod.fullOptions), + {restart: true, binVersion: "latest", storageEngine: storageEngine})); assert.binVersion(mongod, "latest"); assert.eq(expectTempToDrop ? 0 : 1, mongod.getDB("test").tempcoll.find().itcount()); } diff --git a/jstests/multiVersion/wt_index_option_defaults_replset.js b/jstests/multiVersion/wt_index_option_defaults_replset.js index af17bd182b8..c3bc4a535fc 100644 --- a/jstests/multiVersion/wt_index_option_defaults_replset.js +++ b/jstests/multiVersion/wt_index_option_defaults_replset.js @@ -2,6 +2,8 @@ * Creates a replica set with a 3.2 primary and a 3.0 secondary. Tests that the * "indexOptionDefaults" specified to collection creation are replicated by the 3.2 primary, but * ignored by the 3.0 secondary. + * + * @tags: [requires_wiredtiger] */ (function() { 'use strict'; diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js index 4e3a12a1fa4..0ef0410890b 100644 --- a/src/mongo/shell/servers.js +++ b/src/mongo/shell/servers.js @@ -906,9 +906,11 @@ var MongoRunner, _startMongod, startMongoProgram, runMongoProgram, startMongoPro * Returns a new argArray with any test-specific arguments added. */ function appendSetParameterArgs(argArray) { + // programName includes the version, e.g., mongod-3.2. + // baseProgramName is the program name without any version information, e.g., mongod. var programName = argArray[0]; - if (programName.endsWith('mongod') || programName.endsWith('mongos') || - programName.startsWith('mongod-') || programName.startsWith('mongos-')) { + var [baseProgramName, programVersion] = programName.split("-"); + if (baseProgramName === 'mongod' || baseProgramName === 'mongos') { if (jsTest.options().enableTestCommands) { argArray.push(...['--setParameter', "enableTestCommands=1"]); } @@ -931,7 +933,8 @@ var MongoRunner, _startMongod, startMongoProgram, runMongoProgram, startMongoPro argArray.push(...['--setParameter', "enableLocalhostAuthBypass=false"]); } - // mongos only options. Note: excludes mongos with version suffix (ie. mongos-3.0). + // Since options may not be backward compatible, mongos options are not + // set on older versions, e.g., mongos-3.0. if (programName.endsWith('mongos')) { // apply setParameters for mongos if (jsTest.options().setParametersMongos) { @@ -943,45 +946,50 @@ var MongoRunner, _startMongod, startMongoProgram, runMongoProgram, startMongoPro }); } } - } - // mongod only options. Note: excludes mongos with version suffix (ie. mongos-3.0). - else if (programName.endsWith('mongod')) { - // set storageEngine for mongod - if (jsTest.options().storageEngine) { + } else if (baseProgramName === 'mongod') { + // Set storageEngine for mongod. There was no storageEngine parameter before 3.0. + if (jsTest.options().storageEngine && + (!programVersion || parseInt(programVersion.split(".")[0]) >= 3)) { if (argArray.indexOf("--storageEngine") < 0) { argArray.push(...['--storageEngine', jsTest.options().storageEngine]); } } - if (jsTest.options().storageEngineCacheSizeGB) { - if (jsTest.options().storageEngine === "rocksdb") { - argArray.push( - ...['--rocksdbCacheSizeGB', jsTest.options().storageEngineCacheSizeGB]); - } else if (jsTest.options().storageEngine === "wiredTiger" || - !jsTest.options().storageEngine) { - argArray.push(...['--wiredTigerCacheSizeGB', - jsTest.options().storageEngineCacheSizeGB]); + // Since options may not be backward compatible, mongod options are not + // set on older versions, e.g., mongod-3.0. + if (programName.endsWith('mongod')) { + if (jsTest.options().storageEngine === "wiredTiger" || + !jsTest.options().storageEngine) { + if (jsTest.options().storageEngineCacheSizeGB) { + argArray.push(...['--wiredTigerCacheSizeGB', + jsTest.options().storageEngineCacheSizeGB]); + } + if (jsTest.options().wiredTigerEngineConfigString) { + argArray.push(...['--wiredTigerEngineConfigString', + jsTest.options().wiredTigerEngineConfigString]); + } + if (jsTest.options().wiredTigerCollectionConfigString) { + argArray.push(...['--wiredTigerCollectionConfigString', + jsTest.options().wiredTigerCollectionConfigString]); + } + if (jsTest.options().wiredTigerIndexConfigString) { + argArray.push(...['--wiredTigerIndexConfigString', + jsTest.options().wiredTigerIndexConfigString]); + } + } else if (jsTest.options().storageEngine === "rocksdb") { + if (jsTest.options().storageEngineCacheSizeGB) { + argArray.push(...['--rocksdbCacheSizeGB', + jsTest.options().storageEngineCacheSizeGB]); + } } - } - if (jsTest.options().wiredTigerEngineConfigString) { - argArray.push(...['--wiredTigerEngineConfigString', - jsTest.options().wiredTigerEngineConfigString]); - } - if (jsTest.options().wiredTigerCollectionConfigString) { - argArray.push(...['--wiredTigerCollectionConfigString', - jsTest.options().wiredTigerCollectionConfigString]); - } - if (jsTest.options().wiredTigerIndexConfigString) { - argArray.push(...['--wiredTigerIndexConfigString', - jsTest.options().wiredTigerIndexConfigString]); - } - // apply setParameters for mongod - if (jsTest.options().setParameters) { - var params = jsTest.options().setParameters.split(","); - if (params && params.length > 0) { - params.forEach(function(p) { - if (p) - argArray.push(...['--setParameter', p]); - }); + // apply setParameters for mongod + if (jsTest.options().setParameters) { + var params = jsTest.options().setParameters.split(","); + if (params && params.length > 0) { + params.forEach(function(p) { + if (p) + argArray.push(...['--setParameter', p]); + }); + } } } }