[SERVER-65456] Make NamespaceString::db_deprecated() private Created: 11/Apr/22  Updated: 29/Oct/23  Resolved: 08/Sep/23

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

Type: Task Priority: Major - P3
Reporter: Janna Golden Assignee: Mathis Bessa
Resolution: Fixed Votes: 1
Labels: ntdi_must_have
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-64608 Add tenantID to NamespaceString Closed
depends on SERVER-65920 Remove NamespaceString ctors with def... Closed
depends on SERVER-73658 RemoteCommandRequest to use DatabaseName Closed
depends on SERVER-76899 ReplicationCoordinatorImpl::canAccept... Closed
depends on SERVER-76918 Change bucket_catalog::clear to take ... Closed
depends on SERVER-76931 Change IndexAccessMethod::initialBulk... Closed
depends on SERVER-78395 Do not call deprecated NamespaceStrin... Closed
depends on SERVER-78396 Avoid calling deprecated NamespaceStr... Closed
depends on SERVER-79074 Replace NamespaceString::db() with Na... Closed
depends on SERVER-79153 removed unused 'db' from analyzeComma... Closed
depends on SERVER-79154 ExpressionContext::isDBAggregation to... Closed
depends on SERVER-79863 Create a comparison method to compare... Closed
depends on SERVER-80147 Replace calls for DatabaseName::db_de... Closed
depends on SERVER-80148 Use DatabaseName for calls to OpMsgRe... Closed
depends on SERVER-80167 Move ClonerUtils::isNamespaceForTenan... Closed
depends on SERVER-80199 JsExecution to use DatabaseName inste... Closed
depends on SERVER-76195 Remove non-tenant aware APIs from Res... Closed
is depended on by SERVER-80833 Pass serialization context into agg p... Closed
Gantt Dependency
has to be done after SERVER-77537 Make DatabaseName::db() private Closed
Related
is related to SERVER-78844 Create a function to parse the Databa... Closed
is related to SERVER-79691 Replace NamespaceString::db_deprecate... Closed
Assigned Teams:
Serverless
Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2023-05-15, Server Serverless 2023-07-10, Server Serverless 2023-08-07, Server Serverless 2023-08-21, Server Serverless 2023-09-04, Server Serverless 2023-09-18
Participants:
Story Points: 5

 Description   

In this ticket, we will go through all the call sites of "NamespaceString::db()" to make it call "NamespaceString::dbName()" so that the tenant information will not be dropped.

If a call site does not accept DatabaseName object, we should change the function to take in DatabaseName first.



 Comments   
Comment by Githook User [ 07/Sep/23 ]

Author:

{'name': 'Mathis Bessa', 'email': 'mathis.bessa@mongodb.com', 'username': 'mathisbessamdb'}

Message: SERVER-65456 Make NamespaceString::db_deprecated() private
Branch: master
https://github.com/mongodb/mongo/commit/3c8c4cddc7ba1300b3e5f366eec17e50046d0bac

Comment by Mathis Bessa [ 31/Aug/23 ]

I have created a new PR for this : 

https://github.com/10gen/mongo/pull/15335

Comment by Sophia Tan [ 08/May/23 ]

mathis.bessa@mongodb.com henrik.edin@mongodb.com

Two reasons that we are going to keep "NamespaceString::dbName()" as it was:

  • the "db()" function will be changed to be private instead of be removed. It's because other functions of NamespaceString still need this function to grab db string name.
  • If the we rename it to `db()`, to get a string db name on nss will become `nss.db().db()`. I think `nss.dbName().db()` is a better choice. 
Comment by Matt Broadstone [ 18/Apr/23 ]

From the review on SERVER-76222, henrik.edin@mongodb.com asks if we would consider renaming NamespaceString::dbName() to NamespaceString::db() when we eventually remove the version of that function that returns a StringData

Comment by Janna Golden [ 18/Jan/23 ]

Yeah, that's a good idea. We will also be removing the DatabaseName constructors that provide a default for tenantId, so strings should not be able to be implicitly converted to DatabaseName objects as well, which should help with this as well! Ty for the suggestion dianna.hohensee@mongodb.com.

Comment by Dianna Hohensee (Inactive) [ 18/Jan/23 ]

An additional suggestion: might we mark the DatabaseName constructor explicit?

That would prevent the situation where a function Foo takes a DatabaseName as a parameter, and a caller passes in a string that Foo implicitly turns from a string into a DatabaseName instance. Here's an example of what I mean precisely.

For motivation, I recently had trouble debugging one of my patches because I mistakenly passed NamespaceString::db() instead of NamespaceString::dbName() into this function. This ticket removes NamespaceString::db(), but perhaps there are / will be other ways to inadvertently pass strings.

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