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

Changelog entries should include port

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.1
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change
    • Sprint:
      Sharding 2018-07-02
    • Case:

      Description

      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:

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: