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

Changelog entries should include port

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.1
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Minor Change
    • Sharding 2018-07-02

      Currently, entries in config.changelog have _id field which is a combination of hostname, current time, and a unique id. However, the hostname portion is only the hostname, and doesn't include the port. This makes it very difficult to track what's happening when multiple sharding components are running on the same physical host.

      Including the port with the hostname should be pretty straightforward:

      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/s/catalog/sharding_catalog_client_impl.cpp b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
      index 7ebc756..b5fcd1b 100644
      --- a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
      +++ b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
      @@ -199,17 +199,18 @@ Status ShardingCatalogClientImpl::logChange(OperationContext* opCtx,
       Status ShardingCatalogClientImpl::_log(OperationContext* opCtx,
                                              const StringData& logCollName,
                                              const std::string& what,
                                              const std::string& operationNS,
                                              const BSONObj& detail,
                                              const WriteConcernOptions& writeConcern) {
           Date_t now = Grid::get(opCtx)->getNetwork()->now();
           const std::string hostName = Grid::get(opCtx)->getNetwork()->getHostName();
      -    const string changeId = str::stream() << hostName << "-" << now.toString() << "-" << OID::gen();
      +    const string changeId = str::stream() << hostName << ":" << serverGlobalParams.port << "-"
      +                                          << now.toString() << "-" << OID::gen();
      
           ChangeLogType changeLog;
           changeLog.setChangeId(changeId);
           changeLog.setServer(hostName);
           changeLog.setClientAddr(opCtx->getClient()->clientAddress(true));
           changeLog.setTime(now);
           changeLog.setNS(operationNS);
           changeLog.setWhat(what);
      

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

              Created:
              Updated:
              Resolved: