summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/cluster_is_master_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/commands/cluster_is_master_cmd.cpp')
-rw-r--r--src/mongo/s/commands/cluster_is_master_cmd.cpp31
1 files changed, 2 insertions, 29 deletions
diff --git a/src/mongo/s/commands/cluster_is_master_cmd.cpp b/src/mongo/s/commands/cluster_is_master_cmd.cpp
index 532f29c7e04..1ae4b497576 100644
--- a/src/mongo/s/commands/cluster_is_master_cmd.cpp
+++ b/src/mongo/s/commands/cluster_is_master_cmd.cpp
@@ -42,7 +42,6 @@
#include "mongo/db/wire_version.h"
#include "mongo/logv2/log.h"
#include "mongo/rpc/metadata/client_metadata.h"
-#include "mongo/rpc/metadata/client_metadata_ismaster.h"
#include "mongo/rpc/topology_version_gen.h"
#include "mongo/s/mongos_topology_coordinator.h"
#include "mongo/transport/message_compressor_manager.h"
@@ -99,34 +98,8 @@ public:
waitInHello.pauseWhileSet(opCtx);
- auto& clientMetadataIsMasterState = ClientMetadataIsMasterState::get(opCtx->getClient());
- bool seenIsMaster = clientMetadataIsMasterState.hasSeenIsMaster();
- if (!seenIsMaster) {
- clientMetadataIsMasterState.setSeenIsMaster();
- }
-
- BSONElement element = cmdObj[kMetadataDocumentName];
- if (!element.eoo()) {
- if (seenIsMaster) {
- uasserted(ErrorCodes::ClientMetadataCannotBeMutated,
- "The client metadata document may only be sent in the first isMaster");
- }
-
- auto swParseClientMetadata = ClientMetadata::parse(element);
- uassertStatusOK(swParseClientMetadata.getStatus());
-
- invariant(swParseClientMetadata.getValue());
-
- swParseClientMetadata.getValue().get().logClientMetadata(opCtx->getClient());
-
- swParseClientMetadata.getValue().get().setMongoSMetadata(
- getHostNameCachedAndPort(),
- opCtx->getClient()->clientAddress(true),
- VersionInfoInterface::instance().version());
-
- clientMetadataIsMasterState.setClientMetadata(
- opCtx->getClient(), std::move(swParseClientMetadata.getValue()));
- }
+ auto client = opCtx->getClient();
+ ClientMetadata::tryFinalize(client);
// If a client is following the awaitable isMaster protocol, maxAwaitTimeMS should be
// present if and only if topologyVersion is present in the request.