[SERVER-77808] Change PrimaryOnlyServiceRegistry::_servicesByNamespace to use NamespaceString as the key Created: 05/Jun/23  Updated: 29/Oct/23  Resolved: 08/Jun/23

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

Type: Task Priority: Major - P3
Reporter: Sophia Tan Assignee: Sophia Tan
Resolution: Fixed Votes: 0
Labels: ntdi_must_have
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-74488 Make NamespaceString::toString() private Closed
Assigned Teams:
Serverless
Backwards Compatibility: Fully Compatible
Sprint: QE 2023-06-12
Participants:
Story Points: 1

 Description   

The `PrimaryOnlyServiceRegistry::_servicesByNamespace` uses string key. We will change it to useĀ  NamespaceString.



 Comments   
Comment by Githook User [ 08/Jun/23 ]

Author:

{'name': 'Sophia Tan', 'email': 'sophia_tll@hotmail.com', 'username': 'sophiatll'}

Message: SERVER-77808 Change PrimaryOnlyServiceRegistry::_servicesByNamespace to use NamespaceString as the key
Branch: master
https://github.com/mongodb/mongo/commit/a3bbadef4318f1884f3b7c6f4a1b323181eecdbb

Comment by Max Hirschhorn [ 06/Jun/23 ]

Yes that is my understanding. I think it would be reasonable to add an invariant for that. We can also make the change you've proposed. My comment here is there is no real risk either way because of the design for PrimaryOnlyService.

Comment by Sophia Tan [ 06/Jun/23 ]

max.hirschhorn@mongodb.com Thanks for your comments. Does that mean PrimaryOnlyServiceRegistry::_servicesByNamespace will never has tenant information in the NamespaceStrings?

Comment by Max Hirschhorn [ 05/Jun/23 ]

The `PrimaryOnlyServiceRegistry::_servicesByNamespace` uses string key. We should change it to use NamespaceString to avoid dropping tenant information accidentally.

I think this change is probably fine to make yet I think the description is somewhat misleading. I wouldn't expect there to be any tenant information in the NamespaceStrings of PrimaryOnlyServiceRegistry::_servicesByNamespace because PrimaryOnlyServices are registered statically at mongod startup and therefore independent of the set of tenants residing on a particular mongod. That is, the durable state for primary-only service Instances for different tenants is represented as separate documents within a single collection (with that collection probably in the config database).

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