blob: 5b068cd3d8ee5f71834a06f5b6772a873ad74c17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
var replTest = new ReplSetTest( {name: 'unicomplex', nodes: 3} );
var conns = replTest.startSet();
replTest.initiate();
// Make sure we have a master
var master = replTest.getMaster();
for (i=0;i<10000; i++) { master.getDB("bar").foo.insert({x:1,y:i,abc:123,str:"foo bar baz"}); }
for (i=0;i<1000; i++) { master.getDB("bar").foo.update({y:i},{$push :{foo : "barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"}}); }
replTest.awaitReplication();
assert.soon(function() { return conns[2].getDB("admin").isMaster().secondary; });
join = startParallelShell( "db.getSisterDB('bar').runCommand({compact : 'foo'});", replTest.ports[2] );
print("check secondary goes to recovering");
assert.soon(function() { return !conns[2].getDB("admin").isMaster().secondary; });
print("joining");
join();
print("check secondary becomes a secondary again");
var x = 0;
assert.soon(function() {
var im = conns[2].getDB("admin").isMaster();
if (x++ % 5 == 0) printjson(im);
return im.secondary;
});
|