summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-07-18 15:28:17 -0400
committerJudah Schvimer <judah@mongodb.com>2017-07-18 15:28:17 -0400
commitb6a4241890c6adfa72302e7806d28bd1e803c358 (patch)
treed26e41d46ad7ca3c4da7f1037a65f90092e9ee63
parent060473c2794e1d86dc4e4988c031b9c7ebda8297 (diff)
downloadmongo-b6a4241890c6adfa72302e7806d28bd1e803c358.tar.gz
SERVER-29297 stepUp should wait for durability in awaitReplication
-rw-r--r--jstests/noPassthrough/wt_nojournal_repl.js3
-rw-r--r--src/mongo/shell/replsettest.js21
2 files changed, 19 insertions, 5 deletions
diff --git a/jstests/noPassthrough/wt_nojournal_repl.js b/jstests/noPassthrough/wt_nojournal_repl.js
index ebea3f1b5ab..45e94c4bbbd 100644
--- a/jstests/noPassthrough/wt_nojournal_repl.js
+++ b/jstests/noPassthrough/wt_nojournal_repl.js
@@ -35,11 +35,10 @@ if (jsTest.options().storageEngine && jsTest.options().storageEngine !== "wiredT
nodes: 3,
oplogSize: 2,
nodeOptions: {
- nojournal: "",
storageEngine: "wiredTiger",
}
});
- var nodes = replTest.startSet();
+ var nodes = replTest.startSet({nojournal: ""});
// make sure node 0 becomes primary initially
var config = replTest.getReplSetConfig();
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js
index 2d4334c3a8a..0e05a1bfa4a 100644
--- a/src/mongo/shell/replsettest.js
+++ b/src/mongo/shell/replsettest.js
@@ -148,7 +148,8 @@ var ReplSetTest = function(opts) {
* Returns 'true' if the test has been configured to run without journaling enabled.
*/
function _isRunningWithoutJournaling() {
- return jsTestOptions().noJournal || jsTestOptions().storageEngine == 'inMemory' ||
+ return self.nojournal || jsTestOptions().noJournal ||
+ jsTestOptions().storageEngine == 'inMemory' ||
jsTestOptions().storageEngine == 'ephemeralForTest';
}
@@ -326,6 +327,12 @@ var ReplSetTest = function(opts) {
var replSetStatus =
assert.commandWorked(conn.getDB("admin").runCommand({replSetGetStatus: 1}));
+ // Older servers in multiversion suites do not return an 'optimes' array, so we use
+ // the only OpTime they provide.
+ if (!replSetStatus.optimes) {
+ return _getLastOpTime(conn);
+ }
+
var opTimeType = "durableOpTime";
if (_isRunningWithoutJournaling()) {
opTimeType = "appliedOpTime";
@@ -469,6 +476,9 @@ var ReplSetTest = function(opts) {
if (options && options.keyFile) {
self.keyFile = options.keyFile;
}
+ if (options && options.nojournal != undefined) {
+ self.nojournal = true;
+ }
var nodes = [];
for (var n = 0; n < this.ports.length; n++) {
@@ -822,7 +832,12 @@ var ReplSetTest = function(opts) {
* Calls awaitReplication() which requires all connections in 'nodes' to be authenticated.
*/
this.stepUp = function(node) {
- this.awaitReplication();
+ var secondaryOpTimeType = ReplSetTest.OpTimeType.LAST_DURABLE;
+ if (_isRunningWithoutJournaling()) {
+ secondaryOpTimeType = ReplSetTest.OpTimeType.LAST_APPLIED;
+ }
+
+ this.awaitReplication(ReplSetTest.kDefaultTimeoutMS, secondaryOpTimeType);
this.awaitNodesAgreeOnPrimary();
if (this.getPrimary() === node) {
return;
@@ -843,7 +858,7 @@ var ReplSetTest = function(opts) {
print("Caught exception while stepping down node '" + tojson(node.host) +
"': " + tojson(ex));
}
- this.awaitReplication();
+ this.awaitReplication(ReplSetTest.kDefaultTimeoutMS, secondaryOpTimeType);
this.awaitNodesAgreeOnPrimary();
}