Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-35854

Log in 3.2 when client metadata is received

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.2.21
    • Affects Version/s: 3.2.20
    • Component/s: Logging
    • None
    • Fully Compatible

      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):

      Unable to find source-code formatter for language: diff. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      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);
      

            Assignee:
            kevin.pulo@mongodb.com Kevin Pulo
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: