blob: d8c1d629fd01c10b5f8303fd451ed4fc4960d0f6 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// Multiversion initial sync test.
load("./jstests/multiVersion/libs/multi_rs.js");
load("./jstests/replsets/rslib.js");
var oldVersion = "last-stable";
var newVersion = "latest";
var name = "multiversioninitsync";
var multitest = function(replSetVersion, newNodeVersion) {
var nodes = {n1: {binVersion: replSetVersion}, n2: {binVersion: replSetVersion}};
print("Start up a two-node " + replSetVersion + " replica set.");
var rst = new ReplSetTest({name: name, nodes: nodes});
rst.startSet();
rst.initiate();
// Wait for a primary node.
var primary = rst.getPrimary();
// Insert some data and wait for replication.
for (var i = 0; i < 25; i++) {
primary.getDB("foo").foo.insert({_id: i});
}
rst.awaitReplication();
print("Bring up a new node with version " + newNodeVersion + " and add to set.");
rst.add({binVersion: newNodeVersion});
rst.reInitiate();
// Wait for a primary node.
var primary = rst.getPrimary();
var secondaries = rst.getSecondaries();
print("Wait for new node to be synced.");
rst.awaitReplication();
rst.stopSet();
};
// *****************************************
// Test A:
// "Latest" version secondary is synced from
// an old ReplSet.
// *****************************************
multitest(oldVersion, newVersion);
// *****************************************
// Test B:
// Old Secondary is synced from a "latest"
// version ReplSet.
// *****************************************
multitest(newVersion, oldVersion);
|