summaryrefslogtreecommitdiff
path: root/jstests/libs
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2016-12-15 18:07:51 -0500
committerSpencer T Brody <spencer@mongodb.com>2017-01-04 16:00:25 -0500
commit87f49488f1b5c872daa71fd2fd9b5d744409a817 (patch)
tree38f4d3eaf16f933c9cfc184501f6e0068be807f1 /jstests/libs
parenta59962fab548e695f2e0efa2f261381cba771551 (diff)
downloadmongo-87f49488f1b5c872daa71fd2fd9b5d744409a817.tar.gz
SERVER-27123 Only update the commit point as a secondary from oplog queries against your sync source
Diffstat (limited to 'jstests/libs')
-rw-r--r--jstests/libs/write_concern_util.js33
1 files changed, 22 insertions, 11 deletions
diff --git a/jstests/libs/write_concern_util.js b/jstests/libs/write_concern_util.js
index c87ec667591..d7541b3b9a6 100644
--- a/jstests/libs/write_concern_util.js
+++ b/jstests/libs/write_concern_util.js
@@ -17,18 +17,23 @@ function shardCollectionWithChunks(st, coll) {
assert.eq(coll.count(), numberDoc);
}
-// Stops replication at a server.
+// Stops replication on the given server(s).
function stopServerReplication(conn) {
- var errMsg = 'Failed to enable rsSyncApplyStop failpoint.';
+ if (conn.length) {
+ conn.forEach(function(n) {
+ stopServerReplication(n);
+ });
+ return;
+ }
+ var errMsg = 'Failed to enable stopOplogFetcher failpoint.';
assert.commandWorked(
- conn.getDB('admin').runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'alwaysOn'}),
+ conn.getDB('admin').runCommand({configureFailPoint: 'stopOplogFetcher', mode: 'alwaysOn'}),
errMsg);
}
// Stops replication at all replicaset secondaries.
function stopReplicationOnSecondaries(rs) {
- var secondaries = rs.getSecondaries();
- secondaries.forEach(stopServerReplication);
+ stopServerReplication(rs.getSecondaries());
}
// Stops replication at all shard secondaries.
@@ -36,23 +41,29 @@ function stopReplicationOnSecondariesOfAllShards(st) {
st._rsObjects.forEach(stopReplicationOnSecondaries);
}
-// Restarts replication at a server.
+// Restarts replication on the given server(s).
function restartServerReplication(conn) {
- var errMsg = 'Failed to disable rsSyncApplyStop failpoint.';
+ if (conn.length) {
+ conn.forEach(function(n) {
+ restartServerReplication(n);
+ });
+ return;
+ }
+
+ var errMsg = 'Failed to disable stopOplogFetcher failpoint.';
assert.commandWorked(
- conn.getDB('admin').runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'}),
+ conn.getDB('admin').runCommand({configureFailPoint: 'stopOplogFetcher', mode: 'off'}),
errMsg);
}
// Restarts replication at all nodes in a replicaset.
function restartReplSetReplication(rs) {
- rs.nodes.forEach(restartServerReplication);
+ restartServerReplication(rs.nodes);
}
// Restarts replication at all replicaset secondaries.
function restartReplicationOnSecondaries(rs) {
- var secondaries = rs.getSecondaries();
- secondaries.forEach(restartServerReplication);
+ restartServerReplication(rs.getSecondaries());
}
// Restarts replication at all nodes in a sharded cluster.