summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjannaerin <golden.janna@gmail.com>2020-04-29 16:54:22 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-06 20:42:46 +0000
commit1d872d08909307384f48058b6e4eef9ce83a20b1 (patch)
tree4514f282efa699c338d415585fa80946ca01bb7c /src
parent3827a4363c35e056c0cf02dca9385115251969cb (diff)
downloadmongo-1d872d08909307384f48058b6e4eef9ce83a20b1.tar.gz
SERVER-46497 UUID in topologyListener is currently not used
(cherry picked from commit 460b89cc634b379341640bbc0f6ea589897c33a1)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/client/sdam/topology_listener.cpp10
-rw-r--r--src/mongo/client/sdam/topology_listener.h8
-rw-r--r--src/mongo/client/sdam/topology_manager.cpp4
-rw-r--r--src/mongo/client/server_is_master_monitor.cpp7
-rw-r--r--src/mongo/client/server_is_master_monitor.h3
-rw-r--r--src/mongo/client/server_is_master_monitor_test.cpp8
-rw-r--r--src/mongo/client/server_ping_monitor.cpp4
-rw-r--r--src/mongo/client/server_ping_monitor.h3
-rw-r--r--src/mongo/client/server_ping_monitor_test.cpp4
-rw-r--r--src/mongo/client/streamable_replica_set_monitor.cpp4
-rw-r--r--src/mongo/client/streamable_replica_set_monitor.h3
-rw-r--r--src/mongo/client/streamable_replica_set_monitor_query_processor.cpp3
-rw-r--r--src/mongo/client/streamable_replica_set_monitor_query_processor.h3
13 files changed, 22 insertions, 42 deletions
diff --git a/src/mongo/client/sdam/topology_listener.cpp b/src/mongo/client/sdam/topology_listener.cpp
index 3d4fe2b92cb..f56ea9181b3 100644
--- a/src/mongo/client/sdam/topology_listener.cpp
+++ b/src/mongo/client/sdam/topology_listener.cpp
@@ -47,14 +47,11 @@ void TopologyEventsPublisher::close() {
}
void TopologyEventsPublisher::onTopologyDescriptionChangedEvent(
- UUID topologyId,
- TopologyDescriptionPtr previousDescription,
- TopologyDescriptionPtr newDescription) {
+ TopologyDescriptionPtr previousDescription, TopologyDescriptionPtr newDescription) {
{
stdx::lock_guard lock(_eventQueueMutex);
EventPtr event = std::make_unique<Event>();
event->type = EventType::TOPOLOGY_DESCRIPTION_CHANGED;
- event->topologyId = std::move(topologyId);
event->previousDescription = previousDescription;
event->newDescription = newDescription;
_eventQueue.push_back(std::move(event));
@@ -191,9 +188,8 @@ void TopologyEventsPublisher::_sendEvent(TopologyListenerPtr listener, const Eve
listener->onServerHeartbeatFailureEvent(event.status, event.hostAndPort, event.reply);
break;
case EventType::TOPOLOGY_DESCRIPTION_CHANGED:
- // TODO SERVER-46497: fix uuid or just remove
- listener->onTopologyDescriptionChangedEvent(
- UUID::gen(), event.previousDescription, event.newDescription);
+ listener->onTopologyDescriptionChangedEvent(event.previousDescription,
+ event.newDescription);
break;
case EventType::HANDSHAKE_COMPLETE:
listener->onServerHandshakeCompleteEvent(
diff --git a/src/mongo/client/sdam/topology_listener.h b/src/mongo/client/sdam/topology_listener.h
index ff550309068..bbb2a5b21b6 100644
--- a/src/mongo/client/sdam/topology_listener.h
+++ b/src/mongo/client/sdam/topology_listener.h
@@ -33,7 +33,6 @@
#include "mongo/client/sdam/sdam_datatypes.h"
#include "mongo/executor/task_executor.h"
-#include "mongo/util/uuid.h"
namespace mongo::sdam {
@@ -48,8 +47,7 @@ public:
* Called when a TopologyDescriptionChangedEvent is published - The TopologyDescription changed
* and the new TopologyDescription does not match the old.
*/
- virtual void onTopologyDescriptionChangedEvent(UUID topologyId,
- TopologyDescriptionPtr previousDescription,
+ virtual void onTopologyDescriptionChangedEvent(TopologyDescriptionPtr previousDescription,
TopologyDescriptionPtr newDescription){};
virtual void onServerHeartbeatFailureEvent(Status errorStatus,
@@ -104,8 +102,7 @@ public:
void removeListener(TopologyListenerPtr listener);
void close();
- void onTopologyDescriptionChangedEvent(UUID topologyId,
- TopologyDescriptionPtr previousDescription,
+ void onTopologyDescriptionChangedEvent(TopologyDescriptionPtr previousDescription,
TopologyDescriptionPtr newDescription) override;
virtual void onServerHandshakeCompleteEvent(IsMasterRTT durationMs,
const sdam::ServerAddress& address,
@@ -142,7 +139,6 @@ private:
BSONObj reply;
TopologyDescriptionPtr previousDescription;
TopologyDescriptionPtr newDescription;
- boost::optional<UUID> topologyId;
Status status = Status::OK();
};
using EventPtr = std::unique_ptr<Event>;
diff --git a/src/mongo/client/sdam/topology_manager.cpp b/src/mongo/client/sdam/topology_manager.cpp
index 08a07346ed4..cdcb180a66e 100644
--- a/src/mongo/client/sdam/topology_manager.cpp
+++ b/src/mongo/client/sdam/topology_manager.cpp
@@ -156,7 +156,7 @@ void TopologyManager::_publishTopologyDescriptionChanged(
const TopologyDescriptionPtr& oldTopologyDescription,
const TopologyDescriptionPtr& newTopologyDescription) const {
if (_topologyEventsPublisher)
- _topologyEventsPublisher->onTopologyDescriptionChangedEvent(
- newTopologyDescription->getId(), oldTopologyDescription, newTopologyDescription);
+ _topologyEventsPublisher->onTopologyDescriptionChangedEvent(oldTopologyDescription,
+ newTopologyDescription);
}
}; // namespace mongo::sdam
diff --git a/src/mongo/client/server_is_master_monitor.cpp b/src/mongo/client/server_is_master_monitor.cpp
index e7e0ff5dacd..401210d93b6 100644
--- a/src/mongo/client/server_is_master_monitor.cpp
+++ b/src/mongo/client/server_is_master_monitor.cpp
@@ -446,8 +446,7 @@ ServerIsMasterMonitor::ServerIsMasterMonitor(
"RSM {setName} monitoring {size} members.",
"setName"_attr = _setUri.getSetName(),
"size"_attr = initialTopologyDescription->getServers().size());
- onTopologyDescriptionChangedEvent(
- initialTopologyDescription->getId(), nullptr, initialTopologyDescription);
+ onTopologyDescriptionChangedEvent(nullptr, initialTopologyDescription);
}
void ServerIsMasterMonitor::shutdown() {
@@ -462,9 +461,7 @@ void ServerIsMasterMonitor::shutdown() {
}
void ServerIsMasterMonitor::onTopologyDescriptionChangedEvent(
- UUID topologyId,
- sdam::TopologyDescriptionPtr previousDescription,
- sdam::TopologyDescriptionPtr newDescription) {
+ sdam::TopologyDescriptionPtr previousDescription, sdam::TopologyDescriptionPtr newDescription) {
stdx::lock_guard lock(_mutex);
if (_isShutdown)
return;
diff --git a/src/mongo/client/server_is_master_monitor.h b/src/mongo/client/server_is_master_monitor.h
index aff3795c654..ac77a0cd0b5 100644
--- a/src/mongo/client/server_is_master_monitor.h
+++ b/src/mongo/client/server_is_master_monitor.h
@@ -135,8 +135,7 @@ public:
/**
* Add/Remove Single Monitors based on the current topology membership.
*/
- void onTopologyDescriptionChangedEvent(UUID topologyId,
- TopologyDescriptionPtr previousDescription,
+ void onTopologyDescriptionChangedEvent(TopologyDescriptionPtr previousDescription,
TopologyDescriptionPtr newDescription) override;
void disableExpeditedChecking();
diff --git a/src/mongo/client/server_is_master_monitor_test.cpp b/src/mongo/client/server_is_master_monitor_test.cpp
index dd4841745e3..d087f1a6867 100644
--- a/src/mongo/client/server_is_master_monitor_test.cpp
+++ b/src/mongo/client/server_is_master_monitor_test.cpp
@@ -374,8 +374,8 @@ TEST_F(ServerIsMasterMonitorTestFixture, serverIsMasterMonitorOnTopologyDescript
auto sdamConfigAllHosts = sdam::SdamConfiguration(allHostsVec);
auto topologyDescriptionAllHosts =
std::make_shared<sdam::TopologyDescription>(sdamConfigAllHosts);
- isMasterMonitor->onTopologyDescriptionChangedEvent(
- UUID::gen(), topologyDescription0, topologyDescriptionAllHosts);
+ isMasterMonitor->onTopologyDescriptionChangedEvent(topologyDescription0,
+ topologyDescriptionAllHosts);
// Ensure expedited checking is disabled for the SingleServerIsMasterMonitor corresponding to
// host1 as well.
isMasterMonitor->disableExpeditedChecking();
@@ -427,8 +427,8 @@ TEST_F(ServerIsMasterMonitorTestFixture,
std::vector<sdam::ServerAddress> host0Vec{host0};
auto sdamConfig0 = sdam::SdamConfiguration(host0Vec);
auto topologyDescription0 = std::make_shared<sdam::TopologyDescription>(sdamConfig0);
- isMasterMonitor->onTopologyDescriptionChangedEvent(
- UUID::gen(), topologyDescriptionAllHosts, topologyDescription0);
+ isMasterMonitor->onTopologyDescriptionChangedEvent(topologyDescriptionAllHosts,
+ topologyDescription0);
checkNoActivityBefore(deadline);
waitForNextIsMaster(getTimeoutMS());
diff --git a/src/mongo/client/server_ping_monitor.cpp b/src/mongo/client/server_ping_monitor.cpp
index 74b3afd5184..6ce8682fd7c 100644
--- a/src/mongo/client/server_ping_monitor.cpp
+++ b/src/mongo/client/server_ping_monitor.cpp
@@ -248,9 +248,7 @@ void ServerPingMonitor::onServerHandshakeCompleteEvent(sdam::IsMasterRTT duratio
}
void ServerPingMonitor::onTopologyDescriptionChangedEvent(
- UUID topologyId,
- sdam::TopologyDescriptionPtr previousDescription,
- sdam::TopologyDescriptionPtr newDescription) {
+ sdam::TopologyDescriptionPtr previousDescription, sdam::TopologyDescriptionPtr newDescription) {
stdx::lock_guard lk(_mutex);
if (_isShutdown) {
return;
diff --git a/src/mongo/client/server_ping_monitor.h b/src/mongo/client/server_ping_monitor.h
index a24560b26d7..6523ad39a30 100644
--- a/src/mongo/client/server_ping_monitor.h
+++ b/src/mongo/client/server_ping_monitor.h
@@ -161,8 +161,7 @@ public:
* Drop corresponding SingleServerPingMonitors if the server is not included in the
* newDescritpion.
*/
- void onTopologyDescriptionChangedEvent(UUID topologyId,
- sdam::TopologyDescriptionPtr previousDescription,
+ void onTopologyDescriptionChangedEvent(sdam::TopologyDescriptionPtr previousDescription,
sdam::TopologyDescriptionPtr newDescription);
private:
diff --git a/src/mongo/client/server_ping_monitor_test.cpp b/src/mongo/client/server_ping_monitor_test.cpp
index 1045de0033d..98d77a67949 100644
--- a/src/mongo/client/server_ping_monitor_test.cpp
+++ b/src/mongo/client/server_ping_monitor_test.cpp
@@ -210,8 +210,8 @@ protected:
}
auto sdamConfigNew = sdam::SdamConfiguration(hostsNew);
auto topologyDescriptionNew = std::make_shared<sdam::TopologyDescription>(sdamConfigNew);
- pingMonitor->onTopologyDescriptionChangedEvent(
- UUID::gen(), topologyDescriptionOld, topologyDescriptionNew);
+ pingMonitor->onTopologyDescriptionChangedEvent(topologyDescriptionOld,
+ topologyDescriptionNew);
}
private:
diff --git a/src/mongo/client/streamable_replica_set_monitor.cpp b/src/mongo/client/streamable_replica_set_monitor.cpp
index 5ee2af84f9a..6cdccee62c7 100644
--- a/src/mongo/client/streamable_replica_set_monitor.cpp
+++ b/src/mongo/client/streamable_replica_set_monitor.cpp
@@ -569,9 +569,7 @@ void StreamableReplicaSetMonitor::_setConfirmedNotifierState(
}
void StreamableReplicaSetMonitor::onTopologyDescriptionChangedEvent(
- UUID topologyId,
- TopologyDescriptionPtr previousDescription,
- TopologyDescriptionPtr newDescription) {
+ TopologyDescriptionPtr previousDescription, TopologyDescriptionPtr newDescription) {
stdx::lock_guard lock(_mutex);
if (_isDropped.load())
return;
diff --git a/src/mongo/client/streamable_replica_set_monitor.h b/src/mongo/client/streamable_replica_set_monitor.h
index 2beb748ef53..127a746cd7f 100644
--- a/src/mongo/client/streamable_replica_set_monitor.h
+++ b/src/mongo/client/streamable_replica_set_monitor.h
@@ -162,8 +162,7 @@ private:
boost::optional<std::vector<HostAndPort>> _getHosts(const ReadPreferenceSetting& criteria);
// Incoming Events
- void onTopologyDescriptionChangedEvent(UUID topologyId,
- sdam::TopologyDescriptionPtr previousDescription,
+ void onTopologyDescriptionChangedEvent(sdam::TopologyDescriptionPtr previousDescription,
sdam::TopologyDescriptionPtr newDescription) override;
void onServerHeartbeatSucceededEvent(const sdam::ServerAddress& hostAndPort,
diff --git a/src/mongo/client/streamable_replica_set_monitor_query_processor.cpp b/src/mongo/client/streamable_replica_set_monitor_query_processor.cpp
index ab642c2f0d3..7f30d4532b3 100644
--- a/src/mongo/client/streamable_replica_set_monitor_query_processor.cpp
+++ b/src/mongo/client/streamable_replica_set_monitor_query_processor.cpp
@@ -41,8 +41,7 @@ void StreamableReplicaSetMonitor::StreamableReplicaSetMonitorQueryProcessor::shu
}
void StreamableReplicaSetMonitor::StreamableReplicaSetMonitorQueryProcessor::
- onTopologyDescriptionChangedEvent(UUID topologyId,
- sdam::TopologyDescriptionPtr previousDescription,
+ onTopologyDescriptionChangedEvent(sdam::TopologyDescriptionPtr previousDescription,
sdam::TopologyDescriptionPtr newDescription) {
{
stdx::lock_guard lock(_mutex);
diff --git a/src/mongo/client/streamable_replica_set_monitor_query_processor.h b/src/mongo/client/streamable_replica_set_monitor_query_processor.h
index e7d5aec4711..0b7b1b5e41a 100644
--- a/src/mongo/client/streamable_replica_set_monitor_query_processor.h
+++ b/src/mongo/client/streamable_replica_set_monitor_query_processor.h
@@ -37,8 +37,7 @@ class StreamableReplicaSetMonitor::StreamableReplicaSetMonitorQueryProcessor fin
public:
void shutdown();
- void onTopologyDescriptionChangedEvent(UUID topologyId,
- sdam::TopologyDescriptionPtr previousDescription,
+ void onTopologyDescriptionChangedEvent(sdam::TopologyDescriptionPtr previousDescription,
sdam::TopologyDescriptionPtr newDescription) override;
private: