summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-14 14:26:38 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-14 14:26:38 -0300
commit294bc6ecabf14c09c9bc8644704921dcf97cb44e (patch)
tree279b1e0bab53901a1647ac63c1c724f0f789a663 /src/mongo/client
parent70be7c27a251621187a1de533462ae2bb1e3bd39 (diff)
parent1e917fd798aa25b7066d4b414b51184f13d5a092 (diff)
Update upstream source from tag 'upstream/6.0.10'debian/6.0.10-1
Update to upstream version '6.0.10' with Debian dir 2d176fa254eee97b139f712fec5709641335a8c3
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/README.md32
-rw-r--r--src/mongo/client/async_client.cpp22
-rw-r--r--src/mongo/client/async_client.h6
-rw-r--r--src/mongo/client/authenticate.cpp38
-rw-r--r--src/mongo/client/authenticate.h16
-rw-r--r--src/mongo/client/connection_pool.cpp4
-rw-r--r--src/mongo/client/connpool.cpp1
-rw-r--r--src/mongo/client/dbclient_base.cpp5
-rw-r--r--src/mongo/client/dbclient_connection.cpp66
-rw-r--r--src/mongo/client/dbclient_connection.h8
-rw-r--r--src/mongo/client/dbclient_cursor.h4
-rw-r--r--src/mongo/client/replica_set_monitor_integration_test.cpp1
-rw-r--r--src/mongo/client/replica_set_monitor_manager.cpp12
-rw-r--r--src/mongo/client/replica_set_monitor_manager.h4
-rw-r--r--src/mongo/client/replica_set_monitor_server_parameters.idl2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/README.rst12
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/compatible.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/compatible_unknown.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_arbiters.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_passives.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_primary.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_secondary.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/discovery.json8
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/discovery.json.notused8
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/equal_electionids.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/ghost_discovered.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/hosts_differ_from_seeds.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_arbiter.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_ghost.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_other.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/ls_timeout.json12
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/member_reconfig.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/member_standalone.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_new_electionid.json6
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_new_setversion.json6
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_wrong_set_name.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/normalize_case.json.disabled2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/normalize_case_me.json.disabled4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/null_election_id.json8
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_ghost.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_mongos.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_standalone.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_changes_set_name.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect_electionid.json10
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect_setversion.json10
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_hint_from_secondary_with_mismatched_me.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_mismatched_me.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_reports_new_member.json8
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_to_no_primary_mismatched_me.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_wrong_set_name.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/response_from_removed.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/rsother_discovered.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/sec_not_auth.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_ignore_ok_0.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_mismatched_me.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_wrong_set_name.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_wrong_set_name_with_primary.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/set_version_can_rollback.json6
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/setversion_without_electionid.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/stepdown_change_set_name.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/too_new.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/too_old.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/unexpected_mongos.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/use_setversion_without_electionid.json6
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/rs/wrong_set_name.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/sharded/compatible.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/sharded/ls_timeout_mongos.json8
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/sharded/mongos_disconnect.json6
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/sharded/multiple_mongoses.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/sharded/non_mongos_removed.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/sharded/too_new.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/sharded/too_old.json4
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/compatible.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_external_ip.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_mongos.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rsarbiter.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rsprimary.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rssecondary.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_slave.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_standalone.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/ls_timeout_standalone.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/not_ok_response.json6
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/standalone_removed.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/too_new.json2
-rw-r--r--src/mongo/client/sdam/json_tests/sdam_tests/single/too_old.json2
-rw-r--r--src/mongo/client/sdam/sdam_configuration.h2
-rw-r--r--src/mongo/client/sdam/sdam_configuration_parameters.idl4
-rw-r--r--src/mongo/client/sdam/sdam_json_test_runner.cpp14
-rw-r--r--src/mongo/client/sdam/server_description.cpp2
-rw-r--r--src/mongo/client/sdam/server_description_test.cpp6
-rw-r--r--src/mongo/client/sdam/server_selection_json_test_runner.cpp2
-rw-r--r--src/mongo/client/sdam/server_selector.cpp51
-rw-r--r--src/mongo/client/sdam/server_selector_test.cpp4
-rw-r--r--src/mongo/client/sdam/topology_listener_mock.cpp32
-rw-r--r--src/mongo/client/sdam/topology_listener_mock.h10
-rw-r--r--src/mongo/client/sdam/topology_manager_test.cpp2
-rw-r--r--src/mongo/client/sdam/topology_state_machine.cpp13
-rw-r--r--src/mongo/client/server_discovery_monitor.cpp4
-rw-r--r--src/mongo/client/server_discovery_monitor_expedited_test.cpp6
-rw-r--r--src/mongo/client/server_discovery_monitor_test.cpp252
-rw-r--r--src/mongo/client/server_ping_monitor.cpp16
-rw-r--r--src/mongo/client/server_ping_monitor.h2
-rw-r--r--src/mongo/client/server_ping_monitor_test.cpp2
-rw-r--r--src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp2
-rw-r--r--src/mongo/client/streamable_replica_set_monitor_query_processor.cpp3
107 files changed, 491 insertions, 447 deletions
diff --git a/src/mongo/client/README.md b/src/mongo/client/README.md
index b79a3971254..4bc8afea3c7 100644
--- a/src/mongo/client/README.md
+++ b/src/mongo/client/README.md
@@ -1,13 +1,37 @@
# Internal Client
## Replica set monitoring and host targeting
-The internal client driver responsible for routing a command request to a replica set must determine which member to target. Host targeting involves finding which nodes in a topology satisfy the $readPreference. Node eligibility depends on the type of a node (i.e primary, secondary, etc.) and its average network latency round-trip-time (RTT). For example, { $readPreference: secondary } requires the client to know which nodes are secondaries and, of those nodes, which nodes fit within a delta of the node with the smallest RTT. A FailedToSatisfyReadPreference error occurs when there is a host selection time out and no eligible nodes are found.
+The internal client driver responsible for routing a command request to a replica set must determine
+which member to target. Host targeting involves finding which nodes in a topology satisfy the
+$readPreference. Node eligibility depends on the type of a node (i.e primary, secondary, etc.) and
+its average network latency round-trip-time (RTT). For example, { $readPreference: secondary }
+requires the client to know which nodes are secondaries and, of those nodes, which nodes fit within
+a delta of the node with the smallest RTT. A FailedToSatisfyReadPreference error occurs when there
+is a host selection time out and no eligible nodes are found.
-Nodes in a topology are discovered and monitored through replica set monitoring. Replica set monitoring entails periodically refreshing the local view of topologies for which the client needs to perform targeting. The client has a ReplicaSetMonitor for each replica set it needs to target in the cluster. So, if a mongos needs to target 2 shards for a query, it either has or creates a ReplicaSetMonitor for each of the corresponding shards.
+Nodes in a topology are discovered and monitored through replica set monitoring. Replica set
+monitoring entails periodically refreshing the local view of topologies for which the client needs
+to perform targeting. The client has a ReplicaSetMonitor for each replica set it needs to target in
+the cluster. So, if a mongos needs to target 2 shards for a query, it either has or creates a
+ReplicaSetMonitor for each of the corresponding shards.
-The ReplicaSetMonitorInterface supports the replica set monitoring protocol. The replica set monitoring protocol supports the "awaitable hello" command feature and abides by the Server Discovery and Monitoring (SDAM) specifications. The "awaitable hello" command feature allows the isMaster/hello command to wait for a significant topology change or timeout before replying. For more information about why MongoDB supports both hello and isMaster, please refer to the Replication Arch Guide. Two different versions of the protocol are supported - "sdam", which does not support awaitable hello with exhaust, and "streamable", which does support exhaust and is on by default. Clients who enable the awaitable hello (with or without exhaust) will learn much sooner about stepdowns, elections, reconfigs, and other events.
+The ReplicaSetMonitorInterface supports the replica set monitoring protocol. The replica set
+monitoring protocol supports the "awaitable hello" command feature and abides by the Server
+Discovery and Monitoring (SDAM) specifications. The "awaitable hello" command feature allows the
+isMaster/hello command to wait for a significant topology change or timeout before replying. For
+more information about why MongoDB supports both hello and isMaster, please refer to the Replication
+Arch Guide. Two different versions of the protocol are supported - "sdam", which does not support
+awaitable hello with exhaust, and "streamable", which does support exhaust and is on by default.
+Clients who enable the awaitable hello (with or without exhaust) will learn much sooner about
+stepdowns, elections, reconfigs, and other events.
-In the streamable protocol, the StreamableReplicaSetMonitor is used to gather and maintain information regarding the client's local topology description. The topology description holds the learned states of each member in the replica set. Since the new protocol supports exhaust, the RTT is measured by sending a 'ping' to each node in the topology at a fixed frequency rather than through the isMaster response latency. Aside from the RTT, the remaining information for satisfying read preferences is gathered through awaitable isMaster commands asynchronously sent to each node in the topology.
+In the streamable protocol, the StreamableReplicaSetMonitor is used to gather and maintain
+information regarding the client's local topology description. The topology description holds the
+learned states of each member in the replica set. Since the new protocol supports exhaust, the RTT
+is measured by sending a 'ping' to each node in the topology at a fixed frequency rather than
+through the hello response latency. Aside from the RTT, the remaining information for satisfying
+read preferences is gathered through awaitable hello commands asynchronously sent to each node in
+the topology.
#### Code references
diff --git a/src/mongo/client/async_client.cpp b/src/mongo/client/async_client.cpp
index 309475ec36e..d8cc8d4fcc9 100644
--- a/src/mongo/client/async_client.cpp
+++ b/src/mongo/client/async_client.cpp
@@ -73,17 +73,17 @@ Future<AsyncDBClient::Handle> AsyncDBClient::connect(
});
}
-BSONObj AsyncDBClient::_buildIsMasterRequest(const std::string& appName,
- executor::NetworkConnectionHook* hook) {
+BSONObj AsyncDBClient::_buildHelloRequest(const std::string& appName,
+ executor::NetworkConnectionHook* hook) {
BSONObjBuilder bob;
- bob.append("isMaster", 1);
+ bob.append("hello", 1);
const auto versionString = VersionInfoInterface::instance().version();
ClientMetadata::serialize(appName, versionString, &bob);
if (getTestCommandsEnabled()) {
- // Only include the host:port of this process in the isMaster command request if test
+ // Only include the host:port of this process in the "hello" command request if test
// commands are enabled. mongobridge uses this field to identify the process opening a
// connection to it.
StringBuilder sb;
@@ -98,16 +98,16 @@ BSONObj AsyncDBClient::_buildIsMasterRequest(const std::string& appName,
}
if (hook) {
- return hook->augmentIsMasterRequest(remote(), bob.obj());
+ return hook->augmentHelloRequest(remote(), bob.obj());
} else {
return bob.obj();
}
}
-void AsyncDBClient::_parseIsMasterResponse(BSONObj request,
- const std::unique_ptr<rpc::ReplyInterface>& response) {
+void AsyncDBClient::_parseHelloResponse(BSONObj request,
+ const std::unique_ptr<rpc::ReplyInterface>& response) {
uassert(50786,
- "Expected OP_MSG response to isMaster",
+ "Expected OP_MSG response to 'hello'",
response->getProtocol() == rpc::Protocol::kOpMsg);
auto wireSpec = WireSpec::instance().get();
auto responseBody = response->getCommandReply();
@@ -206,7 +206,7 @@ Future<bool> AsyncDBClient::completeSpeculativeAuth(std::shared_ptr<SaslClientSe
if (speculativeAuthType == auth::SpeculativeAuthType::kNone) {
return Status(ErrorCodes::BadValue,
- str::stream() << "Received unexpected isMaster."
+ str::stream() << "Received unexpected hello."
<< auth::kSpeculativeAuthenticate << " reply");
}
@@ -232,7 +232,7 @@ Future<bool> AsyncDBClient::completeSpeculativeAuth(std::shared_ptr<SaslClientSe
Future<void> AsyncDBClient::initWireVersion(const std::string& appName,
executor::NetworkConnectionHook* const hook) {
- auto requestObj = _buildIsMasterRequest(appName, hook);
+ auto requestObj = _buildHelloRequest(appName, hook);
auto opMsgRequest = OpMsgRequest::fromDBAndBody("admin", requestObj);
auto msgId = nextMessageId();
@@ -240,7 +240,7 @@ Future<void> AsyncDBClient::initWireVersion(const std::string& appName,
.then([msgId, this]() { return _waitForResponse(msgId); })
.then([this, requestObj, hook, timer = Timer{}](Message response) {
auto cmdReply = rpc::makeReply(&response);
- _parseIsMasterResponse(requestObj, cmdReply);
+ _parseHelloResponse(requestObj, cmdReply);
if (hook) {
executor::RemoteCommandResponse cmdResp(*cmdReply, timer.elapsed());
uassertStatusOK(hook->validateHost(_peer, requestObj, std::move(cmdResp)));
diff --git a/src/mongo/client/async_client.h b/src/mongo/client/async_client.h
index 82867a057ff..0967ad3fa2a 100644
--- a/src/mongo/client/async_client.h
+++ b/src/mongo/client/async_client.h
@@ -104,10 +104,8 @@ private:
Future<Message> _waitForResponse(boost::optional<int32_t> msgId,
const BatonHandle& baton = nullptr);
Future<void> _call(Message request, int32_t msgId, const BatonHandle& baton = nullptr);
- BSONObj _buildIsMasterRequest(const std::string& appName,
- executor::NetworkConnectionHook* hook);
- void _parseIsMasterResponse(BSONObj request,
- const std::unique_ptr<rpc::ReplyInterface>& response);
+ BSONObj _buildHelloRequest(const std::string& appName, executor::NetworkConnectionHook* hook);
+ void _parseHelloResponse(BSONObj request, const std::unique_ptr<rpc::ReplyInterface>& response);
auth::RunCommandHook _makeAuthRunCommandHook();
const HostAndPort _peer;
diff --git a/src/mongo/client/authenticate.cpp b/src/mongo/client/authenticate.cpp
index 26df7c56d0c..254227b9a46 100644
--- a/src/mongo/client/authenticate.cpp
+++ b/src/mongo/client/authenticate.cpp
@@ -213,7 +213,7 @@ Future<std::string> negotiateSaslMechanism(RunCommandHook runCommand,
}
BSONObjBuilder builder;
- builder.append("ismaster", 1);
+ builder.append("hello", 1);
builder.append("saslSupportedMechs", username.getUnambiguousName());
if (stepDownBehavior == StepDownBehavior::kKeepConnectionOpen) {
builder.append("hangUpOnStepDown", false);
@@ -297,11 +297,12 @@ StringData getSaslCommandUserFieldName() {
namespace {
-StatusWith<std::shared_ptr<SaslClientSession>> _speculateSaslStart(BSONObjBuilder* isMaster,
- const std::string& mechanism,
- const HostAndPort& host,
- StringData authDB,
- BSONObj params) {
+StatusWith<std::shared_ptr<SaslClientSession>> _speculateSaslStart(
+ BSONObjBuilder* helloRequestBuilder,
+ const std::string& mechanism,
+ const HostAndPort& host,
+ StringData authDB,
+ BSONObj params) {
if (mechanism == kMechanismSaslPlain) {
return {ErrorCodes::BadValue, "PLAIN mechanism not supported with speculativeSaslStart"};
}
@@ -323,13 +324,13 @@ StatusWith<std::shared_ptr<SaslClientSession>> _speculateSaslStart(BSONObjBuilde
saslStart.append("mechanism", mechanism);
saslStart.appendBinData("payload", int(payload.size()), BinDataGeneral, payload.c_str());
saslStart.append("db", authDB);
- isMaster->append(kSpeculativeAuthenticate, saslStart.obj());
+ helloRequestBuilder->append(kSpeculativeAuthenticate, saslStart.obj());
return session;
}
StatusWith<SpeculativeAuthType> _speculateAuth(
- BSONObjBuilder* isMaster,
+ BSONObjBuilder* helloRequestBuilder,
const std::string& mechanism,
const HostAndPort& host,
StringData authDB,
@@ -337,17 +338,18 @@ StatusWith<SpeculativeAuthType> _speculateAuth(
std::shared_ptr<SaslClientSession>* saslClientSession) {
if (mechanism == kMechanismMongoX509) {
// MONGODB-X509
- isMaster->append(kSpeculativeAuthenticate,
- BSON(kAuthenticateCommand << "1" << saslCommandMechanismFieldName
- << mechanism << saslCommandUserDBFieldName
- << "$external"));
+ helloRequestBuilder->append(kSpeculativeAuthenticate,
+ BSON(kAuthenticateCommand
+ << "1" << saslCommandMechanismFieldName << mechanism
+ << saslCommandUserDBFieldName << "$external"));
return SpeculativeAuthType::kAuthenticate;
}
// Proceed as if this is a SASL mech and we either have a password,
// or we don't need one (e.g. MONGODB-AWS).
// Failure is absolutely an option.
- auto swSaslClientSession = _speculateSaslStart(isMaster, mechanism, host, authDB, params);
+ auto swSaslClientSession =
+ _speculateSaslStart(helloRequestBuilder, mechanism, host, authDB, params);
if (!swSaslClientSession.isOK()) {
return swSaslClientSession.getStatus();
}
@@ -366,7 +368,7 @@ std::string getBSONString(BSONObj container, StringData field) {
}
} // namespace
-SpeculativeAuthType speculateAuth(BSONObjBuilder* isMasterRequest,
+SpeculativeAuthType speculateAuth(BSONObjBuilder* helloRequestBuilder,
const MongoURI& uri,
std::shared_ptr<SaslClientSession>* saslClientSession) {
auto mechanism = uri.getOption("authMechanism").get_value_or(kMechanismScramSha256.toString());
@@ -378,7 +380,7 @@ SpeculativeAuthType speculateAuth(BSONObjBuilder* isMasterRequest,
auto params = std::move(optParams.get());
- auto ret = _speculateAuth(isMasterRequest,
+ auto ret = _speculateAuth(helloRequestBuilder,
mechanism,
uri.getServers().front(),
uri.getAuthenticationDatabase(),
@@ -394,7 +396,7 @@ SpeculativeAuthType speculateAuth(BSONObjBuilder* isMasterRequest,
SpeculativeAuthType speculateInternalAuth(
const HostAndPort& remoteHost,
- BSONObjBuilder* isMasterRequest,
+ BSONObjBuilder* helloRequestBuilder,
std::shared_ptr<SaslClientSession>* saslClientSession) try {
auto params = getInternalAuthParams(0, kMechanismScramSha256.toString());
if (params.isEmpty()) {
@@ -404,8 +406,8 @@ SpeculativeAuthType speculateInternalAuth(
auto mechanism = getBSONString(params, saslCommandMechanismFieldName);
auto authDB = getBSONString(params, saslCommandUserDBFieldName);
- auto ret =
- _speculateAuth(isMasterRequest, mechanism, remoteHost, authDB, params, saslClientSession);
+ auto ret = _speculateAuth(
+ helloRequestBuilder, mechanism, remoteHost, authDB, params, saslClientSession);
if (!ret.isOK()) {
return SpeculativeAuthType::kNone;
}
diff --git a/src/mongo/client/authenticate.h b/src/mongo/client/authenticate.h
index 7b841b2ee84..1aac7719f00 100644
--- a/src/mongo/client/authenticate.h
+++ b/src/mongo/client/authenticate.h
@@ -136,7 +136,7 @@ Future<void> authenticateClient(const BSONObj& params,
* but the __system user's credentials will be filled in automatically.
*
* The "mechanismHint" parameter will force authentication with a specific mechanism
- * (e.g. SCRAM-SHA-256). If it is boost::none, then an isMaster will be called to negotiate
+ * (e.g. SCRAM-SHA-256). If it is boost::none, then a "hello" will be called to negotiate
* a SASL mechanism with the server.
*
* The "stepDownBehavior" parameter controls whether replication will kill the connection on
@@ -168,7 +168,7 @@ BSONObj buildAuthParams(StringData dbname,
StringData mechanism);
/**
- * Run an isMaster exchange to negotiate a SASL mechanism for authentication.
+ * Run a "hello" exchange to negotiate a SASL mechanism for authentication.
*/
Future<std::string> negotiateSaslMechanism(RunCommandHook runCommand,
const UserName& username,
@@ -195,19 +195,19 @@ enum class SpeculativeAuthType {
};
/**
- * Constructs a "speculativeAuthenticate" or "speculativeSaslStart"
- * payload for an isMaster request based on a given URI.
+ * Constructs a "speculativeAuthenticate" or "speculativeSaslStart" payload for an "hello" request
+ * based on a given URI.
*/
-SpeculativeAuthType speculateAuth(BSONObjBuilder* isMasterRequest,
+SpeculativeAuthType speculateAuth(BSONObjBuilder* helloRequestBuilder,
const MongoURI& uri,
std::shared_ptr<SaslClientSession>* saslClientSession);
/**
- * Constructs a "speculativeAuthenticate" or "speculativeSaslStart"
- * payload for an isMaster request using internal (intracluster) authentication.
+ * Constructs a "speculativeAuthenticate" or "speculativeSaslStart" payload for an "hello" request
+ * using internal (intracluster) authentication.
*/
SpeculativeAuthType speculateInternalAuth(const HostAndPort& remoteHost,
- BSONObjBuilder* isMasterRequest,
+ BSONObjBuilder* helloRequestBuilder,
std::shared_ptr<SaslClientSession>* saslClientSession);
} // namespace auth
diff --git a/src/mongo/client/connection_pool.cpp b/src/mongo/client/connection_pool.cpp
index 068ab4f3581..897c2dc0f13 100644
--- a/src/mongo/client/connection_pool.cpp
+++ b/src/mongo/client/connection_pool.cpp
@@ -176,8 +176,8 @@ ConnectionPool::ConnectionList::iterator ConnectionPool::acquireConnection(
false, // auto reconnect
0, // socket timeout
{}, // MongoURI
- [this, target](const executor::RemoteCommandResponse& isMasterReply) {
- return _hook->validateHost(target, BSONObj(), isMasterReply);
+ [this, target](const executor::RemoteCommandResponse& helloReply) {
+ return _hook->validateHost(target, BSONObj(), helloReply);
}));
} else {
conn.reset(new DBClientConnection());
diff --git a/src/mongo/client/connpool.cpp b/src/mongo/client/connpool.cpp
index e52bd54d102..1df0d747090 100644
--- a/src/mongo/client/connpool.cpp
+++ b/src/mongo/client/connpool.cpp
@@ -589,6 +589,7 @@ void DBConnectionPool::appendConnectionStats(executor::ConnectionPoolStats* stat
executor::ConnectionStatsPer hostStats{static_cast<size_t>(i->second.numInUse()),
static_cast<size_t>(i->second.numAvailable()),
+ 0,
static_cast<size_t>(i->second.numCreated()),
0,
0};
diff --git a/src/mongo/client/dbclient_base.cpp b/src/mongo/client/dbclient_base.cpp
index 192d3c78dd8..1f9834f7bf5 100644
--- a/src/mongo/client/dbclient_base.cpp
+++ b/src/mongo/client/dbclient_base.cpp
@@ -453,7 +453,7 @@ void DBClientBase::logout(const string& dbname, BSONObj& info) {
bool DBClientBase::isPrimary(bool& isPrimary, BSONObj* info) {
BSONObjBuilder bob;
- bob.append(_apiParameters.getVersion() ? "hello" : "ismaster", 1);
+ bob.append("hello", 1);
if (auto wireSpec = WireSpec::instance().get(); wireSpec->isInternalClient) {
WireSpec::appendInternalClientWireVersion(wireSpec->outgoing, &bob);
}
@@ -462,8 +462,7 @@ bool DBClientBase::isPrimary(bool& isPrimary, BSONObj* info) {
if (info == nullptr)
info = &o;
bool ok = runCommand("admin", bob.obj(), *info);
- isPrimary =
- info->getField(_apiParameters.getVersion() ? "isWritablePrimary" : "ismaster").trueValue();
+ isPrimary = info->getField("isWritablePrimary").trueValue();
return ok;
}
diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp
index 55202e0c907..3e52ad0a33c 100644
--- a/src/mongo/client/dbclient_connection.cpp
+++ b/src/mongo/client/dbclient_connection.cpp
@@ -96,28 +96,27 @@ StatusWith<bool> completeSpeculativeAuth(DBClientConnection* conn,
auth::SpeculativeAuthType speculativeAuthType,
std::shared_ptr<SaslClientSession> session,
const MongoURI& uri,
- BSONObj isMaster) {
- auto specAuthElem = isMaster[auth::kSpeculativeAuthenticate];
+ BSONObj helloReply) {
+ auto specAuthElem = helloReply[auth::kSpeculativeAuthenticate];
if (specAuthElem.eoo()) {
return false;
}
if (speculativeAuthType == auth::SpeculativeAuthType::kNone) {
return {ErrorCodes::BadValue,
- str::stream() << "Unexpected isMaster." << auth::kSpeculativeAuthenticate
- << " reply"};
+ str::stream() << "Unexpected hello." << auth::kSpeculativeAuthenticate << " reply"};
}
if (specAuthElem.type() != Object) {
return {ErrorCodes::BadValue,
- str::stream() << "isMaster." << auth::kSpeculativeAuthenticate
+ str::stream() << "hello." << auth::kSpeculativeAuthenticate
<< " reply must be an object"};
}
auto specAuth = specAuthElem.Obj();
if (specAuth.isEmpty()) {
return {ErrorCodes::BadValue,
- str::stream() << "isMaster." << auth::kSpeculativeAuthenticate
+ str::stream() << "hello." << auth::kSpeculativeAuthenticate
<< " reply must be a non-empty obejct"};
}
@@ -151,7 +150,7 @@ StatusWith<bool> completeSpeculativeAuth(DBClientConnection* conn,
}
/**
- * Initializes the wire version of conn, and returns the isMaster reply.
+ * Initializes the wire version of conn, and returns the "hello" reply.
*/
executor::RemoteCommandResponse initWireVersion(
DBClientConnection* conn,
@@ -162,7 +161,7 @@ executor::RemoteCommandResponse initWireVersion(
std::shared_ptr<SaslClientSession>* saslClientSession) try {
BSONObjBuilder bob;
- bob.append(conn->getApiParameters().getVersion() ? "hello" : "isMaster", 1);
+ bob.append("hello", 1);
if (uri.isHelloOk()) {
// Attach "helloOk: true" to the initial handshake to indicate that the client supports the
@@ -182,7 +181,7 @@ executor::RemoteCommandResponse initWireVersion(
}
if (getTestCommandsEnabled()) {
- // Only include the host:port of this process in the isMaster command request if test
+ // Only include the host:port of this process in the "hello" command request if test
// commands are enabled. mongobridge uses this field to identify the process opening a
// connection to it.
StringBuilder sb;
@@ -208,25 +207,24 @@ executor::RemoteCommandResponse initWireVersion(
auto result = conn->runCommand(OpMsgRequest::fromDBAndBody("admin", bob.obj()));
Date_t finish{Date_t::now()};
- BSONObj isMasterObj = result->getCommandReply().getOwned();
+ BSONObj helloObj = result->getCommandReply().getOwned();
- if (isMasterObj.hasField("minWireVersion") && isMasterObj.hasField("maxWireVersion")) {
- int minWireVersion = isMasterObj["minWireVersion"].numberInt();
- int maxWireVersion = isMasterObj["maxWireVersion"].numberInt();
+ if (helloObj.hasField("minWireVersion") && helloObj.hasField("maxWireVersion")) {
+ int minWireVersion = helloObj["minWireVersion"].numberInt();
+ int maxWireVersion = helloObj["maxWireVersion"].numberInt();
conn->setWireVersions(minWireVersion, maxWireVersion);
}
- if (isMasterObj.hasField("saslSupportedMechs") &&
- isMasterObj["saslSupportedMechs"].type() == Array) {
- auto array = isMasterObj["saslSupportedMechs"].Array();
+ if (helloObj.hasField("saslSupportedMechs") && helloObj["saslSupportedMechs"].type() == Array) {
+ auto array = helloObj["saslSupportedMechs"].Array();
for (const auto& elem : array) {
saslMechsForAuth->push_back(elem.checkAndGetStringData().toString());
}
}
- conn->getCompressorManager().clientFinish(isMasterObj);
+ conn->getCompressorManager().clientFinish(helloObj);
- return executor::RemoteCommandResponse{std::move(isMasterObj), finish - start};
+ return executor::RemoteCommandResponse{std::move(helloObj), finish - start};
} catch (...) {
return exceptionToStatus();
@@ -284,41 +282,41 @@ Status DBClientConnection::connect(const HostAndPort& serverAddress,
auto speculativeAuthType = auth::SpeculativeAuthType::kNone;
std::shared_ptr<SaslClientSession> saslClientSession;
- auto swIsMasterReply = initWireVersion(
+ auto swHelloReply = initWireVersion(
this, _applicationName, _uri, &_saslMechsForAuth, &speculativeAuthType, &saslClientSession);
- if (!swIsMasterReply.isOK()) {
+ if (!swHelloReply.isOK()) {
_markFailed(kSetFlag);
- swIsMasterReply.status.addContext(
+ swHelloReply.status.addContext(
"Connection handshake failed. Is your mongod/mongos 3.4 or older?"_sd);
- return swIsMasterReply.status;
+ return swHelloReply.status;
}
- // Ensure that the isMaster response is "ok:1".
- auto isMasterStatus = getStatusFromCommandResult(swIsMasterReply.data);
- if (!isMasterStatus.isOK()) {
- return isMasterStatus;
+ // Ensure that the "hello" response is "ok:1".
+ auto helloStatus = getStatusFromCommandResult(swHelloReply.data);
+ if (!helloStatus.isOK()) {
+ return helloStatus;
}
- auto replyWireVersion = wire_version::parseWireVersionFromHelloReply(swIsMasterReply.data);
+ auto replyWireVersion = wire_version::parseWireVersionFromHelloReply(swHelloReply.data);
if (!replyWireVersion.isOK()) {
return replyWireVersion.getStatus();
}
{
// The Server Discovery and Monitoring (SDAM) specification identifies a replica set member
- // as either (a) having a "setName" field in the isMaster response, or (b) having
- // "isreplicaset: true" in the isMaster response.
+ // as either (a) having a "setName" field in the "hello" response, or (b) having
+ // "isreplicaset: true" in the "hello" response.
//
// https://github.com/mongodb/specifications/blob/c386e23724318e2fa82f4f7663d77581b755b2c3/
// source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#type
- const bool hasSetNameField = swIsMasterReply.data.hasField("setName");
- const bool isReplicaSetField = swIsMasterReply.data.getBoolField("isreplicaset");
+ const bool hasSetNameField = swHelloReply.data.hasField("setName");
+ const bool isReplicaSetField = swHelloReply.data.getBoolField("isreplicaset");
_isReplicaSetMember = hasSetNameField || isReplicaSetField;
}
{
std::string msgField;
- auto msgFieldExtractStatus = bsonExtractStringField(swIsMasterReply.data, "msg", &msgField);
+ auto msgFieldExtractStatus = bsonExtractStringField(swHelloReply.data, "msg", &msgField);
if (msgFieldExtractStatus == ErrorCodes::NoSuchKey) {
_isMongos = false;
@@ -342,7 +340,7 @@ Status DBClientConnection::connect(const HostAndPort& serverAddress,
}
if (_hook) {
- auto validationStatus = _hook(swIsMasterReply);
+ auto validationStatus = _hook(swHelloReply);
if (!validationStatus.isOK()) {
// Disconnect and mark failed.
_markFailed(kReleaseSession);
@@ -352,7 +350,7 @@ Status DBClientConnection::connect(const HostAndPort& serverAddress,
{
auto swAuth = completeSpeculativeAuth(
- this, speculativeAuthType, saslClientSession, _uri, swIsMasterReply.data);
+ this, speculativeAuthType, saslClientSession, _uri, swHelloReply.data);
if (!swAuth.isOK()) {
return swAuth.getStatus();
}
diff --git a/src/mongo/client/dbclient_connection.h b/src/mongo/client/dbclient_connection.h
index 9187852758d..02465fa8387 100644
--- a/src/mongo/client/dbclient_connection.h
+++ b/src/mongo/client/dbclient_connection.h
@@ -76,13 +76,13 @@ class DBClientCursorBatchIterator;
class DBClientConnection : public DBClientBase {
public:
/**
- * A hook used to validate the reply of an 'isMaster' command during connection. If the hook
+ * A hook used to validate the reply of a "hello" command during connection. If the hook
* returns a non-OK Status, the DBClientConnection object will disconnect from the remote
* server. This function must not throw - it can only indicate failure by returning a non-OK
* status.
*/
using HandshakeValidationHook =
- std::function<Status(const executor::RemoteCommandResponse& isMasterReply)>;
+ std::function<Status(const executor::RemoteCommandResponse& helloReply)>;
/**
@param _autoReconnect if true, automatically reconnect on a connection failure
@@ -125,8 +125,8 @@ public:
boost::optional<TransientSSLParams> transientSSLParams);
/**
- * This version of connect does not run 'isMaster' after creating a TCP connection to the
- * remote host. This method should be used only when calling 'isMaster' would create a deadlock,
+ * This version of connect does not run "hello" after creating a TCP connection to the
+ * remote host. This method should be used only when calling "hello" would create a deadlock,
* such as in 'isSelf'.
*
* @param server The server to connect to.
diff --git a/src/mongo/client/dbclient_cursor.h b/src/mongo/client/dbclient_cursor.h
index ad8eba20d77..c7a070f4f31 100644
--- a/src/mongo/client/dbclient_cursor.h
+++ b/src/mongo/client/dbclient_cursor.h
@@ -176,6 +176,10 @@ public:
return tailable() && (_opts & QueryOption_AwaitData);
}
+ bool isExhaust() const {
+ return (_opts & QueryOption_Exhaust) != 0;
+ }
+
/**
* Changes the cursor's batchSize after construction. Can change after requesting first batch.
*/
diff --git a/src/mongo/client/replica_set_monitor_integration_test.cpp b/src/mongo/client/replica_set_monitor_integration_test.cpp
index 383411d0d61..90687af4d13 100644
--- a/src/mongo/client/replica_set_monitor_integration_test.cpp
+++ b/src/mongo/client/replica_set_monitor_integration_test.cpp
@@ -157,7 +157,6 @@ protected:
TEST_F(ReplicaSetMonitorFixture, StreamableRSMWireVersion) {
auto rsm = ReplicaSetMonitorManager::get()->getOrCreateMonitor(replSetUri, nullptr);
- // Schedule isMaster requests and wait for the responses.
auto primaryFuture =
rsm->getHostOrRefresh(ReadPreferenceSetting(mongo::ReadPreference::PrimaryOnly),
CancellationToken::uncancelable());
diff --git a/src/mongo/client/replica_set_monitor_manager.cpp b/src/mongo/client/replica_set_monitor_manager.cpp
index 52db50f277c..5fe13f2be81 100644
--- a/src/mongo/client/replica_set_monitor_manager.cpp
+++ b/src/mongo/client/replica_set_monitor_manager.cpp
@@ -72,8 +72,8 @@ const auto getGlobalRSMMonitorManager =
Status ReplicaSetMonitorManagerNetworkConnectionHook::validateHost(
const HostAndPort& remoteHost,
- const BSONObj& isMasterRequest,
- const executor::RemoteCommandResponse& isMasterReply) {
+ const BSONObj& helloRequest,
+ const executor::RemoteCommandResponse& helloReply) {
auto monitor = ReplicaSetMonitorManager::get()->getMonitorForHost(remoteHost);
if (!monitor) {
return Status::OK();
@@ -85,19 +85,19 @@ Status ReplicaSetMonitorManagerNetworkConnectionHook::validateHost(
auto publisher = streamableMonitor->getEventsPublisher();
if (publisher) {
try {
- if (isMasterReply.status.isOK()) {
+ if (helloReply.status.isOK()) {
publisher->onServerHandshakeCompleteEvent(
- *isMasterReply.elapsed, remoteHost, isMasterReply.data);
+ *helloReply.elapsed, remoteHost, helloReply.data);
} else {
publisher->onServerHandshakeFailedEvent(
- remoteHost, isMasterReply.status, isMasterReply.data);
+ remoteHost, helloReply.status, helloReply.data);
}
} catch (const DBException& exception) {
LOGV2_ERROR(4712101,
"An error occurred publishing a ReplicaSetMonitor handshake event",
"error"_attr = exception.toStatus(),
"replicaSet"_attr = monitor->getName(),
- "handshakeStatus"_attr = isMasterReply.status);
+ "handshakeStatus"_attr = helloReply.status);
return exception.toStatus();
}
}
diff --git a/src/mongo/client/replica_set_monitor_manager.h b/src/mongo/client/replica_set_monitor_manager.h
index 2e26ba87769..59c9b0b9853 100644
--- a/src/mongo/client/replica_set_monitor_manager.h
+++ b/src/mongo/client/replica_set_monitor_manager.h
@@ -56,8 +56,8 @@ public:
virtual ~ReplicaSetMonitorManagerNetworkConnectionHook() = default;
Status validateHost(const HostAndPort& remoteHost,
- const BSONObj& isMasterRequest,
- const executor::RemoteCommandResponse& isMasterReply) override;
+ const BSONObj& helloRequest,
+ const executor::RemoteCommandResponse& helloReply) override;
StatusWith<boost::optional<executor::RemoteCommandRequest>> makeRequest(
const HostAndPort& remoteHost) override;
diff --git a/src/mongo/client/replica_set_monitor_server_parameters.idl b/src/mongo/client/replica_set_monitor_server_parameters.idl
index c1cf9f3322a..6baf9ee6253 100644
--- a/src/mongo/client/replica_set_monitor_server_parameters.idl
+++ b/src/mongo/client/replica_set_monitor_server_parameters.idl
@@ -32,7 +32,7 @@ server_parameters:
replicaSetMonitorProtocol:
description: >-
Select which replica set monitor protocol to use - the new 'streamable' protocol that is
- both SDAM compliant and allows for awaitable isMaster with exhaust, the 'sdam' compliant
+ both SDAM compliant and allows for awaitable "hello" with exhaust, the 'sdam' compliant
protocol or the old 'scanning' protocol.
set_at: startup
cpp_class:
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/README.rst b/src/mongo/client/sdam/json_tests/sdam_tests/README.rst
index f8bd43f8d4d..3bc0127f057 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/README.rst
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/README.rst
@@ -35,12 +35,12 @@ Each phase object has two keys:
A response is a pair of values:
- The source, for example "a:27017".
- This is the address the client sent the "ismaster" command to.
-- An ismaster response, for example `{ok: 1, ismaster: true}`.
+ This is the address the client sent the "hello" command to.
+- A "hello" response, for example `{ok: 1, isWritablePrimary: true}`.
If the response includes an electionId it is shown in extended JSON like
`{"$oid": "000000000000000000000002"}`.
The empty response `{}` indicates a network error
- when attempting to call "ismaster".
+ when attempting to call "hello".
In non-monitoring tests, an "outcome" represents the correct
TopologyDescription that results from processing the responses in the phases
@@ -67,10 +67,10 @@ current TopologyDescription. It has the following keys:
- maxWireVersion: absent or an integer.
In monitoring tests, an "outcome" contains a list of SDAM events that should
-have been published by the client as a result of processing ismaster responses
+have been published by the client as a result of processing "hello" responses
in the current phase. Any SDAM events published by the client during its
construction (that is, prior to processing any of the responses) should be
-combined with the events published during processing of ismaster responses
+combined with the events published during processing of "hello" responses
of the first phase of the test. A test MAY explicitly verify events published
during client construction by providing an empty responses array for the
first phase.
@@ -83,7 +83,7 @@ Mocking
~~~~~~~
Drivers should be able to test their server discovery and monitoring logic
-without any network I/O, by parsing ismaster responses from the test file
+without any network I/O, by parsing "hello" responses from the test file
and passing them into the driver code. Parts of the client and monitoring
code may need to be mocked or subclassed to achieve this. `A reference
implementation for PyMongo 3.x is available here
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/compatible.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/compatible.json
index 0e2c68bf1f7..2ff33116a40 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/compatible.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/compatible.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
@@ -26,7 +26,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/compatible_unknown.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/compatible_unknown.json
index 878c1d8df54..3ad398be5c4 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/compatible_unknown.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/compatible_unknown.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_arbiters.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_arbiters.json
index 98d72b5ccbe..f7931d6f484 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_arbiters.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_arbiters.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_passives.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_passives.json
index 5ee3b27478d..58bc42e6b2f 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_passives.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_passives.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
@@ -47,7 +47,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"passive": true,
"hosts": [
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_primary.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_primary.json
index a8ff093cb8e..fe8464aad52 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_primary.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_primary.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_secondary.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_secondary.json
index 7210b3845c7..473ae8fd0e8 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_secondary.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discover_secondary.json
@@ -8,7 +8,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discovery.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discovery.json
index f464134f12e..7d8a3777c23 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discovery.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discovery.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
@@ -47,7 +47,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"primary": "d:27017",
@@ -91,7 +91,7 @@
"d:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"b:27017",
@@ -138,7 +138,7 @@
"c:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discovery.json.notused b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discovery.json.notused
index 57ed568e3b0..4a489f68ab5 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/discovery.json.notused
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/discovery.json.notused
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
@@ -47,7 +47,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"primary": "d:27017",
@@ -91,7 +91,7 @@
"d:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"b:27017",
@@ -134,7 +134,7 @@
"c:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/equal_electionids.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/equal_electionids.json
index f8d20b350df..0e8efc46cf7 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/equal_electionids.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/equal_electionids.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -26,7 +26,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/ghost_discovered.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/ghost_discovered.json
index bf22cbb0eb5..994b69cece6 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/ghost_discovered.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/ghost_discovered.json
@@ -8,7 +8,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"isreplicaset": true,
"minWireVersion": 0,
"maxWireVersion": 6
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/hosts_differ_from_seeds.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/hosts_differ_from_seeds.json
index 4f2351cf05c..2d5b577cd67 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/hosts_differ_from_seeds.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/hosts_differ_from_seeds.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"b:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_arbiter.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_arbiter.json
index 1d59b967c40..2aae7c37fe7 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_arbiter.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_arbiter.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_ghost.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_ghost.json
index 193eea0c767..589671a1a75 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_ghost.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_ghost.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_other.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_other.json
index 93ba88e6617..dd485e0113b 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_other.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/incompatible_other.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/ls_timeout.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/ls_timeout.json
index 0b0c2c6a885..963f8801a54 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/ls_timeout.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/ls_timeout.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017",
@@ -57,7 +57,7 @@
"d:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"isreplicaset": true,
"setVersion": 1,
"electionId": {
@@ -98,7 +98,7 @@
"e:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"hosts": [
"a:27017",
"b:27017",
@@ -144,7 +144,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"hosts": [
"a:27017",
@@ -192,7 +192,7 @@
"c:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"setName": "rs",
"hidden": true,
"logicalSessionTimeoutMinutes": 1,
@@ -234,7 +234,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/member_reconfig.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/member_reconfig.json
index 9f970baccea..f815374842d 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/member_reconfig.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/member_reconfig.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
@@ -45,7 +45,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/member_standalone.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/member_standalone.json
index bcd95719342..cb2eaec426c 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/member_standalone.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/member_standalone.json
@@ -8,7 +8,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setVersion": 1,
"electionId": {
"$oid": "000000000000000000000001"
@@ -40,7 +40,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary.json
index d22450decc7..600dba83d3e 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
@@ -45,7 +45,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_new_electionid.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_new_electionid.json
index 67f314b1edc..6c88dc2399f 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_new_electionid.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_new_electionid.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -54,7 +54,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -100,7 +100,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_new_setversion.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_new_setversion.json
index c1ec50c845c..cebdf9ab4e2 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_new_setversion.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_new_setversion.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -54,7 +54,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -100,7 +100,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_wrong_set_name.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_wrong_set_name.json
index 9940b47b6e4..39977609075 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_wrong_set_name.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/new_primary_wrong_set_name.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -45,7 +45,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/normalize_case.json.disabled b/src/mongo/client/sdam/json_tests/sdam_tests/rs/normalize_case.json.disabled
index 4d0b0ae629b..6cfd75168fc 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/normalize_case.json.disabled
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/normalize_case.json.disabled
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"A:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/normalize_case_me.json.disabled b/src/mongo/client/sdam/json_tests/sdam_tests/rs/normalize_case_me.json.disabled
index e854e7fb432..c89522275c1 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/normalize_case_me.json.disabled
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/normalize_case_me.json.disabled
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"me": "A:27017",
"hosts": [
@@ -51,7 +51,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"me": "B:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/null_election_id.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/null_election_id.json
index 3d6f7655576..0f03c0b6c7f 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/null_election_id.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/null_election_id.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017",
@@ -52,7 +52,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017",
@@ -104,7 +104,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017",
@@ -154,7 +154,7 @@
"c:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_ghost.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_ghost.json
index 6ff0ecc0b06..881b6cf07a2 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_ghost.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_ghost.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
@@ -40,7 +40,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"isreplicaset": true,
"minWireVersion": 0,
"maxWireVersion": 6
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_mongos.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_mongos.json
index 92acf6cca2f..18b3e3e4427 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_mongos.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_mongos.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
@@ -40,7 +40,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"setVersion": 1,
"electionId": {
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_standalone.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_standalone.json
index 3e7144057ca..9bb846dcd6a 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_standalone.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_becomes_standalone.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_changes_set_name.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_changes_set_name.json
index 366df6e3500..247cab35cc4 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_changes_set_name.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_changes_set_name.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
@@ -40,7 +40,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect.json
index 67c95de6b14..627518d4c88 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect_electionid.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect_electionid.json
index 59c8faf1805..a374e3e4fbb 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect_electionid.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect_electionid.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -26,7 +26,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -101,7 +101,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -144,7 +144,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -190,7 +190,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect_setversion.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect_setversion.json
index beb023e4f41..f1e2c0097c1 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect_setversion.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_disconnect_setversion.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -26,7 +26,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -101,7 +101,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -144,7 +144,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -190,7 +190,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_hint_from_secondary_with_mismatched_me.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_hint_from_secondary_with_mismatched_me.json
index bad86c8175d..d516af6f715 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_hint_from_secondary_with_mismatched_me.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_hint_from_secondary_with_mismatched_me.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"me": "c:27017",
"hosts": [
@@ -39,7 +39,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"me": "b:27017",
"hosts": [
"b:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_mismatched_me.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_mismatched_me.json
index 381edc7e4b1..5259d2398e6 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_mismatched_me.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_mismatched_me.json
@@ -26,7 +26,7 @@
"a:27017",
"b:27017"
],
- "ismaster": true,
+ "isWritablePrimary": true,
"ok": 1,
"setName": "rs",
"setVersion": 1,
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_reports_new_member.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_reports_new_member.json
index 4595bb93a78..65eedff59bd 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_reports_new_member.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_reports_new_member.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
@@ -42,7 +42,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
@@ -79,7 +79,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
@@ -121,7 +121,7 @@
"c:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"primary": "b:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_to_no_primary_mismatched_me.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_to_no_primary_mismatched_me.json
index ade818740ac..e28a7211bb4 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_to_no_primary_mismatched_me.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_to_no_primary_mismatched_me.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -46,7 +46,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"c:27017",
"d:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_wrong_set_name.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_wrong_set_name.json
index c656ebf35d6..2bb9523b9f5 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_wrong_set_name.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/primary_wrong_set_name.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/response_from_removed.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/response_from_removed.json
index 36e5d1e44f2..e0cb697d519 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/response_from_removed.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/response_from_removed.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017"
@@ -40,7 +40,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/rsother_discovered.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/rsother_discovered.json
index c575501d803..2c90cdc7172 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/rsother_discovered.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/rsother_discovered.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"hidden": true,
"hosts": [
@@ -24,7 +24,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": false,
"hosts": [
"c:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/sec_not_auth.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/sec_not_auth.json
index 28fc85fc494..99c3aa6622e 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/sec_not_auth.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/sec_not_auth.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
@@ -26,7 +26,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_ignore_ok_0.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_ignore_ok_0.json
index 4867b07844e..133aafdc406 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_ignore_ok_0.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_ignore_ok_0.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
@@ -26,7 +26,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_mismatched_me.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_mismatched_me.json
index d2a70f67889..7df79c73c01 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_mismatched_me.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_mismatched_me.json
@@ -26,7 +26,7 @@
"a:27017",
"b:27017"
],
- "ismaster": false,
+ "isWritablePrimary": false,
"ok": 1,
"setName": "rs",
"minWireVersion": 0,
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_wrong_set_name.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_wrong_set_name.json
index 4c132b633e1..be621c06c83 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_wrong_set_name.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_wrong_set_name.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"hosts": [
"a:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_wrong_set_name_with_primary.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_wrong_set_name_with_primary.json
index 0bca723e5c3..3e7b1f83ed9 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_wrong_set_name_with_primary.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/secondary_wrong_set_name_with_primary.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -45,7 +45,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/set_version_can_rollback.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/set_version_can_rollback.json
index d3fa9acb3c2..d90e097de75 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/set_version_can_rollback.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/set_version_can_rollback.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -55,7 +55,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -102,7 +102,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/setversion_without_electionid.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/setversion_without_electionid.json
index 07ec55cee1c..c5c8107d0af 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/setversion_without_electionid.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/setversion_without_electionid.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -46,7 +46,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/stepdown_change_set_name.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/stepdown_change_set_name.json
index fcf35ce5041..ca6b0e77b45 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/stepdown_change_set_name.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/stepdown_change_set_name.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017"
],
@@ -40,7 +40,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"hosts": [
"a:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/too_new.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/too_new.json
index 299b6fa9aab..f2b65b843be 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/too_new.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/too_new.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
@@ -26,7 +26,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/too_old.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/too_old.json
index e1ad154ba69..0056594f943 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/too_old.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/too_old.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"setName": "rs",
"hosts": [
"a:27017",
@@ -26,7 +26,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"setName": "rs",
"hosts": [
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/unexpected_mongos.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/unexpected_mongos.json
index b9440de5805..b89547959d6 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/unexpected_mongos.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/unexpected_mongos.json
@@ -8,7 +8,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"setVersion": 1,
"electionId": {
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/use_setversion_without_electionid.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/use_setversion_without_electionid.json
index 365af2f7e19..63635c9c419 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/use_setversion_without_electionid.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/use_setversion_without_electionid.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -54,7 +54,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
@@ -97,7 +97,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/rs/wrong_set_name.json b/src/mongo/client/sdam/json_tests/sdam_tests/rs/wrong_set_name.json
index 45be2f502b2..cc4e3e963ce 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/rs/wrong_set_name.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/rs/wrong_set_name.json
@@ -8,7 +8,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"hosts": [
"b:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/compatible.json b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/compatible.json
index 3dae1f7ea1e..3f6df3e09e5 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/compatible.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/compatible.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 0,
"maxWireVersion": 1000
@@ -18,7 +18,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 0,
"maxWireVersion": 6
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/ls_timeout_mongos.json b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/ls_timeout_mongos.json
index 96f8dec17ac..7a46adee517 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/ls_timeout_mongos.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/ls_timeout_mongos.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"logicalSessionTimeoutMinutes": 1,
"minWireVersion": 0,
@@ -19,7 +19,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"logicalSessionTimeoutMinutes": 2,
"minWireVersion": 0,
@@ -49,7 +49,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"logicalSessionTimeoutMinutes": 1,
"minWireVersion": 0,
@@ -60,7 +60,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 0,
"maxWireVersion": 6
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/mongos_disconnect.json b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/mongos_disconnect.json
index 04015694a8d..f0f98648a78 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/mongos_disconnect.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/mongos_disconnect.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 0,
"maxWireVersion": 6
@@ -18,7 +18,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 0,
"maxWireVersion": 6
@@ -70,7 +70,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 0,
"maxWireVersion": 6
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/multiple_mongoses.json b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/multiple_mongoses.json
index 6e60fd05c7d..75398360994 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/multiple_mongoses.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/multiple_mongoses.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 0,
"maxWireVersion": 6
@@ -18,7 +18,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 0,
"maxWireVersion": 6
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/non_mongos_removed.json b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/non_mongos_removed.json
index 7bf039d9bc8..553c8debf74 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/non_mongos_removed.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/non_mongos_removed.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 0,
"maxWireVersion": 6
@@ -18,7 +18,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"b:27017"
],
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/too_new.json b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/too_new.json
index 9521e117899..b4f9f149516 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/too_new.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/too_new.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 999,
"maxWireVersion": 1000
@@ -18,7 +18,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid"
}
]
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/too_old.json b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/too_old.json
index 6bd187f61db..41ffed925d2 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/sharded/too_old.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/sharded/too_old.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 2,
"maxWireVersion": 6
@@ -18,7 +18,7 @@
"b:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid"
}
]
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/compatible.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/compatible.json
index ee6b847ade7..9c91ae1db1b 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/compatible.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/compatible.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"minWireVersion": 0,
"maxWireVersion": 6
}
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_external_ip.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_external_ip.json
index 44581501862..f0b2cfe0a48 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_external_ip.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_external_ip.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"b:27017"
],
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_mongos.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_mongos.json
index a7fa0794901..d1ec4ad53b5 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_mongos.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_mongos.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"msg": "isdbgrid",
"minWireVersion": 0,
"maxWireVersion": 6
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rsarbiter.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rsarbiter.json
index 3ef374d6f1e..461a032ac0c 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rsarbiter.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rsarbiter.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"arbiterOnly": true,
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rsprimary.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rsprimary.json
index bd5aaf7f044..10d0b5452aa 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rsprimary.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rsprimary.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"hosts": [
"a:27017",
"b:27017"
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rssecondary.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rssecondary.json
index 3b4f3c8c5ad..48595ac4d73 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rssecondary.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_rssecondary.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"secondary": true,
"hosts": [
"a:27017",
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_slave.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_slave.json
index a40debd1838..37bfa86fcf9 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_slave.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_slave.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": false,
+ "isWritablePrimary": false,
"minWireVersion": 0,
"maxWireVersion": 6
}
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_standalone.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_standalone.json
index 2ecff9b9ae2..373d4ebc9a9 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_standalone.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/direct_connection_standalone.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"minWireVersion": 0,
"maxWireVersion": 6
}
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/ls_timeout_standalone.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/ls_timeout_standalone.json
index ae6c8ba11be..e48f6151f98 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/ls_timeout_standalone.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/ls_timeout_standalone.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"logicalSessionTimeoutMinutes": 7,
"minWireVersion": 0,
"maxWireVersion": 6
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/not_ok_response.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/not_ok_response.json
index 06f71305dc0..c27ed1d9c4a 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/not_ok_response.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/not_ok_response.json
@@ -1,5 +1,5 @@
{
- "description": "Handle a not-ok ismaster response",
+ "description": "Handle a not-ok isWritablePrimary response",
"uri": "mongodb://a",
"phases": [
{
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"minWireVersion": 0,
"maxWireVersion": 6
}
@@ -17,7 +17,7 @@
"a:27017",
{
"ok": 0,
- "ismaster": true,
+ "isWritablePrimary": true,
"minWireVersion": 0,
"maxWireVersion": 6
}
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/standalone_removed.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/standalone_removed.json
index be1a73d30b8..de6ffaa84dc 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/standalone_removed.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/standalone_removed.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"minWireVersion": 0,
"maxWireVersion": 6
}
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/too_new.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/too_new.json
index 38e4621d60f..5320c4a2613 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/too_new.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/too_new.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true,
+ "isWritablePrimary": true,
"minWireVersion": 999,
"maxWireVersion": 1000
}
diff --git a/src/mongo/client/sdam/json_tests/sdam_tests/single/too_old.json b/src/mongo/client/sdam/json_tests/sdam_tests/single/too_old.json
index fbf68262c02..55ef82acb71 100644
--- a/src/mongo/client/sdam/json_tests/sdam_tests/single/too_old.json
+++ b/src/mongo/client/sdam/json_tests/sdam_tests/single/too_old.json
@@ -8,7 +8,7 @@
"a:27017",
{
"ok": 1,
- "ismaster": true
+ "isWritablePrimary": true
}
]
],
diff --git a/src/mongo/client/sdam/sdam_configuration.h b/src/mongo/client/sdam/sdam_configuration.h
index f1b1122936c..2a34b860ea7 100644
--- a/src/mongo/client/sdam/sdam_configuration.h
+++ b/src/mongo/client/sdam/sdam_configuration.h
@@ -90,7 +90,7 @@ public:
const boost::optional<std::string>& getSetName() const;
/**
- * The frequency at which we measure RTT and IsMaster responses.
+ * The frequency at which we measure RTT and "hello" responses.
*/
Milliseconds getHeartBeatFrequency() const;
diff --git a/src/mongo/client/sdam/sdam_configuration_parameters.idl b/src/mongo/client/sdam/sdam_configuration_parameters.idl
index f36a6d9144b..851cfa307d3 100644
--- a/src/mongo/client/sdam/sdam_configuration_parameters.idl
+++ b/src/mongo/client/sdam/sdam_configuration_parameters.idl
@@ -32,7 +32,9 @@ global:
server_parameters:
heartBeatFrequencyMs:
- description: For the 'sdam' replicaSetMonitorProtocol, determines how long to wait between isMaster requests. For the 'streamable' replicaSetMonitorProtocol, duration between rtt measurements.
+ description: "For the 'sdam' replicaSetMonitorProtocol, determines how long to wait between
+ 'hello' requests. For the 'streamable' replicaSetMonitorProtocol, duration between rtt
+ measurements."
set_at: startup
cpp_vartype: int
cpp_varname: sdamHeartBeatFrequencyMs
diff --git a/src/mongo/client/sdam/sdam_json_test_runner.cpp b/src/mongo/client/sdam/sdam_json_test_runner.cpp
index b3fdcba09f0..431d281a8f7 100644
--- a/src/mongo/client/sdam/sdam_json_test_runner.cpp
+++ b/src/mongo/client/sdam/sdam_json_test_runner.cpp
@@ -82,13 +82,13 @@ public:
for (auto& response : bsonResponses) {
const auto pair = response.Array();
const auto address = HostAndPort(pair[0].String());
- const auto bsonIsMaster = pair[1].Obj();
+ const auto bsonHello = pair[1].Obj();
- if (bsonIsMaster.nFields() == 0) {
- _isMasterResponses.push_back(HelloOutcome(address, BSONObj(), "network error"));
+ if (bsonHello.nFields() == 0) {
+ _helloResponses.push_back(HelloOutcome(address, BSONObj(), "network error"));
} else {
- _isMasterResponses.push_back(
- HelloOutcome(address, bsonIsMaster, duration_cast<HelloRTT>(kLatency)));
+ _helloResponses.push_back(
+ HelloOutcome(address, bsonHello, duration_cast<HelloRTT>(kLatency)));
}
}
_topologyOutcome = phase["outcome"].Obj();
@@ -109,7 +109,7 @@ public:
PhaseResult execute(TopologyManager& topology) const {
PhaseResult testResult{{}, _phaseNum};
- for (auto response : _isMasterResponses) {
+ for (auto response : _helloResponses) {
auto descriptionStr =
(response.getResponse()) ? response.getResponse()->toString() : "[ Network Error ]";
LOGV2(20202,
@@ -418,7 +418,7 @@ private:
MongoURI _testUri;
int _phaseNum;
- std::vector<HelloOutcome> _isMasterResponses;
+ std::vector<HelloOutcome> _helloResponses;
BSONObj _topologyOutcome;
};
diff --git a/src/mongo/client/sdam/server_description.cpp b/src/mongo/client/sdam/server_description.cpp
index babe5d1a777..a3e8b7f0899 100644
--- a/src/mongo/client/sdam/server_description.cpp
+++ b/src/mongo/client/sdam/server_description.cpp
@@ -209,7 +209,7 @@ void ServerDescription::parseTypeFromHelloReply(const BSONObj helloReply) {
t = ServerType::kMongos;
} else if (hasSetName && helloReply.getBoolField("hidden")) {
t = ServerType::kRSOther;
- } else if (hasSetName && helloReply.getBoolField("ismaster")) {
+ } else if (hasSetName && helloReply.getBoolField("isWritablePrimary")) {
t = ServerType::kRSPrimary;
} else if (hasSetName && helloReply.getBoolField("secondary")) {
t = ServerType::kRSSecondary;
diff --git a/src/mongo/client/sdam/server_description_test.cpp b/src/mongo/client/sdam/server_description_test.cpp
index b4cbc940c28..9ca83dd1c63 100644
--- a/src/mongo/client/sdam/server_description_test.cpp
+++ b/src/mongo/client/sdam/server_description_test.cpp
@@ -241,7 +241,7 @@ protected:
static inline const auto kBsonMissingOk = BSONObjBuilder().obj();
static inline const auto kBsonMongos = okBuilder().append("msg", "isdbgrid").obj();
static inline const auto kBsonRsPrimary =
- okBuilder().append("ismaster", true).append("setName", "foo").obj();
+ okBuilder().append("isWritablePrimary", true).append("setName", "foo").obj();
static inline const auto kBsonRsSecondary =
okBuilder().append("secondary", true).append("setName", "foo").obj();
static inline const auto kBsonRsArbiter =
@@ -289,7 +289,7 @@ protected:
okBuilder().append("topologyVersion", TopologyVersion(OID::max(), 0).toBSON()).obj();
};
-TEST_F(ServerDescriptionTestFixture, ShouldParseTypeAsUnknownForIsMasterError) {
+TEST_F(ServerDescriptionTestFixture, ShouldParseTypeAsUnknownForHelloError) {
auto response = HelloOutcome(HostAndPort("foo:1234"), kTopologyVersion, "an error occurred");
auto description = ServerDescription(clockSource, response);
ASSERT_EQUALS(ServerType::kUnknown, description.getType());
@@ -316,7 +316,7 @@ TEST_F(ServerDescriptionTestFixture, ShouldParseTypeAsMongos) {
}
TEST_F(ServerDescriptionTestFixture, ShouldParseTypeAsRSPrimary) {
- // "ismaster: true", "setName" in response
+ // "isWritablePrimary: true", "setName" in response
auto response = HelloOutcome(HostAndPort("foo:1234"), kBsonRsPrimary, HelloRTT::min());
auto description = ServerDescription(clockSource, response);
ASSERT_EQUALS(ServerType::kRSPrimary, description.getType());
diff --git a/src/mongo/client/sdam/server_selection_json_test_runner.cpp b/src/mongo/client/sdam/server_selection_json_test_runner.cpp
index 5da205b53e1..051cc4d9d8e 100644
--- a/src/mongo/client/sdam/server_selection_json_test_runner.cpp
+++ b/src/mongo/client/sdam/server_selection_json_test_runner.cpp
@@ -130,7 +130,7 @@ public:
HelloOutcome(HostAndPort("dummy"),
BSON("ok" << 1 << "setname"
<< "replSet"
- << "ismaster" << true),
+ << "isWritablePrimary" << true),
HelloRTT(Milliseconds(_newRtt)))));
}
diff --git a/src/mongo/client/sdam/server_selector.cpp b/src/mongo/client/sdam/server_selector.cpp
index 5dd58d95684..76d08324f03 100644
--- a/src/mongo/client/sdam/server_selector.cpp
+++ b/src/mongo/client/sdam/server_selector.cpp
@@ -230,35 +230,40 @@ bool SdamServerSelector::_containsAllTags(ServerDescriptionPtr server, const BSO
void SdamServerSelector::filterTags(std::vector<ServerDescriptionPtr>* servers,
const TagSet& tagSet) {
- const auto& checkTags = tagSet.getTagBSON();
+ const auto& tagSetList = tagSet.getTagBSON();
- if (checkTags.nFields() == 0)
+ if (tagSetList.isEmpty()) {
return;
+ }
- const auto predicate = [&](const ServerDescriptionPtr& s) {
- auto it = checkTags.begin();
- while (it != checkTags.end()) {
- if (it->isABSONObj()) {
- const BSONObj& tags = it->Obj();
- if (_containsAllTags(s, tags)) {
- // found a match -- don't remove the server
- return false;
- }
- } else {
- LOGV2_WARNING(
- 4671202,
- "Invalid tags specified for server selection; tags should be specified as "
- "bson Objects",
- "tag"_attr = *it);
- }
- ++it;
+ for (const auto& tagSetElem : tagSetList) {
+ if (tagSetElem.type() != BSONType::Object) {
+ LOGV2_WARNING(4671202,
+ "Invalid tag set specified for server selection; tag sets should be"
+ " specified as a BSON object",
+ "tag"_attr = tagSetElem);
+ continue;
}
- // remove the server
- return true;
- };
+ const auto predicate = [&](const ServerDescriptionPtr& s) {
+ const bool shouldRemove = !_containsAllTags(s, tagSetElem.embeddedObject());
+ return shouldRemove;
+ };
+
+ auto it = std::remove_if(servers->begin(), servers->end(), predicate);
+ // If none of the server descriptions match the tag set, then continue on to check the next
+ // tag set in the list. Otherwise, if at least one of the server descriptions match the tag
+ // set criteria, then we've found our preferred host(s) to read from.
+ if (it != servers->begin()) {
+ servers->erase(it, servers->end());
+ return;
+ }
+ }
- servers->erase(std::remove_if(servers->begin(), servers->end(), predicate), servers->end());
+ // Getting here means a non-empty tag set list was specified but none of the server descriptions
+ // matched any of the tag sets in the list. We've therefore failed to find any server
+ // description matching the read preference tag criteria.
+ servers->clear();
}
bool SdamServerSelector::recencyFilter(const ReadPreferenceSetting& readPref,
diff --git a/src/mongo/client/sdam/server_selector_test.cpp b/src/mongo/client/sdam/server_selector_test.cpp
index f9d67676e2c..7d2a3ee79a3 100644
--- a/src/mongo/client/sdam/server_selector_test.cpp
+++ b/src/mongo/client/sdam/server_selector_test.cpp
@@ -656,7 +656,9 @@ TEST_F(ServerSelectorTestFixture, ShouldFilterByTags) {
tags = TagSets::eastOrWestProductionSet;
servers = makeServerDescriptionList();
selector.filterTags(&servers, tags);
- ASSERT_EQ(2, servers.size());
+ ASSERT_EQ(1, servers.size());
+ ASSERT((std::map<std::string, std::string>{{"dc", "east"}, {"usage", "production"}}) ==
+ servers[0]->getTags());
tags = TagSets::testSet;
servers = makeServerDescriptionList();
diff --git a/src/mongo/client/sdam/topology_listener_mock.cpp b/src/mongo/client/sdam/topology_listener_mock.cpp
index fb306d9158d..d6cd0ceb6c8 100644
--- a/src/mongo/client/sdam/topology_listener_mock.cpp
+++ b/src/mongo/client/sdam/topology_listener_mock.cpp
@@ -35,11 +35,11 @@ namespace mongo::sdam {
void TopologyListenerMock::onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort,
const BSONObj reply) {
stdx::lock_guard lk(_mutex);
- auto it = _serverIsMasterReplies.find(hostAndPort);
- if (it != _serverIsMasterReplies.end()) {
+ auto it = _serverHelloReplies.find(hostAndPort);
+ if (it != _serverHelloReplies.end()) {
it->second.emplace_back(Status::OK());
} else {
- _serverIsMasterReplies.emplace(hostAndPort, std::vector<Status>{Status::OK()});
+ _serverHelloReplies.emplace(hostAndPort, std::vector<Status>{Status::OK()});
}
}
@@ -49,30 +49,30 @@ void TopologyListenerMock::onServerHeartbeatFailureEvent(Status errorStatus,
stdx::lock_guard lk(_mutex);
// If the map already contains an element for hostAndPort, append to its already existing
// vector. Otherwise, create a new vector.
- auto it = _serverIsMasterReplies.find(hostAndPort);
- if (it != _serverIsMasterReplies.end()) {
+ auto it = _serverHelloReplies.find(hostAndPort);
+ if (it != _serverHelloReplies.end()) {
it->second.emplace_back(errorStatus);
} else {
- _serverIsMasterReplies.emplace(hostAndPort, std::vector<Status>{errorStatus});
+ _serverHelloReplies.emplace(hostAndPort, std::vector<Status>{errorStatus});
}
}
-bool TopologyListenerMock::hasIsMasterResponse(const HostAndPort& hostAndPort) {
+bool TopologyListenerMock::hasHelloResponse(const HostAndPort& hostAndPort) {
stdx::lock_guard lock(_mutex);
- return _hasIsMasterResponse(lock, hostAndPort);
+ return _hasHelloResponse(lock, hostAndPort);
}
-bool TopologyListenerMock::_hasIsMasterResponse(WithLock, const HostAndPort& hostAndPort) {
- return _serverIsMasterReplies.find(hostAndPort) != _serverIsMasterReplies.end();
+bool TopologyListenerMock::_hasHelloResponse(WithLock, const HostAndPort& hostAndPort) {
+ return _serverHelloReplies.find(hostAndPort) != _serverHelloReplies.end();
}
-std::vector<Status> TopologyListenerMock::getIsMasterResponse(const HostAndPort& hostAndPort) {
+std::vector<Status> TopologyListenerMock::getHelloResponse(const HostAndPort& hostAndPort) {
stdx::lock_guard lock(_mutex);
- invariant(_hasIsMasterResponse(lock, hostAndPort));
- auto it = _serverIsMasterReplies.find(hostAndPort);
- auto statusWithIsMasterResponse = it->second;
- _serverIsMasterReplies.erase(it);
- return statusWithIsMasterResponse;
+ invariant(_hasHelloResponse(lock, hostAndPort));
+ auto it = _serverHelloReplies.find(hostAndPort);
+ auto statusWithHelloResponse = it->second;
+ _serverHelloReplies.erase(it);
+ return statusWithHelloResponse;
}
void TopologyListenerMock::onServerPingSucceededEvent(HelloRTT latency,
diff --git a/src/mongo/client/sdam/topology_listener_mock.h b/src/mongo/client/sdam/topology_listener_mock.h
index ad8db6f46da..d8f99eb5a88 100644
--- a/src/mongo/client/sdam/topology_listener_mock.h
+++ b/src/mongo/client/sdam/topology_listener_mock.h
@@ -47,15 +47,15 @@ public:
BSONObj reply) override;
/**
- * Returns true if _serverIsMasterReplies contains an element corresponding to hostAndPort.
+ * Returns true if _serverHelloReplies contains an element corresponding to hostAndPort.
*/
- bool hasIsMasterResponse(const HostAndPort& hostAndPort);
- bool _hasIsMasterResponse(WithLock, const HostAndPort& hostAndPort);
+ bool hasHelloResponse(const HostAndPort& hostAndPort);
+ bool _hasHelloResponse(WithLock, const HostAndPort& hostAndPort);
/**
* Returns the responses for the most recent onServerHeartbeat events.
*/
- std::vector<Status> getIsMasterResponse(const HostAndPort& hostAndPort);
+ std::vector<Status> getHelloResponse(const HostAndPort& hostAndPort);
void onServerPingSucceededEvent(HelloRTT latency, const HostAndPort& hostAndPort) override;
@@ -74,7 +74,7 @@ public:
private:
Mutex _mutex;
- stdx::unordered_map<HostAndPort, std::vector<Status>> _serverIsMasterReplies;
+ stdx::unordered_map<HostAndPort, std::vector<Status>> _serverHelloReplies;
stdx::unordered_map<HostAndPort, std::vector<StatusWith<HelloRTT>>> _serverPingRTTs;
};
diff --git a/src/mongo/client/sdam/topology_manager_test.cpp b/src/mongo/client/sdam/topology_manager_test.cpp
index 8c3b45fef38..0c67a25fb59 100644
--- a/src/mongo/client/sdam/topology_manager_test.cpp
+++ b/src/mongo/client/sdam/topology_manager_test.cpp
@@ -60,7 +60,7 @@ protected:
static inline const auto kBsonTopologyVersionHigh =
okBuilder().append("topologyVersion", TopologyVersion(OID::max(), 1).toBSON()).obj();
static inline const auto kBsonRsPrimary = okBuilder()
- .append("ismaster", true)
+ .append("isWritablePrimary", true)
.append("setName", kSetName)
.append("minWireVersion", 2)
.append("maxWireVersion", 10)
diff --git a/src/mongo/client/sdam/topology_state_machine.cpp b/src/mongo/client/sdam/topology_state_machine.cpp
index 5c8cb94c954..8ff6c8a9848 100644
--- a/src/mongo/client/sdam/topology_state_machine.cpp
+++ b/src/mongo/client/sdam/topology_state_machine.cpp
@@ -154,14 +154,11 @@ void TopologyStateMachine::onServerDescription(TopologyDescription& topologyDesc
const ServerDescriptionPtr& serverDescription) {
if (!topologyDescription.containsServerAddress(serverDescription->getAddress())) {
const auto& setName = topologyDescription.getSetName();
- LOGV2_DEBUG(
- 20219,
- kLogLevel,
- "{replSetName}: Ignoring isMaster reply from server that is not in the topology: "
- "{serverAddress}",
- "Ignoring isMaster reply from server that is not in the topology",
- "replicaSet"_attr = setName ? *setName : std::string(""),
- "serverAddress"_attr = serverDescription->getAddress());
+ LOGV2_DEBUG(20219,
+ kLogLevel,
+ "Ignoring 'hello' reply from server that is not in the topology",
+ "replicaSet"_attr = setName ? *setName : std::string(""),
+ "serverAddress"_attr = serverDescription->getAddress());
return;
}
diff --git a/src/mongo/client/server_discovery_monitor.cpp b/src/mongo/client/server_discovery_monitor.cpp
index 27f77214a64..0cd639e76af 100644
--- a/src/mongo/client/server_discovery_monitor.cpp
+++ b/src/mongo/client/server_discovery_monitor.cpp
@@ -239,7 +239,7 @@ StatusWith<TaskExecutor::CallbackHandle> SingleServerDiscoveryMonitor::_schedule
});
BSONObjBuilder bob;
- bob.append("isMaster", 1);
+ bob.append("hello", 1);
bob.append("maxAwaitTimeMS", maxAwaitTimeMS);
bob.append("topologyVersion", _topologyVersion->toBSON());
@@ -299,7 +299,7 @@ StatusWith<TaskExecutor::CallbackHandle> SingleServerDiscoveryMonitor::_schedule
StatusWith<TaskExecutor::CallbackHandle> SingleServerDiscoveryMonitor::_scheduleSingleHello() {
BSONObjBuilder bob;
- bob.append("isMaster", 1);
+ bob.append("hello", 1);
if (auto wireSpec = WireSpec::instance().get(); wireSpec->isInternalClient) {
WireSpec::appendInternalClientWireVersion(wireSpec->outgoing, &bob);
}
diff --git a/src/mongo/client/server_discovery_monitor_expedited_test.cpp b/src/mongo/client/server_discovery_monitor_expedited_test.cpp
index cb89d0229c3..1806a51d0e2 100644
--- a/src/mongo/client/server_discovery_monitor_expedited_test.cpp
+++ b/src/mongo/client/server_discovery_monitor_expedited_test.cpp
@@ -39,7 +39,7 @@ namespace mongo {
class SingleServerDiscoveryMonitorExpeditedFixture : public unittest::Test {
public:
struct TestCase {
- boost::optional<Milliseconds> timeElapsedSinceLastIsMaster;
+ boost::optional<Milliseconds> timeElapsedSinceLastHello;
Milliseconds previousRefreshPeriod;
boost::optional<Milliseconds> expectedResult;
};
@@ -47,11 +47,11 @@ public:
void verifyTestCase(TestCase testCase) {
LOGV2_INFO(4712103,
"TestCase",
- "timeElapsedSinceLastIsMaster"_attr = testCase.timeElapsedSinceLastIsMaster,
+ "timeElapsedSinceLastHello"_attr = testCase.timeElapsedSinceLastHello,
"previousRefreshPeriod"_attr = testCase.previousRefreshPeriod,
"expeditedRefreshPeriod"_attr = kExpeditedRefreshPeriod);
auto result = SingleServerDiscoveryMonitor::calculateExpeditedDelayUntilNextCheck(
- testCase.timeElapsedSinceLastIsMaster,
+ testCase.timeElapsedSinceLastHello,
kExpeditedRefreshPeriod,
testCase.previousRefreshPeriod);
ASSERT_EQUALS(testCase.expectedResult, result);
diff --git a/src/mongo/client/server_discovery_monitor_test.cpp b/src/mongo/client/server_discovery_monitor_test.cpp
index 8747ccfc96d..98dc5d0d007 100644
--- a/src/mongo/client/server_discovery_monitor_test.cpp
+++ b/src/mongo/client/server_discovery_monitor_test.cpp
@@ -120,53 +120,53 @@ protected:
}
/**
- * Sets up a SingleServerDiscoveryMonitor that starts sending isMasters to the server.
+ * Sets up a SingleServerDiscoveryMonitor that starts sending "hello" to the server.
*/
std::shared_ptr<SingleServerDiscoveryMonitor> initSingleServerDiscoveryMonitor(
const sdam::SdamConfiguration& sdamConfiguration,
const HostAndPort& hostAndPort,
MockReplicaSet* replSet) {
- auto ssIsMasterMonitor = std::make_shared<SingleServerDiscoveryMonitor>(replSet->getURI(),
- hostAndPort,
- boost::none,
- sdamConfiguration,
- _eventsPublisher,
- _executor,
- _stats);
- ssIsMasterMonitor->init();
-
- // Ensure that the clock has not advanced since setUp() and _startDate is representative
- // of when the first isMaster request was sent.
+ auto ssHelloMonitor = std::make_shared<SingleServerDiscoveryMonitor>(replSet->getURI(),
+ hostAndPort,
+ boost::none,
+ sdamConfiguration,
+ _eventsPublisher,
+ _executor,
+ _stats);
+ ssHelloMonitor->init();
+
+ // Ensure that the clock has not advanced since setUp() and _startDate is representative of
+ // when the first "hello" request was sent.
ASSERT_EQ(getStartDate(), getNet()->now());
- return ssIsMasterMonitor;
+ return ssHelloMonitor;
}
std::shared_ptr<ServerDiscoveryMonitor> initServerDiscoveryMonitor(
const MongoURI& setUri,
const sdam::SdamConfiguration& sdamConfiguration,
const sdam::TopologyDescriptionPtr topologyDescription) {
- auto serverIsMasterMonitor = std::make_shared<ServerDiscoveryMonitor>(
+ auto serverHelloMonitor = std::make_shared<ServerDiscoveryMonitor>(
setUri, sdamConfiguration, _eventsPublisher, topologyDescription, _stats, _executor);
// Ensure that the clock has not advanced since setUp() and _startDate is representative
- // of when the first isMaster request was sent.
+ // of when the first "hello" request was sent.
ASSERT_EQ(getStartDate(), getNet()->now());
- return serverIsMasterMonitor;
+ return serverHelloMonitor;
}
/**
- * Checks that an isMaster request has been sent to some server and schedules a response. If
- * assertHostCheck is true, asserts that the isMaster was sent to the server at hostAndPort.
+ * Checks that an "hello" request has been sent to some server and schedules a response. If
+ * assertHostCheck is true, asserts that the "hello" was sent to the server at hostAndPort.
*/
- void processIsMasterRequest(MockReplicaSet* replSet,
- boost::optional<HostAndPort> hostAndPort = boost::none) {
+ void processHelloRequest(MockReplicaSet* replSet,
+ boost::optional<HostAndPort> hostAndPort = boost::none) {
ASSERT(hasReadyRequests());
InNetworkGuard guard(_net);
_net->runReadyNetworkOperations();
auto noi = _net->getNextReadyRequest();
auto request = noi->getRequest();
- executor::TaskExecutorTest::assertRemoteCommandNameEquals("isMaster", request);
+ executor::TaskExecutorTest::assertRemoteCommandNameEquals("hello", request);
auto requestHost = request.target.toString();
if (hostAndPort) {
ASSERT_EQ(request.target, hostAndPort);
@@ -201,55 +201,55 @@ protected:
}
/**
- * Checks that exactly one successful isMaster occurs within a time interval of
+ * Checks that exactly one successful "hello" occurs within a time interval of
* heartbeatFrequency.
*/
- void checkSingleIsMaster(Milliseconds heartbeatFrequency,
- const HostAndPort& hostAndPort,
- MockReplicaSet* replSet) {
+ void checkSingleHello(Milliseconds heartbeatFrequency,
+ const HostAndPort& hostAndPort,
+ MockReplicaSet* replSet) {
auto deadline = elapsed() + heartbeatFrequency;
- processIsMasterRequest(replSet, hostAndPort);
+ processHelloRequest(replSet, hostAndPort);
- while (elapsed() < deadline && !_topologyListener->hasIsMasterResponse(hostAndPort)) {
+ while (elapsed() < deadline && !_topologyListener->hasHelloResponse(hostAndPort)) {
advanceTime(Milliseconds(1));
}
- validateIsMasterResponse(hostAndPort, deadline);
+ validateHelloResponse(hostAndPort, deadline);
checkNoActivityBefore(deadline, hostAndPort);
}
- void validateIsMasterResponse(const HostAndPort& hostAndPort, Milliseconds deadline) {
- ASSERT_TRUE(_topologyListener->hasIsMasterResponse(hostAndPort));
+ void validateHelloResponse(const HostAndPort& hostAndPort, Milliseconds deadline) {
+ ASSERT_TRUE(_topologyListener->hasHelloResponse(hostAndPort));
ASSERT_LT(elapsed(), deadline);
- auto isMasterResponse = _topologyListener->getIsMasterResponse(hostAndPort);
+ auto helloResponse = _topologyListener->getHelloResponse(hostAndPort);
- // There should only be one isMaster response queued up.
- ASSERT_EQ(isMasterResponse.size(), 1);
- ASSERT(isMasterResponse[0].isOK());
+ // There should only be one "hello" response queued up.
+ ASSERT_EQ(helloResponse.size(), 1);
+ ASSERT(helloResponse[0].isOK());
}
/**
- * Confirms no more isMaster requests are sent between elapsed() and deadline. Confirms no more
- * isMaster responses are received between elapsed() and deadline when hostAndPort is specified.
+ * Confirms no more "hello" requests are sent between elapsed() and deadline. Confirms no more
+ * "hello" responses are received between elapsed() and deadline when hostAndPort is specified.
*/
void checkNoActivityBefore(Milliseconds deadline,
boost::optional<HostAndPort> hostAndPort = boost::none) {
while (elapsed() < deadline) {
ASSERT_FALSE(hasReadyRequests());
if (hostAndPort) {
- ASSERT_FALSE(_topologyListener->hasIsMasterResponse(hostAndPort.get()));
+ ASSERT_FALSE(_topologyListener->hasHelloResponse(hostAndPort.get()));
}
advanceTime(Milliseconds(1));
}
}
/**
- * Waits up to timeoutMS for the next isMaster request to go out.
- * Causes the test to fail if timeoutMS time passes and no request is ready.
+ * Waits up to timeoutMS for the next "hello" request to go out. Causes the test to fail if
+ * timeoutMS time passes and no request is ready.
*
- * NOTE: The time between each isMaster request is the heartbeatFrequency compounded by response
+ * NOTE: The time between each "hello" request is the heartbeatFrequency compounded by response
* time.
*/
- void waitForNextIsMaster(Milliseconds timeoutMS) {
+ void waitForNextHello(Milliseconds timeoutMS) {
auto deadline = elapsed() + timeoutMS;
while (!hasReadyRequests() && elapsed() < deadline) {
advanceTime(Milliseconds(1));
@@ -272,7 +272,7 @@ private:
};
/**
- * Checks that a SingleServerDiscoveryMonitor sends isMaster requests at least heartbeatFrequency
+ * Checks that a SingleServerDiscoveryMonitor sends "hello" requests at least heartbeatFrequency
* apart.
*/
TEST_F(ServerDiscoveryMonitorTestFixture, heartbeatFrequencyCheck) {
@@ -281,28 +281,28 @@ TEST_F(ServerDiscoveryMonitorTestFixture, heartbeatFrequencyCheck) {
auto hostAndPort = HostAndPort(replSet->getSecondaries()[0]);
const auto config = SdamConfiguration(std::vector<HostAndPort>{hostAndPort});
- auto ssIsMasterMonitor = initSingleServerDiscoveryMonitor(config, hostAndPort, replSet.get());
- ssIsMasterMonitor->disableExpeditedChecking();
+ auto ssHelloMonitor = initSingleServerDiscoveryMonitor(config, hostAndPort, replSet.get());
+ ssHelloMonitor->disableExpeditedChecking();
- // An isMaster command fails if it takes as long or longer than timeoutMS.
+ // A "hello" command fails if it takes as long or longer than timeoutMS.
auto timeoutMS = config.getConnectionTimeout();
auto heartbeatFrequency = config.getHeartBeatFrequency();
- checkSingleIsMaster(heartbeatFrequency, hostAndPort, replSet.get());
- waitForNextIsMaster(timeoutMS);
+ checkSingleHello(heartbeatFrequency, hostAndPort, replSet.get());
+ waitForNextHello(timeoutMS);
- checkSingleIsMaster(heartbeatFrequency, hostAndPort, replSet.get());
- waitForNextIsMaster(timeoutMS);
+ checkSingleHello(heartbeatFrequency, hostAndPort, replSet.get());
+ waitForNextHello(timeoutMS);
- checkSingleIsMaster(heartbeatFrequency, hostAndPort, replSet.get());
- waitForNextIsMaster(timeoutMS);
+ checkSingleHello(heartbeatFrequency, hostAndPort, replSet.get());
+ waitForNextHello(timeoutMS);
- checkSingleIsMaster(heartbeatFrequency, hostAndPort, replSet.get());
- waitForNextIsMaster(timeoutMS);
+ checkSingleHello(heartbeatFrequency, hostAndPort, replSet.get());
+ waitForNextHello(timeoutMS);
}
/**
- * Confirms that a SingleServerDiscoveryMonitor reports to the TopologyListener when an isMaster
+ * Confirms that a SingleServerDiscoveryMonitor reports to the TopologyListener when a "hello"
* command generates an error.
*/
TEST_F(ServerDiscoveryMonitorTestFixture, singleServerDiscoveryMonitorReportsFailure) {
@@ -317,23 +317,23 @@ TEST_F(ServerDiscoveryMonitorTestFixture, singleServerDiscoveryMonitorReportsFai
}
const auto config = SdamConfiguration(std::vector<HostAndPort>{hostAndPort});
- auto ssIsMasterMonitor = initSingleServerDiscoveryMonitor(config, hostAndPort, replSet.get());
- ssIsMasterMonitor->disableExpeditedChecking();
+ auto ssHelloMonitor = initSingleServerDiscoveryMonitor(config, hostAndPort, replSet.get());
+ ssHelloMonitor->disableExpeditedChecking();
- processIsMasterRequest(replSet.get(), hostAndPort);
+ processHelloRequest(replSet.get(), hostAndPort);
auto topologyListener = getTopologyListener();
auto timeoutMS = config.getConnectionTimeout();
- while (elapsed() < timeoutMS && !topologyListener->hasIsMasterResponse(hostAndPort)) {
- // Advance time in small increments to ensure we stop before another isMaster is sent.
+ while (elapsed() < timeoutMS && !topologyListener->hasHelloResponse(hostAndPort)) {
+ // Advance time in small increments to ensure we stop before another "hello" is sent.
advanceTime(Milliseconds(1));
}
- ASSERT_TRUE(topologyListener->hasIsMasterResponse(hostAndPort));
- auto response = topologyListener->getIsMasterResponse(hostAndPort);
+ ASSERT_TRUE(topologyListener->hasHelloResponse(hostAndPort));
+ auto response = topologyListener->getHelloResponse(hostAndPort);
ASSERT_EQ(response.size(), 1);
ASSERT_EQ(response[0], ErrorCodes::HostUnreachable);
}
-TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorOnTopologyDescriptionChangeAddHost) {
+TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorOnTopologyDescriptionChangeAddHost) {
auto replSet = std::make_unique<MockReplicaSet>(
"test", 2, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false);
@@ -345,11 +345,11 @@ TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorOnTopologyDescrip
auto sdamConfig0 = sdam::SdamConfiguration(host0Vec);
auto topologyDescription0 = std::make_shared<sdam::TopologyDescription>(sdamConfig0);
auto uri = replSet->getURI();
- auto isMasterMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0);
- isMasterMonitor->disableExpeditedChecking();
+ auto helloMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0);
+ helloMonitor->disableExpeditedChecking();
auto host1Delay = Milliseconds(100);
- checkSingleIsMaster(host1Delay, host0, replSet.get());
+ checkSingleHello(host1Delay, host0, replSet.get());
ASSERT_FALSE(hasReadyRequests());
// Start monitoring host1.
@@ -358,21 +358,20 @@ TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorOnTopologyDescrip
auto sdamConfigAllHosts = sdam::SdamConfiguration(allHostsVec);
auto topologyDescriptionAllHosts =
std::make_shared<sdam::TopologyDescription>(sdamConfigAllHosts);
- isMasterMonitor->onTopologyDescriptionChangedEvent(topologyDescription0,
- topologyDescriptionAllHosts);
+ helloMonitor->onTopologyDescriptionChangedEvent(topologyDescription0,
+ topologyDescriptionAllHosts);
// Ensure expedited checking is disabled for the SingleServerDiscoveryMonitor corresponding to
// host1 as well.
- isMasterMonitor->disableExpeditedChecking();
+ helloMonitor->disableExpeditedChecking();
// Confirm host0 and host1 are monitored.
auto heartbeatFrequency = sdamConfigAllHosts.getHeartBeatFrequency();
- checkSingleIsMaster(heartbeatFrequency - host1Delay, host1, replSet.get());
- waitForNextIsMaster(sdamConfigAllHosts.getConnectionTimeout());
- checkSingleIsMaster(host1Delay, host0, replSet.get());
+ checkSingleHello(heartbeatFrequency - host1Delay, host1, replSet.get());
+ waitForNextHello(sdamConfigAllHosts.getConnectionTimeout());
+ checkSingleHello(host1Delay, host0, replSet.get());
}
-TEST_F(ServerDiscoveryMonitorTestFixture,
- serverIsMasterMonitorOnTopologyDescriptionChangeRemoveHost) {
+TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorOnTopologyDescriptionChangeRemoveHost) {
auto replSet = std::make_unique<MockReplicaSet>(
"test", 2, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false);
@@ -386,45 +385,45 @@ TEST_F(ServerDiscoveryMonitorTestFixture,
auto topologyDescriptionAllHosts =
std::make_shared<sdam::TopologyDescription>(sdamConfigAllHosts);
auto uri = replSet->getURI();
- auto isMasterMonitor =
+ auto helloMonitor =
initServerDiscoveryMonitor(uri, sdamConfigAllHosts, topologyDescriptionAllHosts);
- isMasterMonitor->disableExpeditedChecking();
+ helloMonitor->disableExpeditedChecking();
// Confirm that both hosts are monitored.
auto heartbeatFrequency = sdamConfigAllHosts.getHeartBeatFrequency();
while (hasReadyRequests()) {
- processIsMasterRequest(replSet.get());
+ processHelloRequest(replSet.get());
}
auto deadline = elapsed() + heartbeatFrequency;
auto topologyListener = getTopologyListener();
auto hasResponses = [&]() {
- return topologyListener->hasIsMasterResponse(host0) &&
- topologyListener->hasIsMasterResponse(host1);
+ return topologyListener->hasHelloResponse(host0) &&
+ topologyListener->hasHelloResponse(host1);
};
while (elapsed() < heartbeatFrequency && !hasResponses()) {
advanceTime(Milliseconds(1));
}
- validateIsMasterResponse(host0, deadline);
- validateIsMasterResponse(host1, deadline);
+ validateHelloResponse(host0, deadline);
+ validateHelloResponse(host1, deadline);
// Remove host1 from the TopologyDescription to stop monitoring it.
std::vector<HostAndPort> host0Vec{host0};
auto sdamConfig0 = sdam::SdamConfiguration(host0Vec);
auto topologyDescription0 = std::make_shared<sdam::TopologyDescription>(sdamConfig0);
- isMasterMonitor->onTopologyDescriptionChangedEvent(topologyDescriptionAllHosts,
- topologyDescription0);
+ helloMonitor->onTopologyDescriptionChangedEvent(topologyDescriptionAllHosts,
+ topologyDescription0);
checkNoActivityBefore(deadline);
- waitForNextIsMaster(sdamConfig0.getConnectionTimeout());
+ waitForNextHello(sdamConfig0.getConnectionTimeout());
- checkSingleIsMaster(heartbeatFrequency, host0, replSet.get());
- waitForNextIsMaster(sdamConfig0.getConnectionTimeout());
+ checkSingleHello(heartbeatFrequency, host0, replSet.get());
+ waitForNextHello(sdamConfig0.getConnectionTimeout());
- // Confirm the next isMaster request is sent to host0 and not host1.
- checkSingleIsMaster(heartbeatFrequency, host0, replSet.get());
+ // Confirm the next "hello" request is sent to host0 and not host1.
+ checkSingleHello(heartbeatFrequency, host0, replSet.get());
}
-TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorShutdownStopsIsMasterRequests) {
+TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorShutdownStopsHelloRequests) {
auto replSet = std::make_unique<MockReplicaSet>(
"test", 1, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false);
@@ -432,13 +431,13 @@ TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorShutdownStopsIsMa
auto sdamConfig = sdam::SdamConfiguration(hostVec);
auto topologyDescription = std::make_shared<sdam::TopologyDescription>(sdamConfig);
auto uri = replSet->getURI();
- auto isMasterMonitor = initServerDiscoveryMonitor(uri, sdamConfig, topologyDescription);
- isMasterMonitor->disableExpeditedChecking();
+ auto helloMonitor = initServerDiscoveryMonitor(uri, sdamConfig, topologyDescription);
+ helloMonitor->disableExpeditedChecking();
auto heartbeatFrequency = sdamConfig.getHeartBeatFrequency();
- checkSingleIsMaster(heartbeatFrequency - Milliseconds(200), hostVec[0], replSet.get());
+ checkSingleHello(heartbeatFrequency - Milliseconds(200), hostVec[0], replSet.get());
- isMasterMonitor->shutdown();
+ helloMonitor->shutdown();
// After the ServerDiscoveryMonitor shuts down, the TopologyListener may have responses until
// heartbeatFrequency has passed, but none of them should indicate Status::OK.
@@ -448,27 +447,26 @@ TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorShutdownStopsIsMa
// Drain any requests already scheduled.
while (elapsed() < deadline) {
while (hasReadyRequests()) {
- processIsMasterRequest(replSet.get(), hostVec[0]);
+ processHelloRequest(replSet.get(), hostVec[0]);
}
- if (topologyListener->hasIsMasterResponse(hostVec[0])) {
- auto isMasterResponses = topologyListener->getIsMasterResponse(hostVec[0]);
- for (auto& response : isMasterResponses) {
+ if (topologyListener->hasHelloResponse(hostVec[0])) {
+ auto helloResponses = topologyListener->getHelloResponse(hostVec[0]);
+ for (auto& response : helloResponses) {
ASSERT_FALSE(response.isOK());
}
}
advanceTime(Milliseconds(1));
}
- ASSERT_FALSE(topologyListener->hasIsMasterResponse(hostVec[0]));
+ ASSERT_FALSE(topologyListener->hasHelloResponse(hostVec[0]));
}
/**
* Tests that the ServerDiscoveryMonitor waits until SdamConfiguration::kMinHeartbeatFrequency has
- * passed since the last isMaster was received if requestImmediateCheck() is called before enough
+ * passed since the last "hello" was received if requestImmediateCheck() is called before enough
* time has passed.
*/
-TEST_F(ServerDiscoveryMonitorTestFixture,
- serverIsMasterMonitorRequestImmediateCheckWaitMinHeartbeat) {
+TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorRequestImmediateCheckWaitMinHeartbeat) {
auto replSet = std::make_unique<MockReplicaSet>(
"test", 1, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false);
@@ -478,41 +476,41 @@ TEST_F(ServerDiscoveryMonitorTestFixture,
auto sdamConfig0 = sdam::SdamConfiguration(hostVec);
auto topologyDescription0 = std::make_shared<sdam::TopologyDescription>(sdamConfig0);
auto uri = replSet->getURI();
- auto isMasterMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0);
+ auto helloMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0);
// Ensure the server is not in expedited mode *before* requestImmediateCheck().
- isMasterMonitor->disableExpeditedChecking();
+ helloMonitor->disableExpeditedChecking();
- // Check that there is only one isMaster request at time t=0 up until
- // timeAdvanceFromFirstIsMaster.
+ // Check that there is only one "hello" request at time t=0 up until
+ // timeAdvanceFromFirstHello.
auto minHeartbeatFrequency = SdamConfiguration::kMinHeartbeatFrequency;
- auto timeAdvanceFromFirstIsMaster = Milliseconds(10);
- ASSERT_LT(timeAdvanceFromFirstIsMaster, minHeartbeatFrequency);
- checkSingleIsMaster(timeAdvanceFromFirstIsMaster, hostVec[0], replSet.get());
+ auto timeAdvanceFromFirstHello = Milliseconds(10);
+ ASSERT_LT(timeAdvanceFromFirstHello, minHeartbeatFrequency);
+ checkSingleHello(timeAdvanceFromFirstHello, hostVec[0], replSet.get());
- // It's been less than SdamConfiguration::kMinHeartbeatFrequency since the last isMaster was
- // received. The next isMaster should be sent SdamConfiguration::kMinHeartbeatFrequency since
- // the last isMaster was recieved rather than immediately.
+ // It's been less than SdamConfiguration::kMinHeartbeatFrequency since the last "hello" was
+ // received. The next "hello" should be sent SdamConfiguration::kMinHeartbeatFrequency since
+ // the last "hello" was recieved rather than immediately.
auto timeRequestImmediateSent = elapsed();
- isMasterMonitor->requestImmediateCheck();
- waitForNextIsMaster(minHeartbeatFrequency);
+ helloMonitor->requestImmediateCheck();
+ waitForNextHello(minHeartbeatFrequency);
- auto timeIsMasterSent = elapsed();
- ASSERT_LT(timeRequestImmediateSent, timeIsMasterSent);
- ASSERT_LT(timeIsMasterSent, timeRequestImmediateSent + minHeartbeatFrequency);
- checkSingleIsMaster(minHeartbeatFrequency, hostVec[0], replSet.get());
+ auto timeHelloSent = elapsed();
+ ASSERT_LT(timeRequestImmediateSent, timeHelloSent);
+ ASSERT_LT(timeHelloSent, timeRequestImmediateSent + minHeartbeatFrequency);
+ checkSingleHello(minHeartbeatFrequency, hostVec[0], replSet.get());
// Confirm expedited requests continue since there is no primary.
- waitForNextIsMaster(sdamConfig0.getConnectionTimeout());
- checkSingleIsMaster(minHeartbeatFrequency, hostVec[0], replSet.get());
+ waitForNextHello(sdamConfig0.getConnectionTimeout());
+ checkSingleHello(minHeartbeatFrequency, hostVec[0], replSet.get());
}
/**
* Tests that if more than SdamConfiguration::kMinHeartbeatFrequency has passed since the last
- * isMaster response was received, the ServerDiscoveryMonitor sends an isMaster immediately after
+ * "hello" response was received, the ServerDiscoveryMonitor sends an "hello" immediately after
* requestImmediateCheck() is called.
*/
-TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorRequestImmediateCheckNoWait) {
+TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorRequestImmediateCheckNoWait) {
auto replSet = std::make_unique<MockReplicaSet>(
"test", 1, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false);
@@ -522,23 +520,23 @@ TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorRequestImmediateC
auto sdamConfig0 = sdam::SdamConfiguration(hostVec);
auto topologyDescription0 = std::make_shared<sdam::TopologyDescription>(sdamConfig0);
auto uri = replSet->getURI();
- auto isMasterMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0);
+ auto helloMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0);
// Ensure the server is not in expedited mode *before* requestImmediateCheck().
- isMasterMonitor->disableExpeditedChecking();
+ helloMonitor->disableExpeditedChecking();
// No less than SdamConfiguration::kMinHeartbeatFrequency must pass before
// requestImmediateCheck() is called in order to ensure the server reschedules for an immediate
// check.
auto minHeartbeatFrequency = SdamConfiguration::kMinHeartbeatFrequency;
- checkSingleIsMaster(minHeartbeatFrequency + Milliseconds(10), hostVec[0], replSet.get());
+ checkSingleHello(minHeartbeatFrequency + Milliseconds(10), hostVec[0], replSet.get());
- isMasterMonitor->requestImmediateCheck();
- checkSingleIsMaster(minHeartbeatFrequency, hostVec[0], replSet.get());
+ helloMonitor->requestImmediateCheck();
+ checkSingleHello(minHeartbeatFrequency, hostVec[0], replSet.get());
// Confirm expedited requests continue since there is no primary.
- waitForNextIsMaster(sdamConfig0.getConnectionTimeout());
- checkSingleIsMaster(minHeartbeatFrequency, hostVec[0], replSet.get());
+ waitForNextHello(sdamConfig0.getConnectionTimeout());
+ checkSingleHello(minHeartbeatFrequency, hostVec[0], replSet.get());
}
} // namespace
diff --git a/src/mongo/client/server_ping_monitor.cpp b/src/mongo/client/server_ping_monitor.cpp
index 23353157c41..8d482d3234c 100644
--- a/src/mongo/client/server_ping_monitor.cpp
+++ b/src/mongo/client/server_ping_monitor.cpp
@@ -85,11 +85,18 @@ auto SingleServerPingMonitor::_scheduleWorkAt(Date_t when, Callback&& cb) const
auto wrappedCallback = [cb = std::forward<Callback>(cb),
anchor = shared_from_this()](const CallbackArgs& cbArgs) mutable {
if (ErrorCodes::isCancellationError(cbArgs.status)) {
+ LOGV2(7926101,
+ "ServerPingMonitor stopping pings to host because request was cancelled",
+ "host"_attr = anchor->_hostAndPort,
+ "status"_attr = cbArgs.status);
return;
}
stdx::lock_guard lk(anchor->_mutex);
if (anchor->_isDropped) {
+ LOGV2(7926102,
+ "ServerPingMonitor stopping pings to host because the component was shutdown",
+ "host"_attr = anchor->_hostAndPort);
return;
}
cb(cbArgs);
@@ -149,12 +156,21 @@ void SingleServerPingMonitor::_doServerPing() {
if (ErrorCodes::isCancellationError(result.response.status)) {
// Do no more work if the SingleServerPingMonitor is removed or the request is
// canceled.
+ LOGV2(7926103,
+ "ServerPingMonitor stopping pings to host because monitor was removed or "
+ "request was cancelled",
+ "host"_attr = anchor->_hostAndPort,
+ "status"_attr = result.response.status);
return;
}
{
stdx::lock_guard lk(anchor->_mutex);
int rttValue = 0;
if (anchor->_isDropped) {
+ LOGV2(7926104,
+ "ServerPingMonitor stopping pings to host because the component was "
+ "shutdown",
+ "host"_attr = anchor->_hostAndPort);
return;
}
diff --git a/src/mongo/client/server_ping_monitor.h b/src/mongo/client/server_ping_monitor.h
index b4667e85606..0a4f0369c4d 100644
--- a/src/mongo/client/server_ping_monitor.h
+++ b/src/mongo/client/server_ping_monitor.h
@@ -150,7 +150,7 @@ public:
void shutdown();
/**
- * The first isMaster exchange for a connection to the server succeeded. Creates a new
+ * The first "hello" exchange for a connection to the server succeeded. Creates a new
* SingleServerPingMonitor to monitor the new replica set member.
*/
void onServerHandshakeCompleteEvent(sdam::HelloRTT durationMs,
diff --git a/src/mongo/client/server_ping_monitor_test.cpp b/src/mongo/client/server_ping_monitor_test.cpp
index 154d82ea459..c0ae7e2f7c0 100644
--- a/src/mongo/client/server_ping_monitor_test.cpp
+++ b/src/mongo/client/server_ping_monitor_test.cpp
@@ -162,7 +162,7 @@ protected:
ASSERT_LT(elapsed(), deadline);
auto pingResponse = _topologyListener->getPingResponse(hostAndPort);
- // There should only be one isMaster response queued up.
+ // There should only be one "hello" response queued up.
ASSERT_EQ(pingResponse.size(), 1);
ASSERT(pingResponse[0].isOK());
diff --git a/src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp b/src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp
index 787ab86026e..d51fd65156e 100644
--- a/src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp
+++ b/src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp
@@ -200,7 +200,7 @@ TEST_F(StreamableReplicaSetMonitorErrorHandlerTestFixture, MonitoringNonNetworkE
}
TEST_F(StreamableReplicaSetMonitorErrorHandlerTestFixture,
- ApplicationNonNetworkIsMasterOrRecoveringError) {
+ ApplicationNonNetworkHelloOrRecoveringError) {
testScenario(
HandshakeStage::kPostHandshake,
kMonitoringOperation,
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 b26ea37c24e..4ed75f5e7f6 100644
--- a/src/mongo/client/streamable_replica_set_monitor_query_processor.cpp
+++ b/src/mongo/client/streamable_replica_set_monitor_query_processor.cpp
@@ -56,7 +56,6 @@ void StreamableReplicaSetMonitor::StreamableReplicaSetMonitorQueryProcessor::
if (!replicaSetMonitor) {
LOGV2_DEBUG(4333215,
kLogLevel,
- "Could not find rsm instance {replicaSet} for query processing",
"Could not find rsm instance for query processing",
"replicaSet"_attr = *setName);
return;
@@ -64,7 +63,7 @@ void StreamableReplicaSetMonitor::StreamableReplicaSetMonitorQueryProcessor::
replicaSetMonitor->_processOutstanding(newDescription);
}
- // No set name occurs when there is an error monitoring isMaster replies (e.g. HostUnreachable).
+ // No set name occurs when there is an error monitoring "hello" replies (e.g. HostUnreachable).
// There is nothing to do in that case.
}
}; // namespace mongo