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);
- is related to
-
SERVER-36411 Changelog entries should include shard name
- Closed
- related to
-
SERVER-49307 In changelog, report the shard name (& server host:port) for the shard that owns the chunk, instead of CSRS replica set name (& CSRS primary host:port)
- Closed