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

Add Session::local() and ensure uses of getHostCachedAndPort are role-aware

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Service Arch

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

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            james.bronsted@mongodb.com James Bronsted
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: