blob: 388d1f9bf10ec6dcfcfcffa9ca49ae3645ab06cf (
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
33
|
var replTest = new ReplSetTest({name: 'reindexTest', nodes: 2});
var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getPrimary();
replTest.awaitSecondaryNodes();
var slaves = replTest._slaves;
assert(slaves.length == 1, "Expected 1 slave but length was " + slaves.length);
slave = slaves[0];
db = master.getDB("reindexTest");
slaveDb = slave.getDB("reindexTest");
// Setup index
db.foo.insert({a: 1000});
db.foo.ensureIndex({a: 1});
replTest.awaitReplication();
assert.eq(2, db.foo.getIndexes().length, "Master didn't have proper indexes before reindex");
assert.eq(2, slaveDb.foo.getIndexes().length, "Slave didn't have proper indexes before reindex");
// Try to reindex secondary
slaveDb.foo.reIndex();
assert.eq(2, db.foo.getIndexes().length, "Master didn't have proper indexes after reindex");
assert.eq(2, slaveDb.foo.getIndexes().length, "Slave didn't have proper indexes after reindex");
replTest.stopSet(15);
|