summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Nelson <lamont.nelson@mongodb.com>2020-02-25 18:38:00 -0500
committerLamont Nelson <lamont.nelson@mongodb.com>2020-02-25 18:38:00 -0500
commite38cd4646b588c827c8c785c5a9820291301f57c (patch)
tree313e479f255e339dd5d0607db0da3f777457e7d5
parent6357aefa448812c9f29f71bc7f418d7b944b79ee (diff)
downloadmongo-e38cd4646b588c827c8c785c5a9820291301f57c.tar.gz
log rsm type on create
-rw-r--r--jstests/sharding/repl_monitor_refresh.js9
-rw-r--r--src/mongo/client/replica_set_monitor_manager.cpp4
-rw-r--r--src/mongo/client/streamable_replica_set_monitor.cpp5
3 files changed, 14 insertions, 4 deletions
diff --git a/jstests/sharding/repl_monitor_refresh.js b/jstests/sharding/repl_monitor_refresh.js
index 20f1d930d98..152fa13a94a 100644
--- a/jstests/sharding/repl_monitor_refresh.js
+++ b/jstests/sharding/repl_monitor_refresh.js
@@ -7,6 +7,14 @@ load("jstests/replsets/rslib.js");
(function() {
"use strict";
+function sleep(milliseconds) {
+ const date = Date.now();
+ let currentDate = null;
+ do {
+ currentDate = Date.now();
+ } while (currentDate - date < milliseconds);
+}
+
// Skip db hash check and shard replication since the removed node has wrong config and is still
// alive.
TestData.skipCheckDBHashes = true;
@@ -16,6 +24,7 @@ var NODE_COUNT = 3;
var st = new ShardingTest({shards: {rs0: {nodes: NODE_COUNT, oplogSize: 10}}});
var replTest = st.rs0;
var mongos = st.s;
+//sleep(30 * 1000);
var shardDoc = mongos.getDB('config').shards.findOne();
assert.eq(NODE_COUNT, shardDoc.host.split(',').length); // seed list should contain all nodes
diff --git a/src/mongo/client/replica_set_monitor_manager.cpp b/src/mongo/client/replica_set_monitor_manager.cpp
index c315a61af98..b59316a8c73 100644
--- a/src/mongo/client/replica_set_monitor_manager.cpp
+++ b/src/mongo/client/replica_set_monitor_manager.cpp
@@ -130,13 +130,13 @@ shared_ptr<ReplicaSetMonitor> ReplicaSetMonitorManager::getOrCreateMonitor(const
return monitor;
}
- LOGV2(20186, "Starting new replica set monitor for {uri}", "uri"_attr = uri.toString());
-
std::shared_ptr<ReplicaSetMonitor> newMonitor;
if (disableStreamableReplicaSetMonitor.load()) {
+ LOGV2(4333204, "Starting Scanning ReplicaSetMonitor", "uri"_attr = uri.toString());
newMonitor = std::make_shared<ScanningReplicaSetMonitor>(uri);
newMonitor->init();
} else {
+ LOGV2(4333205, "Starting Streamable ReplicaSetMonitor", "uri"_attr = uri.toString());
newMonitor = StreamableReplicaSetMonitor::make(uri, getExecutor());
}
_monitors[setName] = newMonitor;
diff --git a/src/mongo/client/streamable_replica_set_monitor.cpp b/src/mongo/client/streamable_replica_set_monitor.cpp
index f716bb71d67..4c93f2b4238 100644
--- a/src/mongo/client/streamable_replica_set_monitor.cpp
+++ b/src/mongo/client/streamable_replica_set_monitor.cpp
@@ -143,6 +143,7 @@ void StreamableReplicaSetMonitor::init() {
_eventsPublisher = std::make_shared<sdam::TopologyEventsPublisher>(_executor);
_topologyManager = std::make_unique<TopologyManager>(
_sdamConfig, getGlobalServiceContext()->getPreciseClockSource(), _eventsPublisher);
+
_isMasterMonitor = std::make_unique<ServerIsMasterMonitor>(
_uri, _sdamConfig, _eventsPublisher, _topologyManager->getTopologyDescription(), _executor);
@@ -155,10 +156,10 @@ void StreamableReplicaSetMonitor::init() {
void StreamableReplicaSetMonitor::drop() {
stdx::lock_guard lock(_mutex);
- if (_isDropped.load())
+ if (_isDropped.swap(true)) {
return;
+ }
- _isDropped.store(true);
LOG(kDefaultLogLevel) << _logPrefix() << "Closing Replica Set Monitor";
_eventsPublisher->close();
_queryProcessor->shutdown();