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

Avoid self-registration in ServerParameter constructor

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 6.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Service Arch 2022-03-07, Service Arch 2022-03-21

      The fact that they register themselves into a set means their constructor has to know which set to add them to. This also makes them explicitly reliant on global parameter sets which makes them hard to test. You can't just make an instance of a ServerParameter object and test it in isolation. Such tests would have an effect on the registry. This got in the way while working on a test for SERVER-57609.

      It's also potentially dangerous to give a raw pointer to this away before the object is completely constructed. It's not causing bugs currently but it's breaking what would otherwise be a clean concept: that any parameter in the global parameter set is valid.

      Production instances of ServerParameter instances are generated by IDL with a factory pattern, we can just move the registration out of the constructor.

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: