diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2015-05-22 09:04:55 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2015-05-22 09:04:55 -0400 |
commit | 841c50f3e7a8da9831a5e8c7c9ad9a22b12a17de (patch) | |
tree | 65e57c14746cf79d0421507a0c51d6af45e24e65 /jstests/multiVersion | |
parent | 38862aaa17e06e5e6733598bbb487774cb3616f7 (diff) | |
download | mongo-841c50f3e7a8da9831a5e8c7c9ad9a22b12a17de.tar.gz |
Revert "SERVER-17861 Change the default storage engine to wiredTiger."
This reverts commit 38862aaa17e06e5e6733598bbb487774cb3616f7.
Diffstat (limited to 'jstests/multiVersion')
-rw-r--r-- | jstests/multiVersion/downgrade_replset.js | 2 | ||||
-rw-r--r-- | jstests/multiVersion/libs/verify_collection_data.js | 78 | ||||
-rw-r--r-- | jstests/multiVersion/mmapv1_overrides_default_storage_engine.js | 96 |
3 files changed, 58 insertions, 118 deletions
diff --git a/jstests/multiVersion/downgrade_replset.js b/jstests/multiVersion/downgrade_replset.js index 17581827f11..c3d8460eb0c 100644 --- a/jstests/multiVersion/downgrade_replset.js +++ b/jstests/multiVersion/downgrade_replset.js @@ -12,7 +12,7 @@ var nodes = {n1: {binVersion: newVersion}, n2: {binVersion: newVersion}, n3: {binVersion: newVersion}}; -var rst = new ReplSetTest({name: name, nodes: nodes, nodeOptions: {storageEngine: 'mmapv1'}}); +var rst = new ReplSetTest({name: name, nodes: 3}); rst.startSet(); rst.initiate(); diff --git a/jstests/multiVersion/libs/verify_collection_data.js b/jstests/multiVersion/libs/verify_collection_data.js index 72c3e01dac7..9e8423c1db2 100644 --- a/jstests/multiVersion/libs/verify_collection_data.js +++ b/jstests/multiVersion/libs/verify_collection_data.js @@ -68,47 +68,83 @@ createCollectionWithData = function (db, collectionName, dataGenerator) { // the saved state function CollectionDataValidator() { - var _initialized = false; - var _collectionInfo = {}; - var _indexData = []; - var _collectionData = []; - - // Returns the options of the specified collection. - this.getCollectionInfo = function(collection) { - var infoObj = collection.getDB().getCollectionInfos({name: collection.getName()}); - assert.eq(1, infoObj.length, "expected collection '" + collection.getName() + "'to exist"); - return infoObj[0]; - }; + var initialized = false; + var collectionStats = {}; + var indexData = []; + var collectionData = []; // Saves the current state of the collection passed in this.recordCollectionData = function (collection) { - // Save the metadata for this collection for later comparison. - _collectionInfo = this.getCollectionInfo(collection); // Save the indexes for this collection for later comparison - _indexData = collection.getIndexes().sort(function(a,b) { + indexData = collection.getIndexes().sort(function(a,b) { if (a.name > b.name) return 1; else return -1; }); // Save the data for this collection for later comparison - _collectionData = collection.find().sort({"_id":1}).toArray(); + collectionData = collection.find().sort({"_id":1}).toArray(); + + // Save the metadata for this collection for later comparison. + // NOTE: We do this last since the data and indexes affect this output + collectionStats = collection.stats(); + + // XXX: in 2.4 avgObjSize was a double, but in 2.6 it is an int + collectionStats['avgObjSize'] = Math.floor(collectionStats['avgObjSize']); - _initialized = true; + // Delete keys that appear just because we shard + delete collectionStats["primary"]; + delete collectionStats["sharded"]; + + initialized = true; return collection; } this.validateCollectionData = function (collection) { - if (!_initialized) { + if (!initialized) { throw Error("validateCollectionWithAllData called, but data is not initialized"); } // Get the metadata for this collection - var newCollectionInfo = this.getCollectionInfo(collection); + var newCollectionStats = collection.stats(); + + // XXX: in 2.4 avgObjSize was a double, but in 2.6 it is an int + newCollectionStats['avgObjSize'] = Math.floor(newCollectionStats['avgObjSize']); + + // as of 2.7.1, we no longer use systemFlags + delete collectionStats.systemFlags; + delete newCollectionStats.systemFlags; + + // as of 2.7.7, we no longer use paddingFactor and introduced paddingFactorNote + delete collectionStats.paddingFactor; + delete collectionStats.paddingFactorNote; + delete newCollectionStats.paddingFactor; + delete newCollectionStats.paddingFactorNote; + + // Delete keys that appear just because we shard + delete newCollectionStats["primary"]; + delete newCollectionStats["sharded"]; + + // as of 2.7.8, we added maxSize + // TODO: when 2.6 is no longer tested, remove following two lines + delete newCollectionStats["maxSize"]; + delete collectionStats["maxSize"]; + + // Delete key added in 2.8-rc3 + delete collectionStats["indexDetails"]; + delete newCollectionStats["indexDetails"]; + + // Delete capped:false added in 2.8.0-rc5 + if (newCollectionStats["capped"] == false) { + delete newCollectionStats["capped"]; + } + if (collectionStats["capped"] == false) { + delete collectionStats["capped"]; + } - assert.docEq(_collectionInfo, newCollectionInfo, "collection metadata not equal"); + assert.docEq(collectionStats, newCollectionStats, "collection metadata not equal"); // Get the indexes for this collection var newIndexData = collection.getIndexes().sort(function(a,b) { @@ -116,13 +152,13 @@ function CollectionDataValidator() { else return -1; }); for (var i = 0; i < newIndexData.length; i++) { - assert.docEq(_indexData[i], newIndexData[i], "indexes not equal"); + assert.docEq(indexData[i], newIndexData[i], "indexes not equal"); } // Save the data for this collection for later comparison var newCollectionData = collection.find().sort({"_id":1}).toArray(); for (var i = 0; i < newCollectionData.length; i++) { - assert.docEq(_collectionData[i], newCollectionData[i], "data not equal"); + assert.docEq(collectionData[i], newCollectionData[i], "data not equal"); } return true; } diff --git a/jstests/multiVersion/mmapv1_overrides_default_storage_engine.js b/jstests/multiVersion/mmapv1_overrides_default_storage_engine.js deleted file mode 100644 index 9cad40c23bd..00000000000 --- a/jstests/multiVersion/mmapv1_overrides_default_storage_engine.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * 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. - */ -(function() { - 'use strict'; - - var testCases = [ - { - binVersion: '2.6', - }, - { - binVersion: '2.6', - directoryperdb: '', - }, - { - binVersion: '3.0', - }, - { - binVersion: '3.0', - directoryperdb: '', - }, - ]; - - // The mongod should start up with mmapv1 when the --storageEngine flag is omitted, or when - // --storageEngine=mmapv1 is explicitly specified. - testCases.forEach(function(testCase) { - [null, 'mmapv1'].forEach(function(storageEngine) { - jsTest.log('Upgrading from a ' + testCase.binVersion + ' instance with options=' - + tojson(testCase) + ' to the latest version. This should succeed when the' - + ' latest version ' - + (storageEngine ? ('explicitly specifies --storageEngine=' + storageEngine) - : 'omits the --storageEngine flag')); - - var dbpath = MongoRunner.dataPath + 'mmapv1_overrides_default_storage_engine'; - resetDbpath(dbpath); - - var defaultOptions = { - dbpath: dbpath, - noCleanData: true, - }; - - // Start the old version. - var mongodOptions = Object.merge(defaultOptions, testCase); - var conn = MongoRunner.runMongod(mongodOptions); - assert.neq(null, conn, - 'mongod was unable to start up with options ' + tojson(mongodOptions)); - assert.commandWorked(conn.getDB('test').runCommand({ping: 1})); - MongoRunner.stopMongod(conn); - - // Start the newest version. - mongodOptions = Object.extend({}, defaultOptions); - if (storageEngine) { - mongodOptions.storageEngine = storageEngine; - } - if (testCase.hasOwnProperty('directoryperdb')) { - mongodOptions.directoryperdb = testCase.directoryperdb; - } - conn = MongoRunner.runMongod(mongodOptions); - assert.neq(null, conn, - 'mongod was unable to start up with options ' + tojson(mongodOptions)); - assert.commandWorked(conn.getDB('test').runCommand({ping: 1})); - MongoRunner.stopMongod(conn); - }); - }); - - // The mongod should not start up when --storageEngine=wiredTiger is specified. - testCases.forEach(function(testCase) { - jsTest.log('Upgrading from a ' + testCase.binVersion + ' instance with options=' - + tojson(testCase) + ' to the latest version. This should fail when the latest' - + ' version specifies --storageEngine=wiredTiger'); - - var dbpath = MongoRunner.dataPath + 'mmapv1_overrides_default_storage_engine'; - resetDbpath(dbpath); - - var defaultOptions = { - dbpath: dbpath, - noCleanData: true, - }; - - // Start the old version. - var mongodOptions = Object.merge(defaultOptions, testCase); - var conn = MongoRunner.runMongod(mongodOptions); - assert.neq(null, conn, - 'mongod was unable to start up with options ' + tojson(mongodOptions)); - assert.commandWorked(conn.getDB('test').runCommand({ping: 1})); - MongoRunner.stopMongod(conn); - - // Start the newest version. - mongodOptions = Object.extend({storageEngine: 'wiredTiger'}, defaultOptions); - conn = MongoRunner.runMongod(mongodOptions); - assert.eq(null, conn, - 'mongod should not have been able to start up with options ' - + tojson(mongodOptions)); - }); -}()); |