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

Changelog entries should include port

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.1.1
    • None
    • Sharding
    • None
    • Minor Change
    • Sharding 2018-07-02

    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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: