summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavi Vetriselvan <pavithra.vetriselvan@mongodb.com>2020-08-26 18:53:01 -0400
committerPavi Vetriselvan <pavithra.vetriselvan@mongodb.com>2020-08-26 18:53:01 -0400
commita55f362289f239093215a09bca1084e8b0a7642d (patch)
tree7f2ccbbdfc2c868416bd25f0b6613f158a9c8856
parent2281bdba9429a39a4cef57d2f287459976c10382 (diff)
downloadmongo-a55f362289f239093215a09bca1084e8b0a7642d.tar.gz
Revert "SERVER-49988 Rename response fields if hello command is sent on mongos"
This reverts commit 2fa244c0e70dfe80a248747cca49ceacefd9cb50.
-rw-r--r--jstests/core/ismaster.js6
-rw-r--r--jstests/sharding/ismaster.js13
-rw-r--r--src/mongo/s/commands/cluster_is_master_cmd.cpp11
3 files changed, 7 insertions, 23 deletions
diff --git a/jstests/core/ismaster.js b/jstests/core/ismaster.js
index 5f309b83392..a8ed96a4ac1 100644
--- a/jstests/core/ismaster.js
+++ b/jstests/core/ismaster.js
@@ -16,7 +16,7 @@ function checkResponseFields(commandString) {
"maxWriteBatchSize possibly missing:" + tojson(res));
assert.eq("boolean", typeof res.ismaster, "ismaster field is not a boolean" + tojson(res));
- // TODO SERVER-49987: Check for res.isWritablePrimary instead of res.ismaster if a hello command
+ // TODO SERVER-49988: Check for res.isWritablePrimary instead of res.ismaster if a hello command
// was executed.
assert(res.ismaster === true, "ismaster field is false" + tojson(res));
assert(res.localTime, "localTime possibly missing:" + tojson(res));
@@ -56,8 +56,6 @@ function checkResponseFields(commandString) {
}
}
-// TODO SERVER-49987: add the "hello" command test back in once mongod response fields are
-// appropriately changed.
-// checkResponseFields("hello");
+checkResponseFields("hello");
checkResponseFields("ismaster");
checkResponseFields("isMaster");
diff --git a/jstests/sharding/ismaster.js b/jstests/sharding/ismaster.js
index 185294200ac..a582f677241 100644
--- a/jstests/sharding/ismaster.js
+++ b/jstests/sharding/ismaster.js
@@ -16,15 +16,10 @@ function checkResponseFields(commandString) {
res.maxMessageSizeBytes && isNumber(res.maxMessageSizeBytes) && res.maxBsonObjectSize > 0,
"maxMessageSizeBytes possibly missing:" + tojson(res));
- if (commandString === "hello") {
- assert.eq("boolean",
- typeof res.isWritablePrimary,
- "isWritablePrimary field is not a boolean" + tojson(res));
- assert(res.isWritablePrimary === true, "isWritablePrimary field is false" + tojson(res));
- } else {
- assert.eq("boolean", typeof res.ismaster, "ismaster field is not a boolean" + tojson(res));
- assert(res.ismaster === true, "ismaster field is false" + tojson(res));
- }
+ // TODO SERVER-49988: Check for res.isWritablePrimary instead of res.ismaster if a hello command
+ // was executed.
+ assert.eq("boolean", typeof res.ismaster, "ismaster field is not a boolean" + tojson(res));
+ assert(res.ismaster === true, "ismaster field is false" + tojson(res));
assert(res.localTime, "localTime possibly missing:" + tojson(res));
assert(res.msg && res.msg == "isdbgrid", "msg possibly missing or wrong:" + tojson(res));
diff --git a/src/mongo/s/commands/cluster_is_master_cmd.cpp b/src/mongo/s/commands/cluster_is_master_cmd.cpp
index 08a3da77615..bb0fb7fec3b 100644
--- a/src/mongo/s/commands/cluster_is_master_cmd.cpp
+++ b/src/mongo/s/commands/cluster_is_master_cmd.cpp
@@ -109,11 +109,6 @@ public:
waitInIsMaster.pauseWhileSet(opCtx);
- // Parse the command name, which should be one of the following: hello, isMaster, or
- // ismaster. If the command is "hello", we must attach an "isWritablePrimary" response field
- // instead of "ismaster".
- bool useLegacyResponseFields = (cmdObj.firstElementFieldNameStringData() != kHelloString);
-
auto& clientMetadataIsMasterState = ClientMetadataIsMasterState::get(opCtx->getClient());
bool seenIsMaster = clientMetadataIsMasterState.hasSeenIsMaster();
if (!seenIsMaster) {
@@ -193,11 +188,7 @@ public:
}
auto result = replyBuilder->getBodyBuilder();
- if (useLegacyResponseFields) {
- result.appendBool("ismaster", true);
- } else {
- result.appendBool("isWritablePrimary", true);
- }
+ result.appendBool("ismaster", true);
result.append("msg", "isdbgrid");
result.appendNumber("maxBsonObjectSize", BSONObjMaxUserSize);
result.appendNumber("maxMessageSizeBytes", MaxMessageSizeBytes);