diff options
author | Kyle Suarez <kyle.suarez@mongodb.com> | 2018-04-24 09:29:27 -0400 |
---|---|---|
committer | Kyle Suarez <kyle.suarez@mongodb.com> | 2018-04-24 09:29:27 -0400 |
commit | 0e374292088c87a86fee802160ca2467b81d4620 (patch) | |
tree | d7bba89df847b050d53f72a17d6724142ab27925 | |
parent | 7f2f527bf147d61b48696cd4438acb1a8a920c8a (diff) | |
download | mongo-0e374292088c87a86fee802160ca2467b81d4620.tar.gz |
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.
-rw-r--r-- | jstests/noPassthrough/restart_node_with_bridge.js | 23 | ||||
-rw-r--r-- | src/mongo/shell/replsettest.js | 4 |
2 files changed, 26 insertions, 1 deletions
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); } |