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

TopologyDescription::clone should make a deep copy of the ServerDescriptions

    XMLWordPrintable

Details

    • Fully Compatible
    • Sharding 2021-07-12, Sharding 2021-07-26, Sharding 2021-08-09, Sharding 2021-08-23
    • 24

    Description

      Task: Before associating the server descriptions to the cloned TopologyDescription, the result (cloned) TopologyDescription’s _servers should deep copied.

      Context: TopologyDescription::clone currently makes a shallow copy of the source TopologyDescription. The result’s _servers point to the same underlying ServerDescriptions as the source’s _servers. This becomes an issue since the method mutates the underlying _servers for the source TopologyDescription as well as the result (cloned) version - causing unexpected changes when readers (primarily the ServerSelector) expect the TopologyDescription to be readonly.

      Attachments

        Issue Links

          Activity

            People

              luis.osta@mongodb.com Luis Osta (Inactive)
              haley.connelly@mongodb.com Haley Connelly
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: