From 21948042b6da5fb5bf15897f9808a70551f5af09 Mon Sep 17 00:00:00 2001 From: Spencer T Brody Date: Tue, 17 Jan 2017 17:06:52 -0500 Subject: SERVER-27680 Merge stopOplogFetcher and pauseRsBgSyncProducer failpoint into single stopReplProducer failpoint --- jstests/sharding/config_version_rollback.js | 15 +++++---------- jstests/sharding/shard_identity_rollback.js | 24 ++++-------------------- 2 files changed, 9 insertions(+), 30 deletions(-) (limited to 'jstests/sharding') diff --git a/jstests/sharding/config_version_rollback.js b/jstests/sharding/config_version_rollback.js index 95dc114fb14..2ad468b05bc 100644 --- a/jstests/sharding/config_version_rollback.js +++ b/jstests/sharding/config_version_rollback.js @@ -6,7 +6,8 @@ (function() { "use strict"; - load("jstests/libs/check_log.js"); + + load("jstests/libs/write_concern_util.js"); // The config.version document is written on transition to primary. We need to ensure this // config.version document is rolled back for this test. @@ -57,12 +58,9 @@ jsTest.log("Waiting for " + nodes[1] + " and " + nodes[2] + " to transition to SECONDARY."); configRS.waitForState([nodes[1], nodes[2]], ReplSetTest.State.SECONDARY); - jsTest.log("Stopping the OplogFetcher on all nodes"); + jsTest.log("Stopping the replication producer on all nodes"); // Now that the secondaries have finished initial sync and are electable, stop replication. - nodes.forEach(function(node) { - assert.commandWorked(node.getDB('admin').runCommand( - {configureFailPoint: 'stopOplogFetcher', mode: 'alwaysOn'})); - }); + stopServerReplication([nodes[1], nodes[2]]); jsTest.log("Allowing the primary to write the config.version doc"); nodes.forEach(function(node) { @@ -116,10 +114,7 @@ assert.neq(origConfigVersionDoc.clusterId, newConfigVersionDoc.clusterId); jsTest.log("Re-enabling replication on all nodes"); - nodes.forEach(function(node) { - assert.commandWorked( - node.getDB('admin').runCommand({configureFailPoint: 'stopOplogFetcher', mode: 'off'})); - }); + restartServerReplication(nodes); jsTest.log( "Waiting for original primary to rollback and replicate new config.version document"); diff --git a/jstests/sharding/shard_identity_rollback.js b/jstests/sharding/shard_identity_rollback.js index ac899c5edce..c7b6fedaacc 100644 --- a/jstests/sharding/shard_identity_rollback.js +++ b/jstests/sharding/shard_identity_rollback.js @@ -7,6 +7,8 @@ (function() { "use strict"; + load('jstests/libs/write_concern_util.js'); + var st = new ShardingTest({shards: 1}); var replTest = new ReplSetTest({nodes: 3}); @@ -23,14 +25,7 @@ replTest.awaitSecondaryNodes(); replTest.awaitReplication(); - nodes.forEach(function(node) { - // Pause bgsync so it doesn't keep trying to sync from other nodes. - assert.commandWorked( - node.adminCommand({configureFailPoint: 'pauseRsBgSyncProducer', mode: 'alwaysOn'})); - // Stop oplog fetcher so that the ongoing fetcher doesn't return anything new. - assert.commandWorked( - node.adminCommand({configureFailPoint: 'stopOplogFetcher', mode: 'alwaysOn'})); - }); + stopServerReplication(secondaries); jsTest.log("inserting shardIdentity document to primary that shouldn't replicate"); @@ -70,18 +65,7 @@ // Disable the fail point so that the elected node can exit drain mode and finish becoming // primary. - secondaries.forEach(function(secondary) { - assert.commandWorked( - secondary.adminCommand({configureFailPoint: 'stopOplogFetcher', mode: 'off'})); - try { - assert.commandWorked( - secondary.adminCommand({configureFailPoint: 'pauseRsBgSyncProducer', mode: 'off'})); - } catch (e) { - // Enabling bgsync producer may cause rollback, which will close all connections - // including the one sending "configureFailPoint". - print("got exception when disabling fail point 'pauseRsBgSyncProducer': " + e); - } - }); + restartServerReplication(secondaries); // Wait for a new healthy primary var newPriConn = replTest.getPrimary(); -- cgit v1.2.1