[SERVER-35854] Log in 3.2 when client metadata is received Created: 28/Jun/18  Updated: 29/Oct/23  Resolved: 26/Jul/18

Status: Closed
Project: Core Server
Component/s: Logging
Affects Version/s: 3.2.20
Fix Version/s: 3.2.21

Type: New Feature Priority: Major - P3
Reporter: Kevin Pulo Assignee: Kevin Pulo
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-36778 Make 3.2 client metadata log messages... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

SERVER-24611 (et al) implemented client metadata in 3.4+. Before upgrading the server from 3.2 to 3.4, users must first upgrade their drivers. However, since 3.2 lacks support for client metadata, verifying that all connecting drivers have been upgraded might be difficult.

This ticket is to request that 3.2 logs when a driver supplies client metadata in the isMaster command (but without bothering doing any parsing, verification, or later usage, etc). This will allow users to verify that drivers have been correctly upgraded prior to upgrading the server. I'm imagining very simple code along these lines (and similar in s/commands/cluster_is_master_cmd.cpp):

diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp
index 50e8480..034c954 100644
--- a/src/mongo/db/repl/replication_info.cpp
+++ b/src/mongo/db/repl/replication_info.cpp
@@ -215,26 +215,31 @@ public:
     CmdIsMaster() : Command("isMaster", true, "ismaster") {}
     virtual bool run(OperationContext* txn,
                      const string&,
                      BSONObj& cmdObj,
                      int,
                      string& errmsg,
                      BSONObjBuilder& result) {
         /* currently request to arbiter is (somewhat arbitrarily) an ismaster request that is not
            authenticated.
         */
         if (cmdObj["forShell"].trueValue())
             LastError::get(txn->getClient()).disable();
 
+        BSONElement element = cmdObj["client"];
+        if (!element.eoo()) {
+            log << "client supplied metadata: " << element.jsonString(false);
+        }
+
         appendReplicationInfo(txn, result, 0);
 
         if (serverGlobalParams.configsvrMode == CatalogManager::ConfigServerMode::CSRS) {
             result.append("configsvr", 1);
         } else if (serverGlobalParams.configsvrMode == CatalogManager::ConfigServerMode::SCCC) {
             result.append("configsvr", 0);
         }
 
         result.appendNumber("maxBsonObjectSize", BSONObjMaxUserSize);
         result.appendNumber("maxMessageSizeBytes", MaxMessageSizeBytes);
         result.appendNumber("maxWriteBatchSize", BatchedCommandRequest::kMaxWriteBatchSize);
         result.appendDate("localTime", jsTime());
         result.append("maxWireVersion", WireSpec::instance().maxWireVersionIncoming);



 Comments   
Comment by Githook User [ 26/Jul/18 ]

Author:

{'name': 'Kevin Pulo', 'email': 'kevin.pulo@mongodb.com', 'username': 'devkev'}

Message: SERVER-35854 naively log received client metadata
Branch: v3.2
https://github.com/mongodb/mongo/commit/72058227a20ffded4ead6dc396db0d486b1f1753

Comment by Gregory McKeon (Inactive) [ 09/Jul/18 ]

kevin.pulo we're happy to take a PR if you have one for this.

Generated at Thu Feb 08 04:41:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.