diff options
author | Benety Goh <benety@mongodb.com> | 2017-01-25 12:54:02 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2017-01-25 15:58:11 -0500 |
commit | c0522d40f86208db8b88b8bbc82cb56c64e34fa6 (patch) | |
tree | 60169156a00e94496f93c51a7cf6cedd674437a9 | |
parent | c0d71a51942aa9bf57a88f3d79ef72c720f87ebe (diff) | |
download | mongo-c0522d40f86208db8b88b8bbc82cb56c64e34fa6.tar.gz |
SERVER-26918 backup_restore.js - nodes should agree on primary before starting FSM clients. some cleanup.
-rw-r--r-- | jstests/noPassthrough/backup_restore_fsync_lock.js | 9 | ||||
-rw-r--r-- | jstests/noPassthrough/backup_restore_rolling.js | 7 | ||||
-rw-r--r-- | jstests/noPassthrough/backup_restore_stop_start.js | 10 | ||||
-rw-r--r-- | jstests/noPassthrough/libs/backup_restore.js | 31 |
4 files changed, 15 insertions, 42 deletions
diff --git a/jstests/noPassthrough/backup_restore_fsync_lock.js b/jstests/noPassthrough/backup_restore_fsync_lock.js index 0e472f6ffeb..a4e9cc6d6c8 100644 --- a/jstests/noPassthrough/backup_restore_fsync_lock.js +++ b/jstests/noPassthrough/backup_restore_fsync_lock.js @@ -19,14 +19,7 @@ load("jstests/noPassthrough/libs/backup_restore.js"); (function() { "use strict"; - // Grab the storage engine, default is wiredTiger - var storageEngine = jsTest.options().storageEngine || "wiredTiger"; - // Run the fsyncLock test. Will return before testing for any engine that doesn't // support fsyncLock - new BackupRestoreTest({ - name: storageEngine + ' fsyncLock/fsyncUnlock', - storageEngine: storageEngine, - backup: 'fsyncLock' - }).run(); + new BackupRestoreTest({backup: 'fsyncLock'}).run(); }()); diff --git a/jstests/noPassthrough/backup_restore_rolling.js b/jstests/noPassthrough/backup_restore_rolling.js index bc11be6ce5e..e2d0931e155 100644 --- a/jstests/noPassthrough/backup_restore_rolling.js +++ b/jstests/noPassthrough/backup_restore_rolling.js @@ -30,12 +30,7 @@ load("jstests/noPassthrough/libs/backup_restore.js"); // if rsync is not available on the host, then this test is skipped if (!runProgram('bash', '-c', 'which rsync')) { - new BackupRestoreTest({ - name: storageEngine + ' rolling', - storageEngine: storageEngine, - backup: 'rolling', - clientTime: 30000 - }).run(); + new BackupRestoreTest({backup: 'rolling', clientTime: 30000}).run(); } else { jsTestLog("Skipping test for " + storageEngine + ' rolling'); } diff --git a/jstests/noPassthrough/backup_restore_stop_start.js b/jstests/noPassthrough/backup_restore_stop_start.js index 4a9fa1992d6..36e730c0ee0 100644 --- a/jstests/noPassthrough/backup_restore_stop_start.js +++ b/jstests/noPassthrough/backup_restore_stop_start.js @@ -19,13 +19,5 @@ load("jstests/noPassthrough/libs/backup_restore.js"); (function() { "use strict"; - // Grab the storage engine, default is wiredTiger - var storageEngine = jsTest.options().storageEngine || "wiredTiger"; - - new BackupRestoreTest({ - name: storageEngine + ' stop/start', - storageEngine: storageEngine, - backup: 'stopStart', - clientTime: 30000 - }).run(); + new BackupRestoreTest({backup: 'stopStart', clientTime: 30000}).run(); }()); diff --git a/jstests/noPassthrough/libs/backup_restore.js b/jstests/noPassthrough/libs/backup_restore.js index 73ee3e64cc4..e94ee25a4ae 100644 --- a/jstests/noPassthrough/libs/backup_restore.js +++ b/jstests/noPassthrough/libs/backup_restore.js @@ -11,8 +11,6 @@ * * @param {Object} options An object with the following fields: * { - * name {string}: name of this backup/restore test. Required. - * storageEngine {string}: name of storage engine. Required. * backup {string}: backup method. Must be one of: fsyncLock, rolling, stopStart. Required. * nodes {number}: number of nodes in replica set initially (excluding hidden secondary node to * be added during test). Default: 3. @@ -128,11 +126,7 @@ var BackupRestoreTest = function(options) { // Test options // Test name - assert(options.name, 'Test name option not supplied'); - var testName = options.name; - - // Storage engine being tested - var storageEngine = options.storageEngine; + var testName = jsTest.name(); // Backup type (must be specified) var allowedBackupKeys = ['fsyncLock', 'stopStart', 'rolling']; @@ -154,17 +148,17 @@ var BackupRestoreTest = function(options) { var dbpathFormat = dbpathPrefix + '/mongod-$port'; // Start numNodes node replSet - var replSetName = 'backupRestore'; var rst = new ReplSetTest({ - name: replSetName, nodes: numNodes, - nodeOptions: {oplogSize: 1024, storageEngine: storageEngine, dbpath: dbpathFormat} + nodeOptions: {dbpath: dbpathFormat}, + oplogSize: 1024, }); var nodes = rst.startSet(); - // Wait up to 5 minutes for the replica set to initiate. We allow extra time because - // allocating 1GB oplogs on test hosts can be slow with mmapv1. - rst.initiate(null, null, 5 * 60 * 1000); + // Initialize replica set using default timeout. This should give us sufficient time to + // allocate 1GB oplogs on slow test hosts with mmapv1. + rst.initiate(); + rst.awaitNodesAgreeOnPrimary(); var primary = rst.getPrimary(); var secondary = rst.getSecondary(); @@ -185,8 +179,7 @@ var BackupRestoreTest = function(options) { if (!ret.ok) { assert.commandFailedWithCode(ret, ErrorCodes.CommandNotSupported); - jsTestLog("Skipping test of " + options.backup + " for " + storageEngine + - ' as it does not support fsync'); + jsTestLog('Skipping test of ' + options.backup + ' as it does not support fsync.'); return; } @@ -213,8 +206,7 @@ var BackupRestoreTest = function(options) { var ret = secondary.getDB("admin").fsyncLock(); if (!ret.ok) { assert.commandFailedWithCode(ret, ErrorCodes.CommandNotSupported); - jsTestLog("Skipping test of " + options.backup + " for " + storageEngine + - ' as it does not support fsync'); + jsTestLog('Skipping test of ' + options.backup + ' as it does not support fsync.'); return; } @@ -262,9 +254,10 @@ var BackupRestoreTest = function(options) { // Add new hidden node to replSetTest jsTestLog('Starting new hidden node (but do not add to replica set) with dbpath ' + hiddenDbpath + '.'); - var hiddenCfg = - {noCleanData: true, oplogSize: 1024, dbpath: hiddenDbpath, replSet: replSetName}; var nodesBeforeAddingHiddenMember = rst.nodes.slice(); + // ReplSetTest.add() will use default values for --oplogSize and --replSet consistent with + // existing nodes. + var hiddenCfg = {noCleanData: true, dbpath: hiddenDbpath}; var hiddenNode = rst.add(hiddenCfg); var hiddenHost = hiddenNode.host; |