summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorPavi Vetriselvan <pavithra.vetriselvan@mongodb.com>2020-07-30 12:39:35 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-09 15:16:20 +0000
commit2283bcea915fef023a2cf29bad76ca92d9d9b531 (patch)
tree6c846146cd17bd071e220bc187dbdadbe3fa683f /src/mongo/s
parent9cdf66a3fb6abb028986f50d45d4cd81775da042 (diff)
downloadmongo-2283bcea915fef023a2cf29bad76ca92d9d9b531.tar.gz
SERVER-49986 Convert isMaster command to hello and keep isMaster, ismaster aliases
(cherry picked from commit 9a4be902441496be7ef40e5404a91ac30dc81f77)
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/commands/cluster_is_master_cmd.cpp15
-rw-r--r--src/mongo/s/commands/strategy.cpp2
2 files changed, 13 insertions, 4 deletions
diff --git a/src/mongo/s/commands/cluster_is_master_cmd.cpp b/src/mongo/s/commands/cluster_is_master_cmd.cpp
index a71c0c28ef2..bb0fb7fec3b 100644
--- a/src/mongo/s/commands/cluster_is_master_cmd.cpp
+++ b/src/mongo/s/commands/cluster_is_master_cmd.cpp
@@ -30,6 +30,7 @@
#include "mongo/platform/basic.h"
+#include "mongo/base/string_data.h"
#include "mongo/bson/util/bson_extract.h"
#include "mongo/db/auth/sasl_mechanism_registry.h"
#include "mongo/db/client.h"
@@ -66,9 +67,17 @@ MONGO_INITIALIZER(GenerateMongosTopologyVersion)(InitializerContext*) {
namespace {
-class CmdIsMaster : public BasicCommandWithReplyBuilderInterface {
+constexpr auto kHelloString = "hello"_sd;
+// Aliases for the hello command in order to provide backwards compatibility.
+constexpr auto kCamelCaseIsMasterString = "isMaster"_sd;
+constexpr auto kLowerCaseIsMasterString = "ismaster"_sd;
+
+
+class CmdHello : public BasicCommandWithReplyBuilderInterface {
public:
- CmdIsMaster() : BasicCommandWithReplyBuilderInterface("isMaster", "ismaster") {}
+ CmdHello()
+ : BasicCommandWithReplyBuilderInterface(
+ kHelloString, {kCamelCaseIsMasterString, kLowerCaseIsMasterString}) {}
bool supportsWriteConcern(const BSONObj& cmd) const override {
return false;
@@ -245,7 +254,7 @@ public:
return true;
}
-} isMaster;
+} hello;
} // namespace
} // namespace mongo
diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp
index 52c65dd69d2..b08550220d6 100644
--- a/src/mongo/s/commands/strategy.cpp
+++ b/src/mongo/s/commands/strategy.cpp
@@ -373,7 +373,7 @@ void runCommand(OperationContext* opCtx,
opCtx->setExhaust(OpMsg::isFlagSet(m, OpMsg::kExhaustSupported));
const auto session = opCtx->getClient()->session();
if (session) {
- if (!opCtx->isExhaust() || command->getName() != "isMaster"_sd) {
+ if (!opCtx->isExhaust() || command->getName() != "hello"_sd) {
InExhaustIsMaster::get(session.get())->setInExhaustIsMaster(false);
}
}