1
// Test that chaining position propegation (percolate) still works properly
2
// in the face of socket exceptions
4
function assertGLEOK(status) {
5
assert(status.ok && status.err === null,
6
"Expected OK status object; found " + tojson(status));
9
var replTest = new ReplSetTest({name: 'testSet', nodes: 3});
10
var nodes = replTest.startSet();
11
var hostnames = replTest.nodeList();
16
{"_id" : 0, "host" : hostnames[0], "priority" : 2},
17
{"_id" : 1, "host" : hostnames[1]},
18
{"_id" : 2, "host" : hostnames[2]}
23
replTest.awaitReplication();
26
replTest.partition(0, 2);
28
// Now 0 and 2 can't see each other, so 2 should chain through 1 to reach 0.
30
var master = replTest.getMaster();
31
var cdb = master.getDB("chaining");
32
var admin = nodes[1].getDB("admin");
33
cdb.foo.insert({a:1});
34
assertGLEOK(cdb.getLastErrorObj());
35
replTest.awaitReplication();
37
var result = admin.runCommand( { configureFailPoint: 'rsChaining1', mode: { times : 1 } } );
38
assert.eq(1, result.ok, 'rsChaining1');
39
cdb.foo.insert({a:1});
40
assertGLEOK(cdb.getLastErrorObj());
41
replTest.awaitReplication();
42
admin.runCommand( { configureFailPoint: 'rsChaining2', mode: { times : 1 } } );
43
assert.eq(1, result.ok, 'rsChaining2');
44
cdb.foo.insert({a:1});
45
assertGLEOK(cdb.getLastErrorObj());
46
replTest.awaitReplication();
47
admin.runCommand( { configureFailPoint: 'rsChaining3', mode: { times : 1 } } );
48
assert.eq(1, result.ok, 'rsChaining3');
49
cdb.foo.insert({a:1});
50
assertGLEOK(cdb.getLastErrorObj());
51
replTest.awaitReplication();