[SERVER-85971] Add Session::local() and ensure uses of getHostCachedAndPort are role-aware Created: 30/Jan/24  Updated: 31/Jan/24

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: James Bronsted Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Participants:

 Description   

Currently, we use getHostCachedAndPort in a number of places to get a representation of the local endpoint for a client connection. The implementation naively interrogates serverGlobalParams for the configured shard port, which already is indirect and now suffers from loss of accuracy since the port associated with a client connection is no longer always the shard port.

Add a method to Session and its descendants that returns a HostAndPort object describing the local endpoint of its connection:

virtual const HostAndPort& local() const = 0;

Further, add a method to Client that uses this method to return a HostAndPort (or std::string) that contains the cached hostname and the local port that client is associated with and replace uses of getHostCachedAndPort with the new method in places where the port being used is dependent on the active ClusterRole (which is likely most places in the codebase).


Generated at Thu Feb 08 06:59:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.