From 0e374292088c87a86fee802160ca2467b81d4620 Mon Sep 17 00:00:00 2001 From: Kyle Suarez Date: Tue, 24 Apr 2018 09:29:27 -0400 Subject: SERVER-34622 use existing options in _unbridgedNodes if bridge is enabled Otherwise, restarting a node will not use the correct options for when the node was originally brought up. --- jstests/noPassthrough/restart_node_with_bridge.js | 23 +++++++++++++++++++++++ src/mongo/shell/replsettest.js | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 jstests/noPassthrough/restart_node_with_bridge.js diff --git a/jstests/noPassthrough/restart_node_with_bridge.js b/jstests/noPassthrough/restart_node_with_bridge.js new file mode 100644 index 00000000000..7ac33335df6 --- /dev/null +++ b/jstests/noPassthrough/restart_node_with_bridge.js @@ -0,0 +1,23 @@ +/** + * Tests that a node can be successfully restarted when the bridge is enabled. + * @tags: [requires_persistence] + */ +(function() { + "use strict"; + + const name = "restart_node_with_bridge"; + const rst = new ReplSetTest({name: name, nodes: 1, useBridge: true}); + rst.startSet(); + rst.initiate(); + rst.awaitNodesAgreeOnPrimary(); + + let primary = rst.getPrimary(); + assert.commandWorked(primary.getDB("test").getCollection(name).insert({_id: 1})); + + rst.restart(primary); + rst.awaitNodesAgreeOnPrimary(); + primary = rst.getPrimary(); + assert.eq(primary.getDB("test").getCollection(name).count({_id: 1}), 1); + + rst.stopSet(); +}()); diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js index 499715ab18e..c6f56a9fbeb 100644 --- a/src/mongo/shell/replsettest.js +++ b/src/mongo/shell/replsettest.js @@ -1984,7 +1984,9 @@ var ReplSetTest = function(opts) { // If restarting a node, use its existing options as the defaults. if ((options && options.restart) || restart) { - options = Object.merge(this.nodes[n].fullOptions, options); + const existingOpts = + _useBridge ? _unbridgedNodes[n].fullOptions : this.nodes[n].fullOptions; + options = Object.merge(existingOpts, options); } else { options = Object.merge(defaults, options); } -- cgit v1.2.1