summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Gorman <bernard.gorman@gmail.com>2020-02-08 02:27:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-16 03:04:02 +0000
commit1d21e89fa5c9d838b2f40045c26fe41f306a8873 (patch)
tree28c3c1475721462c23322f421bf1067daad7346d
parente3c004d38fe196da61ae9aea3ea0185a275ea4e6 (diff)
downloadmongo-1d21e89fa5c9d838b2f40045c26fe41f306a8873.tar.gz
SERVER-44356 Set config server periodicNoopIntervalSecs to 1
-rw-r--r--jstests/sharding/change_streams.js8
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp8
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.idl2
3 files changed, 16 insertions, 2 deletions
diff --git a/jstests/sharding/change_streams.js b/jstests/sharding/change_streams.js
index 83cfa09abd1..c9a9c41fa1c 100644
--- a/jstests/sharding/change_streams.js
+++ b/jstests/sharding/change_streams.js
@@ -35,6 +35,14 @@ function runTest(collName, shardKey) {
const mongosColl = mongosDB[collName];
//
+ // Test that the config server is running with {periodicNoopIntervalSecs: 1}. This ensures that
+ // the config server does not unduly delay a change stream despite its low write rate.
+ //
+ const noopPeriod = assert.commandWorked(
+ st.configRS.getPrimary().adminCommand({getParameter: 1, periodicNoopIntervalSecs: 1}));
+ assert.eq(noopPeriod.periodicNoopIntervalSecs, 1, noopPeriod);
+
+ //
// Sanity tests
//
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index e93a25bb29b..c3cfc7b646f 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -334,7 +334,13 @@ ReplicationCoordinatorImpl::ReplicationCoordinatorImpl(
return;
}
- _externalState->setupNoopWriter(Seconds(periodicNoopIntervalSecs));
+ // If this is a config server, then we set the periodic no-op interval to 1 second. This is to
+ // ensure that the config server will not unduly hold up change streams running on the cluster.
+ if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) {
+ periodicNoopIntervalSecs.store(1);
+ }
+
+ _externalState->setupNoopWriter(Seconds(periodicNoopIntervalSecs.load()));
}
ReplicationCoordinatorImpl::~ReplicationCoordinatorImpl() = default;
diff --git a/src/mongo/db/repl/replication_coordinator_impl.idl b/src/mongo/db/repl/replication_coordinator_impl.idl
index 88b3428e666..3775a2afe80 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.idl
+++ b/src/mongo/db/repl/replication_coordinator_impl.idl
@@ -60,7 +60,7 @@ server_parameters:
description: <-
Number of seconds between noop writer writes.
set_at: [ startup ]
- cpp_vartype: int
+ cpp_vartype: AtomicWord<int>
cpp_varname: periodicNoopIntervalSecs
default: 10
validator: