summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaley Connelly <haley.connelly@mongodb.com>2020-04-01 14:28:15 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-23 21:58:44 +0000
commit23f28ec9b46619d9b2cf6784b344c62bd0ffccaa (patch)
treef3646f42cae27a45244c1ce6937586bfff6d3936
parentf776f6c33b6e4a871c760dc416fac73d3bf910fc (diff)
downloadmongo-23f28ec9b46619d9b2cf6784b344c62bd0ffccaa.tar.gz
SERVER-42632 Disable pinger threads that reach out to config server to make integration tests pass
(cherry picked from commit fa8d794f88daadeb1992b809c0309da2fb362d03)
-rw-r--r--jstests/noPassthrough/readConcern_atClusterTime_noop_write.js29
-rw-r--r--src/mongo/s/catalog/replset_dist_lock_manager.cpp7
-rw-r--r--src/mongo/s/sharding_uptime_reporter.cpp7
3 files changed, 42 insertions, 1 deletions
diff --git a/jstests/noPassthrough/readConcern_atClusterTime_noop_write.js b/jstests/noPassthrough/readConcern_atClusterTime_noop_write.js
index c065ae258aa..080a8871289 100644
--- a/jstests/noPassthrough/readConcern_atClusterTime_noop_write.js
+++ b/jstests/noPassthrough/readConcern_atClusterTime_noop_write.js
@@ -5,6 +5,7 @@
(function() {
"use strict";
load("jstests/replsets/rslib.js");
+load("jstests/libs/fail_point_util.js");
// Skip this test if running with --nojournal and WiredTiger.
if (jsTest.options().noJournal &&
@@ -23,7 +24,33 @@ if (!assert.commandWorked(conn.getDB("test").serverStatus())
}
MongoRunner.stopMongod(conn);
-const st = new ShardingTest({shards: 2, rs: {nodes: 2}});
+// On the config server the lastApplied optime can go past the atClusterTime timestamp due to pings
+// made on collection config.mongos or config.lockping by the distributed lock pinger thread and
+// sharding uptime reporter thread. Hence, it will not write the no-op oplog entry on the config
+// server as part of waiting for read concern.
+// For more deterministic testing of no-op writes to the oplog, disable pinger threads from reaching
+// out to the config server.
+const failpointParams = {
+ setParameter: {"failpoint.disableReplSetDistLockManager": "{mode: 'alwaysOn'}"}
+};
+
+// The ShardingUptimeReporter only exists on mongos.
+const mongosFailpointParams = {
+ setParameter: {
+ "failpoint.disableReplSetDistLockManager": "{mode: 'alwaysOn'}",
+ "failpoint.disableShardingUptimeReporterPeriodicThread": "{mode: 'alwaysOn'}"
+ }
+};
+
+const st = new ShardingTest({
+ shards: 2,
+ rs: {nodes: 2},
+ other: {
+ configOptions: failpointParams,
+ rsOptions: failpointParams,
+ mongosOptions: mongosFailpointParams,
+ }
+});
// Create database "test0" on shard 0.
const testDB0 = st.s.getDB("test0");
diff --git a/src/mongo/s/catalog/replset_dist_lock_manager.cpp b/src/mongo/s/catalog/replset_dist_lock_manager.cpp
index 6d412a01f8d..6542d071ac9 100644
--- a/src/mongo/s/catalog/replset_dist_lock_manager.cpp
+++ b/src/mongo/s/catalog/replset_dist_lock_manager.cpp
@@ -61,6 +61,8 @@ using std::unique_ptr;
namespace {
+MONGO_FAIL_POINT_DEFINE(disableReplSetDistLockManager);
+
// How many times to retry acquiring the lock after the first attempt fails
const int kMaxNumLockAcquireRetries = 2;
@@ -129,6 +131,11 @@ void ReplSetDistLockManager::doTask() {
Client::initThread("replSetDistLockPinger");
while (!isShutDown()) {
+ if (MONGO_unlikely(disableReplSetDistLockManager.shouldFail())) {
+ log() << "The distributed lock ping thread is disabled for testing with processId "
+ << _processID << " and pingInterval " << _pingInterval;
+ return;
+ }
{
auto opCtx = cc().makeOperationContext();
auto pingStatus = _catalog->ping(opCtx.get(), _processID, Date_t::now());
diff --git a/src/mongo/s/sharding_uptime_reporter.cpp b/src/mongo/s/sharding_uptime_reporter.cpp
index bcd18bf07e8..75bdf7d5266 100644
--- a/src/mongo/s/sharding_uptime_reporter.cpp
+++ b/src/mongo/s/sharding_uptime_reporter.cpp
@@ -40,6 +40,7 @@
#include "mongo/s/grid.h"
#include "mongo/util/concurrency/idle_thread_block.h"
#include "mongo/util/exit.h"
+#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"
#include "mongo/util/net/hostname_canonicalization.h"
#include "mongo/util/net/socket_utils.h"
@@ -49,6 +50,8 @@
namespace mongo {
namespace {
+MONGO_FAIL_POINT_DEFINE(disableShardingUptimeReporterPeriodicThread);
+
const Seconds kUptimeReportInterval(10);
std::string constructInstanceIdString(const std::string& hostName) {
@@ -108,6 +111,10 @@ void ShardingUptimeReporter::startPeriodicThread() {
const Timer upTimeTimer;
while (!globalInShutdownDeprecated()) {
+ if (MONGO_unlikely(disableShardingUptimeReporterPeriodicThread.shouldFail())) {
+ log() << "The sharding uptime reporter periodic thread is disabled for testing";
+ return;
+ }
{
auto opCtx = cc().makeOperationContext();
reportStatus(opCtx.get(), instanceId, hostName, upTimeTimer);