blob: 28b2a03a363ccf3791d9a41c0627fdd81848bf9a (
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
|
// Previously, the listCollections command would validate the views in all cases, potentially
// causing a secondary to crash in the initial sync of a replicate set in the case that invalid
// views were present. This test ensures that crashes no longer occur in those circumstances.
(function() {
'use strict';
const name = "initial_sync_invalid_views";
let replSet = new ReplSetTest({name: name, nodes: 1});
let oplogSizeOnPrimary = 1; // size in MB
replSet.startSet({oplogSize: oplogSizeOnPrimary});
replSet.initiate();
let primary = replSet.getPrimary();
let primaryParams = primary.adminCommand({getCmdLineOpts: 1}).parsed.setParameter;
let secondaryParams = {};
if (!primaryParams.use3dot2InitialSync) {
secondaryParams.use3dot2InitialSync = false;
}
if (!primaryParams.initialSyncOplogBuffer) {
secondaryParams.initialSyncOplogBuffer = "collection";
}
let coll = primary.getDB('test').foo;
assert.writeOK(coll.insert({a: 1}));
// Add a secondary node but make it hang before copying databases.
let secondary = replSet.add({setParameter: secondaryParams});
secondary.setSlaveOk();
assert.commandWorked(secondary.getDB('admin').runCommand(
{configureFailPoint: 'initialSyncHangBeforeCopyingDatabases', mode: 'alwaysOn'}));
replSet.reInitiate();
assert.writeOK(primary.getDB('test').system.views.insert({invalid: NumberLong(1000)}));
assert.commandWorked(secondary.getDB('admin').runCommand(
{configureFailPoint: 'initialSyncHangBeforeCopyingDatabases', mode: 'off'}));
replSet.awaitSecondaryNodes(200 * 1000);
replSet.stopSet();
})();
|