SERVER-20764 Adjust create_index_gle.js to eliminate race between shell and mongos.

The problem with create_index_gle.js that causes SERVER-20764 was that
when the node ultimately given a slaveDelay is initially elected
primary, the test does not wait for mongos to recognize the change of
primary node in the shard replica set. The fix in this patch is to
initialize the shard replica set with only one electable node.
This commit is contained in:
Andy Schwerin
2015-10-05 16:23:01 -04:00
parent a7aa0d48c5
commit d9f2d8fda8

View File

@@ -1,15 +1,23 @@
load('jstests/replsets/rslib.js');
var st = new ShardingTest({ shards: { rs0: { nodes: 2, oplogSize: 10, verbose: 1 }}});
(function () {
"use strict";
var st = new ShardingTest({
shards: {
rs0: {
nodes: { n0: {}, n1: { rsConfig: { priority: 0 } } },
oplogSize: 10,
verbose: 1,
}
},
});
var replTest = st.rs0;
var config = replTest.getReplSetConfig();
config.members[1].priority = 0;
// Add a delay long enough so getLastError would actually 'wait' for write concern.
config.members[1].slaveDelay = 3;
config.version = 2;
var priConn = replTest.getPrimary();
reconfig(replTest, config, true);
assert.soon(function() {
@@ -38,3 +46,4 @@ assert.eq(priIdx.length, secIdx.length, 'pri: ' + tojson(priIdx) + ', sec: ' + t
st.stop();
}());