[SERVER-63627] Avoid self-registration in ServerParameter constructor Created: 14/Feb/22  Updated: 29/Oct/23  Resolved: 10/Mar/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0

Type: Bug Priority: Minor - P4
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-63588 IDL applies redaction to incoming Ser... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2022-03-07, Service Arch 2022-03-21
Participants:

 Description   

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.


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