diff options
Diffstat (limited to 'src/mongo/client')
112 files changed, 474 insertions, 552 deletions
diff --git a/src/mongo/client/README.md b/src/mongo/client/README.md index 4bc8afea3c7..b79a3971254 100644 --- a/src/mongo/client/README.md +++ b/src/mongo/client/README.md @@ -1,37 +1,13 @@ # 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 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. +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. #### Code references diff --git a/src/mongo/client/SConscript b/src/mongo/client/SConscript index cdaa0819473..5010be181f0 100644 --- a/src/mongo/client/SConscript +++ b/src/mongo/client/SConscript @@ -72,7 +72,6 @@ if get_option('ssl') == 'on': ], LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/base', - '$BUILD_DIR/mongo/bson/bson_validate', '$BUILD_DIR/mongo/db/server_options_core', # For object_check.h '$BUILD_DIR/mongo/idl/idl_parser', '$BUILD_DIR/third_party/shim_kms_message', @@ -118,7 +117,6 @@ saslClientEnv.Library( source=saslClientSource, LIBDEPS=[ '$BUILD_DIR/mongo/base/secure_allocator', - '$BUILD_DIR/mongo/bson/bson_validate', '$BUILD_DIR/mongo/bson/util/bson_extract', '$BUILD_DIR/mongo/executor/remote_command', '$BUILD_DIR/mongo/rpc/command_status', diff --git a/src/mongo/client/async_client.cpp b/src/mongo/client/async_client.cpp index d8cc8d4fcc9..309475ec36e 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::_buildHelloRequest(const std::string& appName, - executor::NetworkConnectionHook* hook) { +BSONObj AsyncDBClient::_buildIsMasterRequest(const std::string& appName, + executor::NetworkConnectionHook* hook) { BSONObjBuilder bob; - bob.append("hello", 1); + bob.append("isMaster", 1); const auto versionString = VersionInfoInterface::instance().version(); ClientMetadata::serialize(appName, versionString, &bob); if (getTestCommandsEnabled()) { - // Only include the host:port of this process in the "hello" command request if test + // Only include the host:port of this process in the isMaster 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::_buildHelloRequest(const std::string& appName, } if (hook) { - return hook->augmentHelloRequest(remote(), bob.obj()); + return hook->augmentIsMasterRequest(remote(), bob.obj()); } else { return bob.obj(); } } -void AsyncDBClient::_parseHelloResponse(BSONObj request, - const std::unique_ptr<rpc::ReplyInterface>& response) { +void AsyncDBClient::_parseIsMasterResponse(BSONObj request, + const std::unique_ptr<rpc::ReplyInterface>& response) { uassert(50786, - "Expected OP_MSG response to 'hello'", + "Expected OP_MSG response to isMaster", 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 hello." + str::stream() << "Received unexpected isMaster." << 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 = _buildHelloRequest(appName, hook); + auto requestObj = _buildIsMasterRequest(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); - _parseHelloResponse(requestObj, cmdReply); + _parseIsMasterResponse(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 0967ad3fa2a..82867a057ff 100644 --- a/src/mongo/client/async_client.h +++ b/src/mongo/client/async_client.h @@ -104,8 +104,10 @@ 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 _buildHelloRequest(const std::string& appName, executor::NetworkConnectionHook* hook); - void _parseHelloResponse(BSONObj request, const std::unique_ptr<rpc::ReplyInterface>& response); + BSONObj _buildIsMasterRequest(const std::string& appName, + executor::NetworkConnectionHook* hook); + void _parseIsMasterResponse(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 254227b9a46..26df7c56d0c 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("hello", 1); + builder.append("ismaster", 1); builder.append("saslSupportedMechs", username.getUnambiguousName()); if (stepDownBehavior == StepDownBehavior::kKeepConnectionOpen) { builder.append("hangUpOnStepDown", false); @@ -297,12 +297,11 @@ StringData getSaslCommandUserFieldName() { namespace { -StatusWith<std::shared_ptr<SaslClientSession>> _speculateSaslStart( - BSONObjBuilder* helloRequestBuilder, - const std::string& mechanism, - const HostAndPort& host, - StringData authDB, - BSONObj params) { +StatusWith<std::shared_ptr<SaslClientSession>> _speculateSaslStart(BSONObjBuilder* isMaster, + const std::string& mechanism, + const HostAndPort& host, + StringData authDB, + BSONObj params) { if (mechanism == kMechanismSaslPlain) { return {ErrorCodes::BadValue, "PLAIN mechanism not supported with speculativeSaslStart"}; } @@ -324,13 +323,13 @@ StatusWith<std::shared_ptr<SaslClientSession>> _speculateSaslStart( saslStart.append("mechanism", mechanism); saslStart.appendBinData("payload", int(payload.size()), BinDataGeneral, payload.c_str()); saslStart.append("db", authDB); - helloRequestBuilder->append(kSpeculativeAuthenticate, saslStart.obj()); + isMaster->append(kSpeculativeAuthenticate, saslStart.obj()); return session; } StatusWith<SpeculativeAuthType> _speculateAuth( - BSONObjBuilder* helloRequestBuilder, + BSONObjBuilder* isMaster, const std::string& mechanism, const HostAndPort& host, StringData authDB, @@ -338,18 +337,17 @@ StatusWith<SpeculativeAuthType> _speculateAuth( std::shared_ptr<SaslClientSession>* saslClientSession) { if (mechanism == kMechanismMongoX509) { // MONGODB-X509 - helloRequestBuilder->append(kSpeculativeAuthenticate, - BSON(kAuthenticateCommand - << "1" << saslCommandMechanismFieldName << mechanism - << saslCommandUserDBFieldName << "$external")); + isMaster->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(helloRequestBuilder, mechanism, host, authDB, params); + auto swSaslClientSession = _speculateSaslStart(isMaster, mechanism, host, authDB, params); if (!swSaslClientSession.isOK()) { return swSaslClientSession.getStatus(); } @@ -368,7 +366,7 @@ std::string getBSONString(BSONObj container, StringData field) { } } // namespace -SpeculativeAuthType speculateAuth(BSONObjBuilder* helloRequestBuilder, +SpeculativeAuthType speculateAuth(BSONObjBuilder* isMasterRequest, const MongoURI& uri, std::shared_ptr<SaslClientSession>* saslClientSession) { auto mechanism = uri.getOption("authMechanism").get_value_or(kMechanismScramSha256.toString()); @@ -380,7 +378,7 @@ SpeculativeAuthType speculateAuth(BSONObjBuilder* helloRequestBuilder, auto params = std::move(optParams.get()); - auto ret = _speculateAuth(helloRequestBuilder, + auto ret = _speculateAuth(isMasterRequest, mechanism, uri.getServers().front(), uri.getAuthenticationDatabase(), @@ -396,7 +394,7 @@ SpeculativeAuthType speculateAuth(BSONObjBuilder* helloRequestBuilder, SpeculativeAuthType speculateInternalAuth( const HostAndPort& remoteHost, - BSONObjBuilder* helloRequestBuilder, + BSONObjBuilder* isMasterRequest, std::shared_ptr<SaslClientSession>* saslClientSession) try { auto params = getInternalAuthParams(0, kMechanismScramSha256.toString()); if (params.isEmpty()) { @@ -406,8 +404,8 @@ SpeculativeAuthType speculateInternalAuth( auto mechanism = getBSONString(params, saslCommandMechanismFieldName); auto authDB = getBSONString(params, saslCommandUserDBFieldName); - auto ret = _speculateAuth( - helloRequestBuilder, mechanism, remoteHost, authDB, params, saslClientSession); + auto ret = + _speculateAuth(isMasterRequest, 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 1aac7719f00..7b841b2ee84 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 a "hello" will be called to negotiate + * (e.g. SCRAM-SHA-256). If it is boost::none, then an isMaster 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 a "hello" exchange to negotiate a SASL mechanism for authentication. + * Run an isMaster 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 "hello" request - * based on a given URI. + * Constructs a "speculativeAuthenticate" or "speculativeSaslStart" + * payload for an isMaster request based on a given URI. */ -SpeculativeAuthType speculateAuth(BSONObjBuilder* helloRequestBuilder, +SpeculativeAuthType speculateAuth(BSONObjBuilder* isMasterRequest, const MongoURI& uri, std::shared_ptr<SaslClientSession>* saslClientSession); /** - * Constructs a "speculativeAuthenticate" or "speculativeSaslStart" payload for an "hello" request - * using internal (intracluster) authentication. + * Constructs a "speculativeAuthenticate" or "speculativeSaslStart" + * payload for an isMaster request using internal (intracluster) authentication. */ SpeculativeAuthType speculateInternalAuth(const HostAndPort& remoteHost, - BSONObjBuilder* helloRequestBuilder, + BSONObjBuilder* isMasterRequest, std::shared_ptr<SaslClientSession>* saslClientSession); } // namespace auth diff --git a/src/mongo/client/connection_pool.cpp b/src/mongo/client/connection_pool.cpp index 897c2dc0f13..068ab4f3581 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& helloReply) { - return _hook->validateHost(target, BSONObj(), helloReply); + [this, target](const executor::RemoteCommandResponse& isMasterReply) { + return _hook->validateHost(target, BSONObj(), isMasterReply); })); } else { conn.reset(new DBClientConnection()); diff --git a/src/mongo/client/connpool.cpp b/src/mongo/client/connpool.cpp index 1df0d747090..e52bd54d102 100644 --- a/src/mongo/client/connpool.cpp +++ b/src/mongo/client/connpool.cpp @@ -589,7 +589,6 @@ 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/cyrus_sasl_client_session.cpp b/src/mongo/client/cyrus_sasl_client_session.cpp index 0122a27a539..84ae1ab0b5a 100644 --- a/src/mongo/client/cyrus_sasl_client_session.cpp +++ b/src/mongo/client/cyrus_sasl_client_session.cpp @@ -121,28 +121,6 @@ int saslClientLogSwallow(void* context, int priority, const char* message) throw } /** - * Implements the Cyrus SASL default_verifyfile_cb interface registered in the - * Cyrus SASL library to verify, and then accept or reject, the loading of - * plugin libraries from the target directory. - * - * On Windows environments, disable loading of plugin files. - */ -int saslClientVerifyPluginFile(void*, const char*, sasl_verify_type_t type) { - - if (type != SASL_VRFY_PLUGIN) { - return SASL_OK; - } - -#ifdef _WIN32 - return SASL_CONTINUE; // A non-SASL_OK response indicates to Cyrus SASL that it - // should not load a file. This effectively disables - // loading plugins from path on Windows. -#else - return SASL_OK; -#endif -} - -/** * Initializes the client half of the SASL library, but is effectively a no-op if the client * application has already done it. * @@ -158,7 +136,6 @@ MONGO_INITIALIZER_WITH_PREREQUISITES(CyrusSaslClientContext, (InitializerContext* context) { static sasl_callback_t saslClientGlobalCallbacks[] = { {SASL_CB_LOG, SaslCallbackFn(saslClientLogSwallow), nullptr /* context */}, - {SASL_CB_VERIFYFILE, SaslCallbackFn(saslClientVerifyPluginFile), nullptr /*context*/}, {SASL_CB_LIST_END}}; // If the client application has previously called sasl_client_init(), the callbacks passed diff --git a/src/mongo/client/dbclient_base.cpp b/src/mongo/client/dbclient_base.cpp index 1f9834f7bf5..192d3c78dd8 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("hello", 1); + bob.append(_apiParameters.getVersion() ? "hello" : "ismaster", 1); if (auto wireSpec = WireSpec::instance().get(); wireSpec->isInternalClient) { WireSpec::appendInternalClientWireVersion(wireSpec->outgoing, &bob); } @@ -462,7 +462,8 @@ bool DBClientBase::isPrimary(bool& isPrimary, BSONObj* info) { if (info == nullptr) info = &o; bool ok = runCommand("admin", bob.obj(), *info); - isPrimary = info->getField("isWritablePrimary").trueValue(); + isPrimary = + info->getField(_apiParameters.getVersion() ? "isWritablePrimary" : "ismaster").trueValue(); return ok; } diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp index 3e52ad0a33c..55202e0c907 100644 --- a/src/mongo/client/dbclient_connection.cpp +++ b/src/mongo/client/dbclient_connection.cpp @@ -96,27 +96,28 @@ StatusWith<bool> completeSpeculativeAuth(DBClientConnection* conn, auth::SpeculativeAuthType speculativeAuthType, std::shared_ptr<SaslClientSession> session, const MongoURI& uri, - BSONObj helloReply) { - auto specAuthElem = helloReply[auth::kSpeculativeAuthenticate]; + BSONObj isMaster) { + auto specAuthElem = isMaster[auth::kSpeculativeAuthenticate]; if (specAuthElem.eoo()) { return false; } if (speculativeAuthType == auth::SpeculativeAuthType::kNone) { return {ErrorCodes::BadValue, - str::stream() << "Unexpected hello." << auth::kSpeculativeAuthenticate << " reply"}; + str::stream() << "Unexpected isMaster." << auth::kSpeculativeAuthenticate + << " reply"}; } if (specAuthElem.type() != Object) { return {ErrorCodes::BadValue, - str::stream() << "hello." << auth::kSpeculativeAuthenticate + str::stream() << "isMaster." << auth::kSpeculativeAuthenticate << " reply must be an object"}; } auto specAuth = specAuthElem.Obj(); if (specAuth.isEmpty()) { return {ErrorCodes::BadValue, - str::stream() << "hello." << auth::kSpeculativeAuthenticate + str::stream() << "isMaster." << auth::kSpeculativeAuthenticate << " reply must be a non-empty obejct"}; } @@ -150,7 +151,7 @@ StatusWith<bool> completeSpeculativeAuth(DBClientConnection* conn, } /** - * Initializes the wire version of conn, and returns the "hello" reply. + * Initializes the wire version of conn, and returns the isMaster reply. */ executor::RemoteCommandResponse initWireVersion( DBClientConnection* conn, @@ -161,7 +162,7 @@ executor::RemoteCommandResponse initWireVersion( std::shared_ptr<SaslClientSession>* saslClientSession) try { BSONObjBuilder bob; - bob.append("hello", 1); + bob.append(conn->getApiParameters().getVersion() ? "hello" : "isMaster", 1); if (uri.isHelloOk()) { // Attach "helloOk: true" to the initial handshake to indicate that the client supports the @@ -181,7 +182,7 @@ executor::RemoteCommandResponse initWireVersion( } if (getTestCommandsEnabled()) { - // Only include the host:port of this process in the "hello" command request if test + // Only include the host:port of this process in the isMaster command request if test // commands are enabled. mongobridge uses this field to identify the process opening a // connection to it. StringBuilder sb; @@ -207,24 +208,25 @@ executor::RemoteCommandResponse initWireVersion( auto result = conn->runCommand(OpMsgRequest::fromDBAndBody("admin", bob.obj())); Date_t finish{Date_t::now()}; - BSONObj helloObj = result->getCommandReply().getOwned(); + BSONObj isMasterObj = result->getCommandReply().getOwned(); - if (helloObj.hasField("minWireVersion") && helloObj.hasField("maxWireVersion")) { - int minWireVersion = helloObj["minWireVersion"].numberInt(); - int maxWireVersion = helloObj["maxWireVersion"].numberInt(); + if (isMasterObj.hasField("minWireVersion") && isMasterObj.hasField("maxWireVersion")) { + int minWireVersion = isMasterObj["minWireVersion"].numberInt(); + int maxWireVersion = isMasterObj["maxWireVersion"].numberInt(); conn->setWireVersions(minWireVersion, maxWireVersion); } - if (helloObj.hasField("saslSupportedMechs") && helloObj["saslSupportedMechs"].type() == Array) { - auto array = helloObj["saslSupportedMechs"].Array(); + if (isMasterObj.hasField("saslSupportedMechs") && + isMasterObj["saslSupportedMechs"].type() == Array) { + auto array = isMasterObj["saslSupportedMechs"].Array(); for (const auto& elem : array) { saslMechsForAuth->push_back(elem.checkAndGetStringData().toString()); } } - conn->getCompressorManager().clientFinish(helloObj); + conn->getCompressorManager().clientFinish(isMasterObj); - return executor::RemoteCommandResponse{std::move(helloObj), finish - start}; + return executor::RemoteCommandResponse{std::move(isMasterObj), finish - start}; } catch (...) { return exceptionToStatus(); @@ -282,41 +284,41 @@ Status DBClientConnection::connect(const HostAndPort& serverAddress, auto speculativeAuthType = auth::SpeculativeAuthType::kNone; std::shared_ptr<SaslClientSession> saslClientSession; - auto swHelloReply = initWireVersion( + auto swIsMasterReply = initWireVersion( this, _applicationName, _uri, &_saslMechsForAuth, &speculativeAuthType, &saslClientSession); - if (!swHelloReply.isOK()) { + if (!swIsMasterReply.isOK()) { _markFailed(kSetFlag); - swHelloReply.status.addContext( + swIsMasterReply.status.addContext( "Connection handshake failed. Is your mongod/mongos 3.4 or older?"_sd); - return swHelloReply.status; + return swIsMasterReply.status; } - // Ensure that the "hello" response is "ok:1". - auto helloStatus = getStatusFromCommandResult(swHelloReply.data); - if (!helloStatus.isOK()) { - return helloStatus; + // Ensure that the isMaster response is "ok:1". + auto isMasterStatus = getStatusFromCommandResult(swIsMasterReply.data); + if (!isMasterStatus.isOK()) { + return isMasterStatus; } - auto replyWireVersion = wire_version::parseWireVersionFromHelloReply(swHelloReply.data); + auto replyWireVersion = wire_version::parseWireVersionFromHelloReply(swIsMasterReply.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 "hello" response, or (b) having - // "isreplicaset: true" in the "hello" response. + // as either (a) having a "setName" field in the isMaster response, or (b) having + // "isreplicaset: true" in the isMaster response. // // https://github.com/mongodb/specifications/blob/c386e23724318e2fa82f4f7663d77581b755b2c3/ // source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#type - const bool hasSetNameField = swHelloReply.data.hasField("setName"); - const bool isReplicaSetField = swHelloReply.data.getBoolField("isreplicaset"); + const bool hasSetNameField = swIsMasterReply.data.hasField("setName"); + const bool isReplicaSetField = swIsMasterReply.data.getBoolField("isreplicaset"); _isReplicaSetMember = hasSetNameField || isReplicaSetField; } { std::string msgField; - auto msgFieldExtractStatus = bsonExtractStringField(swHelloReply.data, "msg", &msgField); + auto msgFieldExtractStatus = bsonExtractStringField(swIsMasterReply.data, "msg", &msgField); if (msgFieldExtractStatus == ErrorCodes::NoSuchKey) { _isMongos = false; @@ -340,7 +342,7 @@ Status DBClientConnection::connect(const HostAndPort& serverAddress, } if (_hook) { - auto validationStatus = _hook(swHelloReply); + auto validationStatus = _hook(swIsMasterReply); if (!validationStatus.isOK()) { // Disconnect and mark failed. _markFailed(kReleaseSession); @@ -350,7 +352,7 @@ Status DBClientConnection::connect(const HostAndPort& serverAddress, { auto swAuth = completeSpeculativeAuth( - this, speculativeAuthType, saslClientSession, _uri, swHelloReply.data); + this, speculativeAuthType, saslClientSession, _uri, swIsMasterReply.data); if (!swAuth.isOK()) { return swAuth.getStatus(); } diff --git a/src/mongo/client/dbclient_connection.h b/src/mongo/client/dbclient_connection.h index 02465fa8387..9187852758d 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 a "hello" command during connection. If the hook + * A hook used to validate the reply of an 'isMaster' 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& helloReply)>; + std::function<Status(const executor::RemoteCommandResponse& isMasterReply)>; /** @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 "hello" after creating a TCP connection to the - * remote host. This method should be used only when calling "hello" would create a deadlock, + * 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, * 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 c7a070f4f31..ad8eba20d77 100644 --- a/src/mongo/client/dbclient_cursor.h +++ b/src/mongo/client/dbclient_cursor.h @@ -176,10 +176,6 @@ 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/mongo_uri_test.cpp b/src/mongo/client/mongo_uri_test.cpp index 723f03f6c60..f8c3027fb20 100644 --- a/src/mongo/client/mongo_uri_test.cpp +++ b/src/mongo/client/mongo_uri_test.cpp @@ -34,7 +34,6 @@ #include <fstream> #include "mongo/base/string_data.h" -#include "mongo/bson/bson_validate.h" #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsontypes.h" #include "mongo/bson/json.h" @@ -583,7 +582,7 @@ BSONObj getBsonFromJsonFile(std::string fileName) { std::ifstream infile(filename.c_str()); std::string data((std::istreambuf_iterator<char>(infile)), std::istreambuf_iterator<char>()); BSONObj obj = fromjson(data); - ASSERT_TRUE(validateBSON(obj).isOK()); + ASSERT_TRUE(obj.valid()); ASSERT_TRUE(obj.hasField("tests")); BSONObj arr = obj.getField("tests").embeddedObject().getOwned(); ASSERT_TRUE(arr.couldBeArray()); diff --git a/src/mongo/client/read_preference.cpp b/src/mongo/client/read_preference.cpp index 6322e5ac84f..6851e1a8af7 100644 --- a/src/mongo/client/read_preference.cpp +++ b/src/mongo/client/read_preference.cpp @@ -106,17 +106,13 @@ ReadPreferenceSetting::ReadPreferenceSetting(ReadPreference pref, hedgingMode(std::move(hedgingMode)) {} ReadPreferenceSetting::ReadPreferenceSetting(ReadPreference pref, Seconds maxStalenessSeconds) - : ReadPreferenceSetting(pref, defaultTagSetForMode(pref), maxStalenessSeconds) { - _usedDefaultReadPrefValue = true; -} + : ReadPreferenceSetting(pref, defaultTagSetForMode(pref), maxStalenessSeconds) {} ReadPreferenceSetting::ReadPreferenceSetting(ReadPreference pref, TagSet tags) : pref(std::move(pref)), tags(std::move(tags)) {} ReadPreferenceSetting::ReadPreferenceSetting(ReadPreference pref) - : ReadPreferenceSetting(pref, defaultTagSetForMode(pref)) { - _usedDefaultReadPrefValue = true; -} + : ReadPreferenceSetting(pref, defaultTagSetForMode(pref)) {} StatusWith<ReadPreferenceSetting> ReadPreferenceSetting::fromInnerBSON(const BSONObj& readPrefObj) { std::string modeStr; diff --git a/src/mongo/client/read_preference.h b/src/mongo/client/read_preference.h index b660f8a5709..837d7391f41 100644 --- a/src/mongo/client/read_preference.h +++ b/src/mongo/client/read_preference.h @@ -123,9 +123,7 @@ struct ReadPreferenceSetting { ReadPreferenceSetting(ReadPreference pref, Seconds maxStalenessSeconds); ReadPreferenceSetting(ReadPreference pref, TagSet tags); explicit ReadPreferenceSetting(ReadPreference pref); - ReadPreferenceSetting() : ReadPreferenceSetting(ReadPreference::PrimaryOnly) { - _usedDefaultReadPrefValue = true; - } + ReadPreferenceSetting() : ReadPreferenceSetting(ReadPreference::PrimaryOnly) {} inline bool equals(const ReadPreferenceSetting& other) const { auto hedgingModeEquals = [](const boost::optional<HedgingMode>& hedgingModeA, @@ -170,9 +168,7 @@ struct ReadPreferenceSetting { toContainingBSON(&bob); return bob.obj(); } - bool usedDefaultReadPrefValue() const { - return _usedDefaultReadPrefValue; - } + /** * Parses a ReadPreferenceSetting from a BSON document of the form: * { mode: <mode>, tags: <array of tags>, maxStalenessSeconds: Number, hedge: <hedgingMode>}. @@ -230,9 +226,6 @@ struct ReadPreferenceSetting { * Either way, it must be that a node opTime of X implies ClusterTime >= X. */ Timestamp minClusterTime{}; - -private: - bool _usedDefaultReadPrefValue = false; }; } // namespace mongo diff --git a/src/mongo/client/replica_set_monitor_integration_test.cpp b/src/mongo/client/replica_set_monitor_integration_test.cpp index 90687af4d13..383411d0d61 100644 --- a/src/mongo/client/replica_set_monitor_integration_test.cpp +++ b/src/mongo/client/replica_set_monitor_integration_test.cpp @@ -157,6 +157,7 @@ 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 c440f5b0b8f..52db50f277c 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& helloRequest, - const executor::RemoteCommandResponse& helloReply) { + const BSONObj& isMasterRequest, + const executor::RemoteCommandResponse& isMasterReply) { 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 (helloReply.status.isOK()) { + if (isMasterReply.status.isOK()) { publisher->onServerHandshakeCompleteEvent( - *helloReply.elapsed, remoteHost, helloReply.data); + *isMasterReply.elapsed, remoteHost, isMasterReply.data); } else { publisher->onServerHandshakeFailedEvent( - remoteHost, helloReply.status, helloReply.data); + remoteHost, isMasterReply.status, isMasterReply.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 = helloReply.status); + "handshakeStatus"_attr = isMasterReply.status); return exception.toStatus(); } } @@ -141,6 +141,10 @@ void ReplicaSetMonitorManager::_setupTaskExecutorAndStatsInLock() { return; } + if (!_stats) { + _stats = std::make_shared<ReplicaSetMonitorManagerStats>(); + } + // construct task executor auto hookList = std::make_unique<rpc::EgressMetadataHookList>(); auto networkConnectionHook = std::make_unique<ReplicaSetMonitorManagerNetworkConnectionHook>(); @@ -219,6 +223,7 @@ shared_ptr<ReplicaSetMonitor> ReplicaSetMonitorManager::getMonitorForHost(const vector<string> ReplicaSetMonitorManager::getAllSetNames() const { vector<string> allNames; + stdx::lock_guard<Latch> lk(_mutex); for (const auto& entry : _monitors) { @@ -312,31 +317,30 @@ void ReplicaSetMonitorManager::removeAllMonitors() { } void ReplicaSetMonitorManager::report(BSONObjBuilder* builder, bool forFTDC) { - std::vector<std::shared_ptr<ReplicaSetMonitor>> monitors; - int numMonitorsCreated; - // Gather relevant data under the lock. Separate out writing it to BSON. - { - stdx::lock_guard lk(_mutex); - _doGarbageCollectionLocked(lk); - for (const auto& [_, weakMonitor] : _monitors) { - if (auto monitor = weakMonitor.lock()) - monitors.push_back(std::move(monitor)); - } - numMonitorsCreated = _numMonitorsCreated; - } - // Now write out the data. - builder->appendNumber("numReplicaSetMonitorsCreated", numMonitorsCreated); + // Don't hold _mutex the whole time to avoid ever taking a monitor's mutex while holding the + // manager's mutex. Otherwise we could get a deadlock between the manager's, monitor's, and + // ShardRegistry's mutex due to the ReplicaSetMonitor's AsynchronousConfigChangeHook + // potentially calling ShardRegistry::updateConfigServerConnectionString. + auto setNames = getAllSetNames(); + + builder->appendNumber("numReplicaSetMonitorsCreated", _numMonitorsCreated); { BSONObjBuilder setStats( builder->subobjStart(forFTDC ? "replicaSetPingTimesMillis" : "replicaSets")); - for (const auto& monitor : monitors) { + for (const auto& setName : setNames) { + auto monitor = getMonitor(setName); + if (!monitor) { + continue; + } monitor->appendInfo(setStats, forFTDC); } } - _stats->report(builder, forFTDC); + if (_stats) { + _stats->report(builder, forFTDC); + } } std::shared_ptr<executor::TaskExecutor> ReplicaSetMonitorManager::getExecutor() { diff --git a/src/mongo/client/replica_set_monitor_manager.h b/src/mongo/client/replica_set_monitor_manager.h index 1bb632ab85c..2e26ba87769 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& helloRequest, - const executor::RemoteCommandResponse& helloReply) override; + const BSONObj& isMasterRequest, + const executor::RemoteCommandResponse& isMasterReply) override; StatusWith<boost::optional<executor::RemoteCommandRequest>> makeRequest( const HostAndPort& remoteHost) override; @@ -227,9 +227,8 @@ private: // Used for tests. Counter64 _monitorsGarbageCollected; - // Pointee is internally synchronized. - const std::shared_ptr<ReplicaSetMonitorManagerStats> _stats = - std::make_shared<ReplicaSetMonitorManagerStats>(); + // Internally synchronized. + std::shared_ptr<ReplicaSetMonitorManagerStats> _stats; }; } // namespace mongo diff --git a/src/mongo/client/replica_set_monitor_server_parameters.idl b/src/mongo/client/replica_set_monitor_server_parameters.idl index 6baf9ee6253..c1cf9f3322a 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 "hello" with exhaust, the 'sdam' compliant + both SDAM compliant and allows for awaitable isMaster 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 3bc0127f057..f8bd43f8d4d 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 "hello" command to. -- A "hello" response, for example `{ok: 1, isWritablePrimary: true}`. + This is the address the client sent the "ismaster" command to. +- An ismaster response, for example `{ok: 1, ismaster: 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 "hello". + when attempting to call "ismaster". 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 "hello" responses +have been published by the client as a result of processing ismaster 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 "hello" responses +combined with the events published during processing of ismaster 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 "hello" responses from the test file +without any network I/O, by parsing ismaster 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 2ff33116a40..0e2c68bf1f7 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, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "a:27017", @@ -26,7 +26,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 3ad398be5c4..878c1d8df54 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, - "isWritablePrimary": true, + "ismaster": 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 f7931d6f484..98d72b5ccbe 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, - "isWritablePrimary": true, + "ismaster": 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 58bc42e6b2f..5ee3b27478d 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017" ], @@ -47,7 +47,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 fe8464aad52..a8ff093cb8e 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, - "isWritablePrimary": true, + "ismaster": 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 473ae8fd0e8..7210b3845c7 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, - "isWritablePrimary": false, + "ismaster": 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 7d8a3777c23..f464134f12e 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, - "isWritablePrimary": false, + "ismaster": false, "secondary": true, "setName": "rs", "hosts": [ @@ -47,7 +47,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": false, "secondary": true, "setName": "rs", "primary": "d:27017", @@ -91,7 +91,7 @@ "d:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "b:27017", @@ -138,7 +138,7 @@ "c:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 4a489f68ab5..57ed568e3b0 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, - "isWritablePrimary": false, + "ismaster": false, "secondary": true, "setName": "rs", "hosts": [ @@ -47,7 +47,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": false, "secondary": true, "setName": "rs", "primary": "d:27017", @@ -91,7 +91,7 @@ "d:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "b:27017", @@ -134,7 +134,7 @@ "c:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 0e8efc46cf7..f8d20b350df 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -26,7 +26,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 994b69cece6..bf22cbb0eb5 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, - "isWritablePrimary": false, + "ismaster": 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 2d5b577cd67..4f2351cf05c 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, - "isWritablePrimary": true, + "ismaster": 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 2aae7c37fe7..1d59b967c40 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, - "isWritablePrimary": true, + "ismaster": 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 589671a1a75..193eea0c767 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, - "isWritablePrimary": true, + "ismaster": 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 dd485e0113b..93ba88e6617 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, - "isWritablePrimary": true, + "ismaster": 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 963f8801a54..0b0c2c6a885 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017", @@ -57,7 +57,7 @@ "d:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": false, "isreplicaset": true, "setVersion": 1, "electionId": { @@ -98,7 +98,7 @@ "e:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": false, "hosts": [ "a:27017", "b:27017", @@ -144,7 +144,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": false, "secondary": true, "hosts": [ "a:27017", @@ -192,7 +192,7 @@ "c:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": false, "setName": "rs", "hidden": true, "logicalSessionTimeoutMinutes": 1, @@ -234,7 +234,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 f815374842d..9f970baccea 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, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "a:27017", @@ -45,7 +45,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 cb2eaec426c..bcd95719342 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, - "isWritablePrimary": true, + "ismaster": true, "setVersion": 1, "electionId": { "$oid": "000000000000000000000001" @@ -40,7 +40,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 600dba83d3e..d22450decc7 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, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "a:27017", @@ -45,7 +45,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 6c88dc2399f..67f314b1edc 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -54,7 +54,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -100,7 +100,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 cebdf9ab4e2..c1ec50c845c 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -54,7 +54,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -100,7 +100,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 39977609075..9940b47b6e4 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -45,7 +45,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 6cfd75168fc..4d0b0ae629b 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, - "isWritablePrimary": true, + "ismaster": 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 c89522275c1..e854e7fb432 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, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "me": "A:27017", "hosts": [ @@ -51,7 +51,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 0f03c0b6c7f..3d6f7655576 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017", @@ -52,7 +52,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017", @@ -104,7 +104,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017", @@ -154,7 +154,7 @@ "c:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 881b6cf07a2..6ff0ecc0b06 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017" ], @@ -40,7 +40,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 18b3e3e4427..92acf6cca2f 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017" ], @@ -40,7 +40,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 9bb846dcd6a..3e7144057ca 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, - "isWritablePrimary": true, + "ismaster": 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 247cab35cc4..366df6e3500 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017" ], @@ -40,7 +40,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 627518d4c88..67c95de6b14 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, - "isWritablePrimary": true, + "ismaster": 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 a374e3e4fbb..59c8faf1805 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -26,7 +26,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -101,7 +101,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -144,7 +144,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -190,7 +190,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 f1e2c0097c1..beb023e4f41 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -26,7 +26,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -101,7 +101,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -144,7 +144,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -190,7 +190,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 d516af6f715..bad86c8175d 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, - "isWritablePrimary": false, + "ismaster": false, "secondary": true, "me": "c:27017", "hosts": [ @@ -39,7 +39,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 5259d2398e6..381edc7e4b1 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" ], - "isWritablePrimary": true, + "ismaster": 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 65eedff59bd..4595bb93a78 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, - "isWritablePrimary": false, + "ismaster": false, "secondary": true, "setName": "rs", "hosts": [ @@ -42,7 +42,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "a:27017", @@ -79,7 +79,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "a:27017", @@ -121,7 +121,7 @@ "c:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 e28a7211bb4..ade818740ac 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -46,7 +46,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 2bb9523b9f5..c656ebf35d6 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, - "isWritablePrimary": true, + "ismaster": 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 e0cb697d519..36e5d1e44f2 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, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "a:27017" @@ -40,7 +40,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 2c90cdc7172..c575501d803 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, - "isWritablePrimary": false, + "ismaster": false, "secondary": true, "hidden": true, "hosts": [ @@ -24,7 +24,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 99c3aa6622e..28fc85fc494 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, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "a:27017", @@ -26,7 +26,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 133aafdc406..4867b07844e 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, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "a:27017", @@ -26,7 +26,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 7df79c73c01..d2a70f67889 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" ], - "isWritablePrimary": false, + "ismaster": 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 be621c06c83..4c132b633e1 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, - "isWritablePrimary": false, + "ismaster": 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 3e7b1f83ed9..0bca723e5c3 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -45,7 +45,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 d90e097de75..d3fa9acb3c2 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -55,7 +55,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -102,7 +102,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 c5c8107d0af..07ec55cee1c 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -46,7 +46,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 ca6b0e77b45..fcf35ce5041 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017" ], @@ -40,7 +40,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 f2b65b843be..299b6fa9aab 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, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "a:27017", @@ -26,7 +26,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 0056594f943..e1ad154ba69 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, - "isWritablePrimary": true, + "ismaster": true, "setName": "rs", "hosts": [ "a:27017", @@ -26,7 +26,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": false, + "ismaster": 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 b89547959d6..b9440de5805 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, - "isWritablePrimary": true, + "ismaster": 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 63635c9c419..365af2f7e19 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, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -54,7 +54,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "hosts": [ "a:27017", "b:27017" @@ -97,7 +97,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 cc4e3e963ce..45be2f502b2 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, - "isWritablePrimary": false, + "ismaster": 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 3f6df3e09e5..3dae1f7ea1e 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, - "isWritablePrimary": true, + "ismaster": true, "msg": "isdbgrid", "minWireVersion": 0, "maxWireVersion": 1000 @@ -18,7 +18,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 7a46adee517..96f8dec17ac 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, - "isWritablePrimary": true, + "ismaster": true, "msg": "isdbgrid", "logicalSessionTimeoutMinutes": 1, "minWireVersion": 0, @@ -19,7 +19,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "msg": "isdbgrid", "logicalSessionTimeoutMinutes": 2, "minWireVersion": 0, @@ -49,7 +49,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "msg": "isdbgrid", "logicalSessionTimeoutMinutes": 1, "minWireVersion": 0, @@ -60,7 +60,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 f0f98648a78..04015694a8d 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, - "isWritablePrimary": true, + "ismaster": true, "msg": "isdbgrid", "minWireVersion": 0, "maxWireVersion": 6 @@ -18,7 +18,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "msg": "isdbgrid", "minWireVersion": 0, "maxWireVersion": 6 @@ -70,7 +70,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 75398360994..6e60fd05c7d 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, - "isWritablePrimary": true, + "ismaster": true, "msg": "isdbgrid", "minWireVersion": 0, "maxWireVersion": 6 @@ -18,7 +18,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 553c8debf74..7bf039d9bc8 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, - "isWritablePrimary": true, + "ismaster": true, "msg": "isdbgrid", "minWireVersion": 0, "maxWireVersion": 6 @@ -18,7 +18,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 b4f9f149516..9521e117899 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, - "isWritablePrimary": true, + "ismaster": true, "msg": "isdbgrid", "minWireVersion": 999, "maxWireVersion": 1000 @@ -18,7 +18,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 41ffed925d2..6bd187f61db 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, - "isWritablePrimary": true, + "ismaster": true, "msg": "isdbgrid", "minWireVersion": 2, "maxWireVersion": 6 @@ -18,7 +18,7 @@ "b:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": 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 9c91ae1db1b..ee6b847ade7 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, - "isWritablePrimary": true, + "ismaster": 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 f0b2cfe0a48..44581501862 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, - "isWritablePrimary": true, + "ismaster": 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 d1ec4ad53b5..a7fa0794901 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, - "isWritablePrimary": true, + "ismaster": 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 461a032ac0c..3ef374d6f1e 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, - "isWritablePrimary": false, + "ismaster": 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 10d0b5452aa..bd5aaf7f044 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, - "isWritablePrimary": true, + "ismaster": 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 48595ac4d73..3b4f3c8c5ad 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, - "isWritablePrimary": false, + "ismaster": 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 37bfa86fcf9..a40debd1838 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, - "isWritablePrimary": false, + "ismaster": 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 373d4ebc9a9..2ecff9b9ae2 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, - "isWritablePrimary": true, + "ismaster": 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 e48f6151f98..ae6c8ba11be 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, - "isWritablePrimary": true, + "ismaster": 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 c27ed1d9c4a..06f71305dc0 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 isWritablePrimary response", + "description": "Handle a not-ok ismaster response", "uri": "mongodb://a", "phases": [ { @@ -8,7 +8,7 @@ "a:27017", { "ok": 1, - "isWritablePrimary": true, + "ismaster": true, "minWireVersion": 0, "maxWireVersion": 6 } @@ -17,7 +17,7 @@ "a:27017", { "ok": 0, - "isWritablePrimary": true, + "ismaster": 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 de6ffaa84dc..be1a73d30b8 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, - "isWritablePrimary": true, + "ismaster": 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 5320c4a2613..38e4621d60f 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, - "isWritablePrimary": true, + "ismaster": 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 55ef82acb71..fbf68262c02 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, - "isWritablePrimary": true + "ismaster": true } ] ], diff --git a/src/mongo/client/sdam/sdam_configuration.h b/src/mongo/client/sdam/sdam_configuration.h index 2a34b860ea7..f1b1122936c 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 "hello" responses. + * The frequency at which we measure RTT and IsMaster 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 851cfa307d3..f36a6d9144b 100644 --- a/src/mongo/client/sdam/sdam_configuration_parameters.idl +++ b/src/mongo/client/sdam/sdam_configuration_parameters.idl @@ -32,9 +32,7 @@ global: server_parameters: heartBeatFrequencyMs: - description: "For the 'sdam' replicaSetMonitorProtocol, determines how long to wait between - 'hello' requests. For the 'streamable' replicaSetMonitorProtocol, duration between rtt - measurements." + description: For the 'sdam' replicaSetMonitorProtocol, determines how long to wait between isMaster 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 431d281a8f7..b3fdcba09f0 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 bsonHello = pair[1].Obj(); + const auto bsonIsMaster = pair[1].Obj(); - if (bsonHello.nFields() == 0) { - _helloResponses.push_back(HelloOutcome(address, BSONObj(), "network error")); + if (bsonIsMaster.nFields() == 0) { + _isMasterResponses.push_back(HelloOutcome(address, BSONObj(), "network error")); } else { - _helloResponses.push_back( - HelloOutcome(address, bsonHello, duration_cast<HelloRTT>(kLatency))); + _isMasterResponses.push_back( + HelloOutcome(address, bsonIsMaster, duration_cast<HelloRTT>(kLatency))); } } _topologyOutcome = phase["outcome"].Obj(); @@ -109,7 +109,7 @@ public: PhaseResult execute(TopologyManager& topology) const { PhaseResult testResult{{}, _phaseNum}; - for (auto response : _helloResponses) { + for (auto response : _isMasterResponses) { auto descriptionStr = (response.getResponse()) ? response.getResponse()->toString() : "[ Network Error ]"; LOGV2(20202, @@ -418,7 +418,7 @@ private: MongoURI _testUri; int _phaseNum; - std::vector<HelloOutcome> _helloResponses; + std::vector<HelloOutcome> _isMasterResponses; BSONObj _topologyOutcome; }; diff --git a/src/mongo/client/sdam/server_description.cpp b/src/mongo/client/sdam/server_description.cpp index a3e8b7f0899..babe5d1a777 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("isWritablePrimary")) { + } else if (hasSetName && helloReply.getBoolField("ismaster")) { 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 9ca83dd1c63..b4cbc940c28 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("isWritablePrimary", true).append("setName", "foo").obj(); + okBuilder().append("ismaster", 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, ShouldParseTypeAsUnknownForHelloError) { +TEST_F(ServerDescriptionTestFixture, ShouldParseTypeAsUnknownForIsMasterError) { 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) { - // "isWritablePrimary: true", "setName" in response + // "ismaster: 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 051cc4d9d8e..5da205b53e1 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" - << "isWritablePrimary" << true), + << "ismaster" << true), HelloRTT(Milliseconds(_newRtt))))); } diff --git a/src/mongo/client/sdam/server_selector.cpp b/src/mongo/client/sdam/server_selector.cpp index 76d08324f03..5dd58d95684 100644 --- a/src/mongo/client/sdam/server_selector.cpp +++ b/src/mongo/client/sdam/server_selector.cpp @@ -230,40 +230,35 @@ bool SdamServerSelector::_containsAllTags(ServerDescriptionPtr server, const BSO void SdamServerSelector::filterTags(std::vector<ServerDescriptionPtr>* servers, const TagSet& tagSet) { - const auto& tagSetList = tagSet.getTagBSON(); + const auto& checkTags = tagSet.getTagBSON(); - if (tagSetList.isEmpty()) { + if (checkTags.nFields() == 0) return; - } - 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; + 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; } - 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; - } - } + // remove the server + return true; + }; - // 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(); + servers->erase(std::remove_if(servers->begin(), servers->end(), predicate), servers->end()); } 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 7d2a3ee79a3..f9d67676e2c 100644 --- a/src/mongo/client/sdam/server_selector_test.cpp +++ b/src/mongo/client/sdam/server_selector_test.cpp @@ -656,9 +656,7 @@ TEST_F(ServerSelectorTestFixture, ShouldFilterByTags) { tags = TagSets::eastOrWestProductionSet; servers = makeServerDescriptionList(); selector.filterTags(&servers, tags); - ASSERT_EQ(1, servers.size()); - ASSERT((std::map<std::string, std::string>{{"dc", "east"}, {"usage", "production"}}) == - servers[0]->getTags()); + ASSERT_EQ(2, servers.size()); 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 d6cd0ceb6c8..fb306d9158d 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 = _serverHelloReplies.find(hostAndPort); - if (it != _serverHelloReplies.end()) { + auto it = _serverIsMasterReplies.find(hostAndPort); + if (it != _serverIsMasterReplies.end()) { it->second.emplace_back(Status::OK()); } else { - _serverHelloReplies.emplace(hostAndPort, std::vector<Status>{Status::OK()}); + _serverIsMasterReplies.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 = _serverHelloReplies.find(hostAndPort); - if (it != _serverHelloReplies.end()) { + auto it = _serverIsMasterReplies.find(hostAndPort); + if (it != _serverIsMasterReplies.end()) { it->second.emplace_back(errorStatus); } else { - _serverHelloReplies.emplace(hostAndPort, std::vector<Status>{errorStatus}); + _serverIsMasterReplies.emplace(hostAndPort, std::vector<Status>{errorStatus}); } } -bool TopologyListenerMock::hasHelloResponse(const HostAndPort& hostAndPort) { +bool TopologyListenerMock::hasIsMasterResponse(const HostAndPort& hostAndPort) { stdx::lock_guard lock(_mutex); - return _hasHelloResponse(lock, hostAndPort); + return _hasIsMasterResponse(lock, hostAndPort); } -bool TopologyListenerMock::_hasHelloResponse(WithLock, const HostAndPort& hostAndPort) { - return _serverHelloReplies.find(hostAndPort) != _serverHelloReplies.end(); +bool TopologyListenerMock::_hasIsMasterResponse(WithLock, const HostAndPort& hostAndPort) { + return _serverIsMasterReplies.find(hostAndPort) != _serverIsMasterReplies.end(); } -std::vector<Status> TopologyListenerMock::getHelloResponse(const HostAndPort& hostAndPort) { +std::vector<Status> TopologyListenerMock::getIsMasterResponse(const HostAndPort& hostAndPort) { stdx::lock_guard lock(_mutex); - invariant(_hasHelloResponse(lock, hostAndPort)); - auto it = _serverHelloReplies.find(hostAndPort); - auto statusWithHelloResponse = it->second; - _serverHelloReplies.erase(it); - return statusWithHelloResponse; + invariant(_hasIsMasterResponse(lock, hostAndPort)); + auto it = _serverIsMasterReplies.find(hostAndPort); + auto statusWithIsMasterResponse = it->second; + _serverIsMasterReplies.erase(it); + return statusWithIsMasterResponse; } 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 d8f99eb5a88..ad8db6f46da 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 _serverHelloReplies contains an element corresponding to hostAndPort. + * Returns true if _serverIsMasterReplies contains an element corresponding to hostAndPort. */ - bool hasHelloResponse(const HostAndPort& hostAndPort); - bool _hasHelloResponse(WithLock, const HostAndPort& hostAndPort); + bool hasIsMasterResponse(const HostAndPort& hostAndPort); + bool _hasIsMasterResponse(WithLock, const HostAndPort& hostAndPort); /** * Returns the responses for the most recent onServerHeartbeat events. */ - std::vector<Status> getHelloResponse(const HostAndPort& hostAndPort); + std::vector<Status> getIsMasterResponse(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>> _serverHelloReplies; + stdx::unordered_map<HostAndPort, std::vector<Status>> _serverIsMasterReplies; 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 0c67a25fb59..8c3b45fef38 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("isWritablePrimary", true) + .append("ismaster", 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 8ff6c8a9848..5c8cb94c954 100644 --- a/src/mongo/client/sdam/topology_state_machine.cpp +++ b/src/mongo/client/sdam/topology_state_machine.cpp @@ -154,11 +154,14 @@ void TopologyStateMachine::onServerDescription(TopologyDescription& topologyDesc const ServerDescriptionPtr& serverDescription) { if (!topologyDescription.containsServerAddress(serverDescription->getAddress())) { const auto& setName = topologyDescription.getSetName(); - 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()); + 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()); return; } diff --git a/src/mongo/client/server_discovery_monitor.cpp b/src/mongo/client/server_discovery_monitor.cpp index 0cd639e76af..27f77214a64 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("hello", 1); + bob.append("isMaster", 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("hello", 1); + bob.append("isMaster", 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 1806a51d0e2..cb89d0229c3 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> timeElapsedSinceLastHello; + boost::optional<Milliseconds> timeElapsedSinceLastIsMaster; Milliseconds previousRefreshPeriod; boost::optional<Milliseconds> expectedResult; }; @@ -47,11 +47,11 @@ public: void verifyTestCase(TestCase testCase) { LOGV2_INFO(4712103, "TestCase", - "timeElapsedSinceLastHello"_attr = testCase.timeElapsedSinceLastHello, + "timeElapsedSinceLastIsMaster"_attr = testCase.timeElapsedSinceLastIsMaster, "previousRefreshPeriod"_attr = testCase.previousRefreshPeriod, "expeditedRefreshPeriod"_attr = kExpeditedRefreshPeriod); auto result = SingleServerDiscoveryMonitor::calculateExpeditedDelayUntilNextCheck( - testCase.timeElapsedSinceLastHello, + testCase.timeElapsedSinceLastIsMaster, 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 98dc5d0d007..8747ccfc96d 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 "hello" to the server. + * Sets up a SingleServerDiscoveryMonitor that starts sending isMasters to the server. */ std::shared_ptr<SingleServerDiscoveryMonitor> initSingleServerDiscoveryMonitor( const sdam::SdamConfiguration& sdamConfiguration, const HostAndPort& hostAndPort, MockReplicaSet* replSet) { - 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. + 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. ASSERT_EQ(getStartDate(), getNet()->now()); - return ssHelloMonitor; + return ssIsMasterMonitor; } std::shared_ptr<ServerDiscoveryMonitor> initServerDiscoveryMonitor( const MongoURI& setUri, const sdam::SdamConfiguration& sdamConfiguration, const sdam::TopologyDescriptionPtr topologyDescription) { - auto serverHelloMonitor = std::make_shared<ServerDiscoveryMonitor>( + auto serverIsMasterMonitor = 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 "hello" request was sent. + // of when the first isMaster request was sent. ASSERT_EQ(getStartDate(), getNet()->now()); - return serverHelloMonitor; + return serverIsMasterMonitor; } /** - * 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. + * 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. */ - void processHelloRequest(MockReplicaSet* replSet, - boost::optional<HostAndPort> hostAndPort = boost::none) { + void processIsMasterRequest(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("hello", request); + executor::TaskExecutorTest::assertRemoteCommandNameEquals("isMaster", request); auto requestHost = request.target.toString(); if (hostAndPort) { ASSERT_EQ(request.target, hostAndPort); @@ -201,55 +201,55 @@ protected: } /** - * Checks that exactly one successful "hello" occurs within a time interval of + * Checks that exactly one successful isMaster occurs within a time interval of * heartbeatFrequency. */ - void checkSingleHello(Milliseconds heartbeatFrequency, - const HostAndPort& hostAndPort, - MockReplicaSet* replSet) { + void checkSingleIsMaster(Milliseconds heartbeatFrequency, + const HostAndPort& hostAndPort, + MockReplicaSet* replSet) { auto deadline = elapsed() + heartbeatFrequency; - processHelloRequest(replSet, hostAndPort); + processIsMasterRequest(replSet, hostAndPort); - while (elapsed() < deadline && !_topologyListener->hasHelloResponse(hostAndPort)) { + while (elapsed() < deadline && !_topologyListener->hasIsMasterResponse(hostAndPort)) { advanceTime(Milliseconds(1)); } - validateHelloResponse(hostAndPort, deadline); + validateIsMasterResponse(hostAndPort, deadline); checkNoActivityBefore(deadline, hostAndPort); } - void validateHelloResponse(const HostAndPort& hostAndPort, Milliseconds deadline) { - ASSERT_TRUE(_topologyListener->hasHelloResponse(hostAndPort)); + void validateIsMasterResponse(const HostAndPort& hostAndPort, Milliseconds deadline) { + ASSERT_TRUE(_topologyListener->hasIsMasterResponse(hostAndPort)); ASSERT_LT(elapsed(), deadline); - auto helloResponse = _topologyListener->getHelloResponse(hostAndPort); + auto isMasterResponse = _topologyListener->getIsMasterResponse(hostAndPort); - // There should only be one "hello" response queued up. - ASSERT_EQ(helloResponse.size(), 1); - ASSERT(helloResponse[0].isOK()); + // There should only be one isMaster response queued up. + ASSERT_EQ(isMasterResponse.size(), 1); + ASSERT(isMasterResponse[0].isOK()); } /** - * 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. + * 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. */ void checkNoActivityBefore(Milliseconds deadline, boost::optional<HostAndPort> hostAndPort = boost::none) { while (elapsed() < deadline) { ASSERT_FALSE(hasReadyRequests()); if (hostAndPort) { - ASSERT_FALSE(_topologyListener->hasHelloResponse(hostAndPort.get())); + ASSERT_FALSE(_topologyListener->hasIsMasterResponse(hostAndPort.get())); } advanceTime(Milliseconds(1)); } } /** - * 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. + * 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. * - * NOTE: The time between each "hello" request is the heartbeatFrequency compounded by response + * NOTE: The time between each isMaster request is the heartbeatFrequency compounded by response * time. */ - void waitForNextHello(Milliseconds timeoutMS) { + void waitForNextIsMaster(Milliseconds timeoutMS) { auto deadline = elapsed() + timeoutMS; while (!hasReadyRequests() && elapsed() < deadline) { advanceTime(Milliseconds(1)); @@ -272,7 +272,7 @@ private: }; /** - * Checks that a SingleServerDiscoveryMonitor sends "hello" requests at least heartbeatFrequency + * Checks that a SingleServerDiscoveryMonitor sends isMaster 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 ssHelloMonitor = initSingleServerDiscoveryMonitor(config, hostAndPort, replSet.get()); - ssHelloMonitor->disableExpeditedChecking(); + auto ssIsMasterMonitor = initSingleServerDiscoveryMonitor(config, hostAndPort, replSet.get()); + ssIsMasterMonitor->disableExpeditedChecking(); - // A "hello" command fails if it takes as long or longer than timeoutMS. + // An isMaster command fails if it takes as long or longer than timeoutMS. auto timeoutMS = config.getConnectionTimeout(); auto heartbeatFrequency = config.getHeartBeatFrequency(); - 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); + checkSingleIsMaster(heartbeatFrequency, hostAndPort, replSet.get()); + waitForNextIsMaster(timeoutMS); } /** - * Confirms that a SingleServerDiscoveryMonitor reports to the TopologyListener when a "hello" + * Confirms that a SingleServerDiscoveryMonitor reports to the TopologyListener when an isMaster * 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 ssHelloMonitor = initSingleServerDiscoveryMonitor(config, hostAndPort, replSet.get()); - ssHelloMonitor->disableExpeditedChecking(); + auto ssIsMasterMonitor = initSingleServerDiscoveryMonitor(config, hostAndPort, replSet.get()); + ssIsMasterMonitor->disableExpeditedChecking(); - processHelloRequest(replSet.get(), hostAndPort); + processIsMasterRequest(replSet.get(), hostAndPort); auto topologyListener = getTopologyListener(); auto timeoutMS = config.getConnectionTimeout(); - while (elapsed() < timeoutMS && !topologyListener->hasHelloResponse(hostAndPort)) { - // Advance time in small increments to ensure we stop before another "hello" is sent. + while (elapsed() < timeoutMS && !topologyListener->hasIsMasterResponse(hostAndPort)) { + // Advance time in small increments to ensure we stop before another isMaster is sent. advanceTime(Milliseconds(1)); } - ASSERT_TRUE(topologyListener->hasHelloResponse(hostAndPort)); - auto response = topologyListener->getHelloResponse(hostAndPort); + ASSERT_TRUE(topologyListener->hasIsMasterResponse(hostAndPort)); + auto response = topologyListener->getIsMasterResponse(hostAndPort); ASSERT_EQ(response.size(), 1); ASSERT_EQ(response[0], ErrorCodes::HostUnreachable); } -TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorOnTopologyDescriptionChangeAddHost) { +TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorOnTopologyDescriptionChangeAddHost) { auto replSet = std::make_unique<MockReplicaSet>( "test", 2, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false); @@ -345,11 +345,11 @@ TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorOnTopologyDescriptio auto sdamConfig0 = sdam::SdamConfiguration(host0Vec); auto topologyDescription0 = std::make_shared<sdam::TopologyDescription>(sdamConfig0); auto uri = replSet->getURI(); - auto helloMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0); - helloMonitor->disableExpeditedChecking(); + auto isMasterMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0); + isMasterMonitor->disableExpeditedChecking(); auto host1Delay = Milliseconds(100); - checkSingleHello(host1Delay, host0, replSet.get()); + checkSingleIsMaster(host1Delay, host0, replSet.get()); ASSERT_FALSE(hasReadyRequests()); // Start monitoring host1. @@ -358,20 +358,21 @@ TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorOnTopologyDescriptio auto sdamConfigAllHosts = sdam::SdamConfiguration(allHostsVec); auto topologyDescriptionAllHosts = std::make_shared<sdam::TopologyDescription>(sdamConfigAllHosts); - helloMonitor->onTopologyDescriptionChangedEvent(topologyDescription0, - topologyDescriptionAllHosts); + isMasterMonitor->onTopologyDescriptionChangedEvent(topologyDescription0, + topologyDescriptionAllHosts); // Ensure expedited checking is disabled for the SingleServerDiscoveryMonitor corresponding to // host1 as well. - helloMonitor->disableExpeditedChecking(); + isMasterMonitor->disableExpeditedChecking(); // Confirm host0 and host1 are monitored. auto heartbeatFrequency = sdamConfigAllHosts.getHeartBeatFrequency(); - checkSingleHello(heartbeatFrequency - host1Delay, host1, replSet.get()); - waitForNextHello(sdamConfigAllHosts.getConnectionTimeout()); - checkSingleHello(host1Delay, host0, replSet.get()); + checkSingleIsMaster(heartbeatFrequency - host1Delay, host1, replSet.get()); + waitForNextIsMaster(sdamConfigAllHosts.getConnectionTimeout()); + checkSingleIsMaster(host1Delay, host0, replSet.get()); } -TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorOnTopologyDescriptionChangeRemoveHost) { +TEST_F(ServerDiscoveryMonitorTestFixture, + serverIsMasterMonitorOnTopologyDescriptionChangeRemoveHost) { auto replSet = std::make_unique<MockReplicaSet>( "test", 2, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false); @@ -385,45 +386,45 @@ TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorOnTopologyDescriptio auto topologyDescriptionAllHosts = std::make_shared<sdam::TopologyDescription>(sdamConfigAllHosts); auto uri = replSet->getURI(); - auto helloMonitor = + auto isMasterMonitor = initServerDiscoveryMonitor(uri, sdamConfigAllHosts, topologyDescriptionAllHosts); - helloMonitor->disableExpeditedChecking(); + isMasterMonitor->disableExpeditedChecking(); // Confirm that both hosts are monitored. auto heartbeatFrequency = sdamConfigAllHosts.getHeartBeatFrequency(); while (hasReadyRequests()) { - processHelloRequest(replSet.get()); + processIsMasterRequest(replSet.get()); } auto deadline = elapsed() + heartbeatFrequency; auto topologyListener = getTopologyListener(); auto hasResponses = [&]() { - return topologyListener->hasHelloResponse(host0) && - topologyListener->hasHelloResponse(host1); + return topologyListener->hasIsMasterResponse(host0) && + topologyListener->hasIsMasterResponse(host1); }; while (elapsed() < heartbeatFrequency && !hasResponses()) { advanceTime(Milliseconds(1)); } - validateHelloResponse(host0, deadline); - validateHelloResponse(host1, deadline); + validateIsMasterResponse(host0, deadline); + validateIsMasterResponse(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); - helloMonitor->onTopologyDescriptionChangedEvent(topologyDescriptionAllHosts, - topologyDescription0); + isMasterMonitor->onTopologyDescriptionChangedEvent(topologyDescriptionAllHosts, + topologyDescription0); checkNoActivityBefore(deadline); - waitForNextHello(sdamConfig0.getConnectionTimeout()); + waitForNextIsMaster(sdamConfig0.getConnectionTimeout()); - checkSingleHello(heartbeatFrequency, host0, replSet.get()); - waitForNextHello(sdamConfig0.getConnectionTimeout()); + checkSingleIsMaster(heartbeatFrequency, host0, replSet.get()); + waitForNextIsMaster(sdamConfig0.getConnectionTimeout()); - // Confirm the next "hello" request is sent to host0 and not host1. - checkSingleHello(heartbeatFrequency, host0, replSet.get()); + // Confirm the next isMaster request is sent to host0 and not host1. + checkSingleIsMaster(heartbeatFrequency, host0, replSet.get()); } -TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorShutdownStopsHelloRequests) { +TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorShutdownStopsIsMasterRequests) { auto replSet = std::make_unique<MockReplicaSet>( "test", 1, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false); @@ -431,13 +432,13 @@ TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorShutdownStopsHelloRe auto sdamConfig = sdam::SdamConfiguration(hostVec); auto topologyDescription = std::make_shared<sdam::TopologyDescription>(sdamConfig); auto uri = replSet->getURI(); - auto helloMonitor = initServerDiscoveryMonitor(uri, sdamConfig, topologyDescription); - helloMonitor->disableExpeditedChecking(); + auto isMasterMonitor = initServerDiscoveryMonitor(uri, sdamConfig, topologyDescription); + isMasterMonitor->disableExpeditedChecking(); auto heartbeatFrequency = sdamConfig.getHeartBeatFrequency(); - checkSingleHello(heartbeatFrequency - Milliseconds(200), hostVec[0], replSet.get()); + checkSingleIsMaster(heartbeatFrequency - Milliseconds(200), hostVec[0], replSet.get()); - helloMonitor->shutdown(); + isMasterMonitor->shutdown(); // After the ServerDiscoveryMonitor shuts down, the TopologyListener may have responses until // heartbeatFrequency has passed, but none of them should indicate Status::OK. @@ -447,26 +448,27 @@ TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorShutdownStopsHelloRe // Drain any requests already scheduled. while (elapsed() < deadline) { while (hasReadyRequests()) { - processHelloRequest(replSet.get(), hostVec[0]); + processIsMasterRequest(replSet.get(), hostVec[0]); } - if (topologyListener->hasHelloResponse(hostVec[0])) { - auto helloResponses = topologyListener->getHelloResponse(hostVec[0]); - for (auto& response : helloResponses) { + if (topologyListener->hasIsMasterResponse(hostVec[0])) { + auto isMasterResponses = topologyListener->getIsMasterResponse(hostVec[0]); + for (auto& response : isMasterResponses) { ASSERT_FALSE(response.isOK()); } } advanceTime(Milliseconds(1)); } - ASSERT_FALSE(topologyListener->hasHelloResponse(hostVec[0])); + ASSERT_FALSE(topologyListener->hasIsMasterResponse(hostVec[0])); } /** * Tests that the ServerDiscoveryMonitor waits until SdamConfiguration::kMinHeartbeatFrequency has - * passed since the last "hello" was received if requestImmediateCheck() is called before enough + * passed since the last isMaster was received if requestImmediateCheck() is called before enough * time has passed. */ -TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorRequestImmediateCheckWaitMinHeartbeat) { +TEST_F(ServerDiscoveryMonitorTestFixture, + serverIsMasterMonitorRequestImmediateCheckWaitMinHeartbeat) { auto replSet = std::make_unique<MockReplicaSet>( "test", 1, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false); @@ -476,41 +478,41 @@ TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorRequestImmediateChec auto sdamConfig0 = sdam::SdamConfiguration(hostVec); auto topologyDescription0 = std::make_shared<sdam::TopologyDescription>(sdamConfig0); auto uri = replSet->getURI(); - auto helloMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0); + auto isMasterMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0); // Ensure the server is not in expedited mode *before* requestImmediateCheck(). - helloMonitor->disableExpeditedChecking(); + isMasterMonitor->disableExpeditedChecking(); - // Check that there is only one "hello" request at time t=0 up until - // timeAdvanceFromFirstHello. + // Check that there is only one isMaster request at time t=0 up until + // timeAdvanceFromFirstIsMaster. auto minHeartbeatFrequency = SdamConfiguration::kMinHeartbeatFrequency; - auto timeAdvanceFromFirstHello = Milliseconds(10); - ASSERT_LT(timeAdvanceFromFirstHello, minHeartbeatFrequency); - checkSingleHello(timeAdvanceFromFirstHello, hostVec[0], replSet.get()); + auto timeAdvanceFromFirstIsMaster = Milliseconds(10); + ASSERT_LT(timeAdvanceFromFirstIsMaster, minHeartbeatFrequency); + checkSingleIsMaster(timeAdvanceFromFirstIsMaster, hostVec[0], replSet.get()); - // 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. + // 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. auto timeRequestImmediateSent = elapsed(); - helloMonitor->requestImmediateCheck(); - waitForNextHello(minHeartbeatFrequency); + isMasterMonitor->requestImmediateCheck(); + waitForNextIsMaster(minHeartbeatFrequency); - auto timeHelloSent = elapsed(); - ASSERT_LT(timeRequestImmediateSent, timeHelloSent); - ASSERT_LT(timeHelloSent, timeRequestImmediateSent + minHeartbeatFrequency); - checkSingleHello(minHeartbeatFrequency, hostVec[0], replSet.get()); + auto timeIsMasterSent = elapsed(); + ASSERT_LT(timeRequestImmediateSent, timeIsMasterSent); + ASSERT_LT(timeIsMasterSent, timeRequestImmediateSent + minHeartbeatFrequency); + checkSingleIsMaster(minHeartbeatFrequency, hostVec[0], replSet.get()); // Confirm expedited requests continue since there is no primary. - waitForNextHello(sdamConfig0.getConnectionTimeout()); - checkSingleHello(minHeartbeatFrequency, hostVec[0], replSet.get()); + waitForNextIsMaster(sdamConfig0.getConnectionTimeout()); + checkSingleIsMaster(minHeartbeatFrequency, hostVec[0], replSet.get()); } /** * Tests that if more than SdamConfiguration::kMinHeartbeatFrequency has passed since the last - * "hello" response was received, the ServerDiscoveryMonitor sends an "hello" immediately after + * isMaster response was received, the ServerDiscoveryMonitor sends an isMaster immediately after * requestImmediateCheck() is called. */ -TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorRequestImmediateCheckNoWait) { +TEST_F(ServerDiscoveryMonitorTestFixture, serverIsMasterMonitorRequestImmediateCheckNoWait) { auto replSet = std::make_unique<MockReplicaSet>( "test", 1, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false); @@ -520,23 +522,23 @@ TEST_F(ServerDiscoveryMonitorTestFixture, ServerHelloMonitorRequestImmediateChec auto sdamConfig0 = sdam::SdamConfiguration(hostVec); auto topologyDescription0 = std::make_shared<sdam::TopologyDescription>(sdamConfig0); auto uri = replSet->getURI(); - auto helloMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0); + auto isMasterMonitor = initServerDiscoveryMonitor(uri, sdamConfig0, topologyDescription0); // Ensure the server is not in expedited mode *before* requestImmediateCheck(). - helloMonitor->disableExpeditedChecking(); + isMasterMonitor->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; - checkSingleHello(minHeartbeatFrequency + Milliseconds(10), hostVec[0], replSet.get()); + checkSingleIsMaster(minHeartbeatFrequency + Milliseconds(10), hostVec[0], replSet.get()); - helloMonitor->requestImmediateCheck(); - checkSingleHello(minHeartbeatFrequency, hostVec[0], replSet.get()); + isMasterMonitor->requestImmediateCheck(); + checkSingleIsMaster(minHeartbeatFrequency, hostVec[0], replSet.get()); // Confirm expedited requests continue since there is no primary. - waitForNextHello(sdamConfig0.getConnectionTimeout()); - checkSingleHello(minHeartbeatFrequency, hostVec[0], replSet.get()); + waitForNextIsMaster(sdamConfig0.getConnectionTimeout()); + checkSingleIsMaster(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 8d482d3234c..23353157c41 100644 --- a/src/mongo/client/server_ping_monitor.cpp +++ b/src/mongo/client/server_ping_monitor.cpp @@ -85,18 +85,11 @@ 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); @@ -156,21 +149,12 @@ 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 0a4f0369c4d..b4667e85606 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 "hello" exchange for a connection to the server succeeded. Creates a new + * The first isMaster 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 c0ae7e2f7c0..154d82ea459 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 "hello" response queued up. + // There should only be one isMaster 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 d51fd65156e..787ab86026e 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, - ApplicationNonNetworkHelloOrRecoveringError) { + ApplicationNonNetworkIsMasterOrRecoveringError) { 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 4ed75f5e7f6..b26ea37c24e 100644 --- a/src/mongo/client/streamable_replica_set_monitor_query_processor.cpp +++ b/src/mongo/client/streamable_replica_set_monitor_query_processor.cpp @@ -56,6 +56,7 @@ 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; @@ -63,7 +64,7 @@ void StreamableReplicaSetMonitor::StreamableReplicaSetMonitorQueryProcessor:: replicaSetMonitor->_processOutstanding(newDescription); } - // No set name occurs when there is an error monitoring "hello" replies (e.g. HostUnreachable). + // No set name occurs when there is an error monitoring isMaster replies (e.g. HostUnreachable). // There is nothing to do in that case. } }; // namespace mongo |
