[SERVER-35639] Changelog entries should include port Created: 18/Jun/18  Updated: 29/Oct/23  Resolved: 22/Jun/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.1.1

Type: Improvement 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
related to SERVER-49307 In changelog, report the shard name (... Closed
is related to SERVER-36411 Changelog entries should include shar... Closed
Backwards Compatibility: Minor Change
Sprint: Sharding 2018-07-02
Participants:
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);



 Comments   
Comment by Githook User [ 22/Jun/18 ]

Author:

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

Message: SERVER-35639 Include port in server name of config.changelog entries
Branch: master
https://github.com/mongodb/mongo/commit/04d8939bd9c6776da8b7effe9c4bcaa20591d88f

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