summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-03-16 18:08:49 -0400
committerJudah Schvimer <judah@mongodb.com>2017-03-16 18:08:49 -0400
commitf53a88a57da5788b355cb3037061372a706ccf0d (patch)
tree7a62a074b6dcdcbdc324a37207df1eff5ae8eede /jstests/noPassthroughWithMongod
parent5fe822f53e4bb28e15af2541c0ca931fa05a0e20 (diff)
downloadmongo-f53a88a57da5788b355cb3037061372a706ccf0d.tar.gz
SERVER-26772 removed old initial sync code
Diffstat (limited to 'jstests/noPassthroughWithMongod')
-rw-r--r--jstests/noPassthroughWithMongod/initial_sync_oplog_rollover.js74
-rw-r--r--jstests/noPassthroughWithMongod/initial_sync_parameters.js57
-rw-r--r--jstests/noPassthroughWithMongod/initial_sync_replSetGetStatus.js99
3 files changed, 0 insertions, 230 deletions
diff --git a/jstests/noPassthroughWithMongod/initial_sync_oplog_rollover.js b/jstests/noPassthroughWithMongod/initial_sync_oplog_rollover.js
deleted file mode 100644
index 3a47e14447c..00000000000
--- a/jstests/noPassthroughWithMongod/initial_sync_oplog_rollover.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * This test tests that initial sync succeeds when the sync source's oplog rolls over before the
- * destination node reaches the oplog apply phase. It adds a new secondary to a replicaset and then
- * pauses the initial sync before it copies the databases but after it starts to fetch and buffer
- * oplog entries. The primary then fills up its oplog until it rolls over. At that point
- * initial sync is resumed and we assert that it succeeds and that all of the inserted documents
- * are there.
- */
-
-(function() {
- "use strict";
- load("jstests/libs/check_log.js");
-
- // If the parameter is already set, don't run this test.
- var parameters = db.adminCommand({getCmdLineOpts: 1}).parsed.setParameter;
- if (parameters.use3dot2InitialSync || parameters.initialSyncOplogBuffer) {
- jsTest.log("Skipping initial_sync_oplog_rollover.js because use3dot2InitialSync or " +
- "initialSyncOplogBuffer was already provided.");
- return;
- }
-
- var name = 'initial_sync_oplog_rollover';
- var replSet = new ReplSetTest({
- name: name,
- nodes: 1,
- });
-
- var oplogSizeOnPrimary = 1; // size in MB
- replSet.startSet({oplogSize: oplogSizeOnPrimary});
- replSet.initiate();
- var primary = replSet.getPrimary();
-
- var coll = primary.getDB('test').foo;
- assert.writeOK(coll.insert({a: 1}));
-
- function getFirstOplogEntry(conn) {
- return conn.getDB('local').oplog.rs.find().sort({ts: 1}).limit(1)[0];
- }
-
- var firstOplogEntry = getFirstOplogEntry(primary);
-
- // Add a secondary node but make it hang before copying databases.
- var secondary = replSet.add(
- {setParameter: {use3dot2InitialSync: false, initialSyncOplogBuffer: "collection"}});
- secondary.setSlaveOk();
-
- assert.commandWorked(secondary.getDB('admin').runCommand(
- {configureFailPoint: 'initialSyncHangBeforeCopyingDatabases', mode: 'alwaysOn'}));
- replSet.reInitiate();
-
- checkLog.contains(secondary,
- 'initial sync - initialSyncHangBeforeCopyingDatabases fail point enabled');
-
- // Keep inserting large documents until they roll over the oplog.
- const largeStr = new Array(4 * 1024 * oplogSizeOnPrimary).join('aaaaaaaa');
- var i = 0;
- while (bsonWoCompare(getFirstOplogEntry(primary), firstOplogEntry) === 0) {
- assert.writeOK(coll.insert({a: 2, x: i++, long_str: largeStr}));
- sleep(100);
- }
-
- assert.commandWorked(secondary.getDB('admin').runCommand(
- {configureFailPoint: 'initialSyncHangBeforeCopyingDatabases', mode: 'off'}));
-
- replSet.awaitSecondaryNodes(200 * 1000);
-
- assert.eq(i,
- secondary.getDB('test').foo.count({a: 2}),
- 'collection successfully synced to secondary');
-
- assert.eq(0,
- secondary.getDB('local')['temp_oplog_buffer'].find().itcount(),
- "Oplog buffer was not dropped after initial sync");
-})();
diff --git a/jstests/noPassthroughWithMongod/initial_sync_parameters.js b/jstests/noPassthroughWithMongod/initial_sync_parameters.js
deleted file mode 100644
index 64117f6482b..00000000000
--- a/jstests/noPassthroughWithMongod/initial_sync_parameters.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This test validates command line parameter parsing for initial sync. It tests that the
- * initialSyncOplogBuffer can only use a collection when using the initial syncer. It then checks
- * that only valid initialSyncOplogBuffer options are accepted. Finally it checks that valid
- * combinations of use3dot2InitialSync and initialSyncOplogBuffer are parsed properly.
- */
-
-(function() {
- "use strict";
- // If the parameter is already set, don't run this test.
- var parameters = db.adminCommand({getCmdLineOpts: 1}).parsed.setParameter;
- if (parameters.use3dot2InitialSync || parameters.initialSyncOplogBuffer) {
- jsTest.log("Skipping initial_sync_parameters.js because use3dot2InitialSync or " +
- "initialSyncOplogBuffer was already provided.");
- return;
- }
-
- var m = MongoRunner.runMongod(
- {setParameter: {use3dot2InitialSync: true, initialSyncOplogBuffer: 'collection'}});
- assert.eq(m, null);
-
- m = MongoRunner.runMongod(
- {setParameter: {use3dot2InitialSync: false, initialSyncOplogBuffer: 'invalid'}});
- assert.eq(m, null);
-
- var m2 = MongoRunner.runMongod({
- setParameter:
- {use3dot2InitialSync: true, initialSyncOplogBuffer: 'inMemoryBlockingQueue'}
- });
- var res = assert.commandWorked(
- m2.adminCommand({getParameter: 1, use3dot2InitialSync: 1, initialSyncOplogBuffer: 1}));
- assert.eq(res.use3dot2InitialSync, true);
- assert.eq(res.initialSyncOplogBuffer, "inMemoryBlockingQueue");
- MongoRunner.stopMongod(m2);
-
- var m3 = MongoRunner.runMongod(
- {setParameter: {use3dot2InitialSync: false, initialSyncOplogBuffer: 'collection'}});
- res = assert.commandWorked(
- m3.adminCommand({getParameter: 1, use3dot2InitialSync: 1, initialSyncOplogBuffer: 1}));
- assert.eq(res.use3dot2InitialSync, false);
- assert.eq(res.initialSyncOplogBuffer, "collection");
- MongoRunner.stopMongod(m3);
-
- var m4 = MongoRunner.runMongod({
- setParameter:
- {use3dot2InitialSync: false, initialSyncOplogBuffer: 'inMemoryBlockingQueue'}
- });
- res = assert.commandWorked(
- m4.adminCommand({getParameter: 1, use3dot2InitialSync: 1, initialSyncOplogBuffer: 1}));
- assert.eq(res.use3dot2InitialSync, false);
- assert.eq(res.initialSyncOplogBuffer, "inMemoryBlockingQueue");
-
- assert.commandFailed(m4.adminCommand({setParameter: 1, use3dot2InitialSync: true}));
- assert.commandFailed(m4.adminCommand({setParameter: 1, initialSyncOplogBuffer: "collection"}));
-
- MongoRunner.stopMongod(m4);
-})();
diff --git a/jstests/noPassthroughWithMongod/initial_sync_replSetGetStatus.js b/jstests/noPassthroughWithMongod/initial_sync_replSetGetStatus.js
deleted file mode 100644
index 0c9610e9ad6..00000000000
--- a/jstests/noPassthroughWithMongod/initial_sync_replSetGetStatus.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * This test tests that replSetGetStatus returns initial sync stats while initial sync is in
- * progress.
- */
-
-(function() {
- "use strict";
- load("jstests/libs/check_log.js");
-
- // If the parameter is already set, don't run this test.
- var parameters = db.adminCommand({getCmdLineOpts: 1}).parsed.setParameter;
- if (parameters.use3dot2InitialSync || parameters.initialSyncOplogBuffer) {
- jsTest.log("Skipping initial_sync_parameters.js because use3dot2InitialSync or " +
- "initialSyncOplogBuffer was already provided.");
- return;
- }
-
- var name = 'initial_sync_replSetGetStatus';
- var replSet = new ReplSetTest({
- name: name,
- nodes: 1,
- });
-
- replSet.startSet();
- replSet.initiate();
- var primary = replSet.getPrimary();
-
- var coll = primary.getDB('test').foo;
- assert.writeOK(coll.insert({a: 1}));
- assert.writeOK(coll.insert({a: 2}));
-
- // Add a secondary node but make it hang before copying databases.
- var secondary = replSet.add(
- {setParameter: {use3dot2InitialSync: false, initialSyncOplogBuffer: "collection"}});
- secondary.setSlaveOk();
-
- assert.commandWorked(secondary.getDB('admin').runCommand(
- {configureFailPoint: 'initialSyncHangBeforeCopyingDatabases', mode: 'alwaysOn'}));
- assert.commandWorked(secondary.getDB('admin').runCommand(
- {configureFailPoint: 'initialSyncHangBeforeFinish', mode: 'alwaysOn'}));
- replSet.reInitiate();
-
- // Wait for initial sync to pause before it copies the databases.
- checkLog.contains(secondary,
- 'initial sync - initialSyncHangBeforeCopyingDatabases fail point enabled');
-
- // Test that replSetGetStatus returns the correct results while initial sync is in progress.
- var res = assert.commandWorked(secondary.adminCommand({replSetGetStatus: 1}));
- assert(!res.initialSyncStatus,
- "Response should not have an 'initialSyncStatus' field: " + tojson(res));
-
- res = assert.commandWorked(secondary.adminCommand({replSetGetStatus: 1, initialSync: 1}));
- assert(res.initialSyncStatus,
- "Response should have an 'initialSyncStatus' field: " + tojson(res));
-
- assert.commandFailed(secondary.adminCommand({replSetGetStatus: 1, initialSync: "t"}),
- ErrorCodes.TypeMismatch);
-
- assert.writeOK(coll.insert({a: 3}));
- assert.writeOK(coll.insert({a: 4}));
-
- // Let initial sync continue working.
- assert.commandWorked(secondary.getDB('admin').runCommand(
- {configureFailPoint: 'initialSyncHangBeforeCopyingDatabases', mode: 'off'}));
-
- // Wait for initial sync to pause right before it finishes.
- checkLog.contains(secondary, 'initial sync - initialSyncHangBeforeFinish fail point enabled');
-
- // Test that replSetGetStatus returns the correct results when initial sync is at the very end.
- res = assert.commandWorked(secondary.adminCommand({replSetGetStatus: 1, initialSync: 1}));
- assert(res.initialSyncStatus, "Response should have an 'initialSyncStatus' field.");
- assert.eq(res.initialSyncStatus.fetchedMissingDocs, 0);
- assert.eq(res.initialSyncStatus.appliedOps, 2);
- assert.eq(res.initialSyncStatus.failedInitialSyncAttempts, 0);
- assert.eq(res.initialSyncStatus.maxFailedInitialSyncAttempts, 1);
- assert.eq(res.initialSyncStatus.databases.databasesCloned, 2);
- assert.eq(res.initialSyncStatus.databases.test.collections, 1);
- assert.eq(res.initialSyncStatus.databases.test.clonedCollections, 1);
- assert.eq(res.initialSyncStatus.databases.test["test.foo"].documentsToCopy, 4);
- assert.eq(res.initialSyncStatus.databases.test["test.foo"].documentsCopied, 4);
- assert.eq(res.initialSyncStatus.databases.test["test.foo"].indexes, 1);
- assert.eq(res.initialSyncStatus.databases.test["test.foo"].fetchedBatches, 1);
-
- // Let initial sync finish and get into secondary state.
- assert.commandWorked(secondary.getDB('admin').runCommand(
- {configureFailPoint: 'initialSyncHangBeforeFinish', mode: 'off'}));
- replSet.awaitSecondaryNodes(60 * 1000);
-
- // Test that replSetGetStatus returns the correct results after initial sync is finished.
- res = assert.commandWorked(secondary.adminCommand({replSetGetStatus: 1}));
- assert(!res.initialSyncStatus,
- "Response should not have an 'initialSyncStatus' field: " + tojson(res));
-
- assert.commandFailedWithCode(secondary.adminCommand({replSetGetStatus: 1, initialSync: "m"}),
- ErrorCodes.TypeMismatch);
- assert.eq(0,
- secondary.getDB('local')['temp_oplog_buffer'].find().itcount(),
- "Oplog buffer was not dropped after initial sync");
-})();