[SERVER-70430] Change DatabaseCloner to be tenant aware Created: 10/Oct/22  Updated: 29/Oct/23  Resolved: 17/Nov/22

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

Type: Task Priority: Major - P3
Reporter: Janna Golden Assignee: Janna Golden
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-70415 Attach $tenant to dbStats command dur... Closed
is depended on by SERVER-70432 Change CollectionCloner to be tenant ... Closed
Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2022-11-14, Server Serverless 2022-11-28
Participants:

 Description   

Change the _dbName member to be a DatabaseName object. The AllDatabasesCloner currently passes a string when constructing DatabaseCloner objects, so change this as well.

Then, change the listCollections stage to construct the request correctly according to which flags are enabled - we'll want to use a prefixed dbName if multitenancySupport is enabled but featureFlagRequireTenantID is disabled. If both are enabled, do not include the tenantId in the dbName and instead send $tenant in the request body. The cloner currently uses DBClientBase::getCollectionInfos - one option is to change this function to take in an optional 3rd parameter and pass a TenantId object only if we want to send the request with $tenant. Then, we can use DatabaseNameUtil::serialize to pass the correct string value as the first parameter, and only pass the tenantId as the third parameter if the feature flag is enabled. We'll need to add $tenant to the body of the command here. We'll also need to make sure the getMore correctly includes the tenantId - in order to do this, change DBClientBase::getMore to take in a NamespaceString object rather than a std::string, and then in getCollectionInfos, construct a NamespaceString using NamespaceStringUtil::deserialize here.

Then, change the dbname member on DatabaseCloner::Stats to be a DatabaseName object, and change any call sites in AllDatabaseCloner or DatabaseCloner to pass a DatabaseName object rather than a string.



 Comments   
Comment by Githook User [ 16/Nov/22 ]

Author:

{'name': 'jannaerin', 'email': 'golden.janna@gmail.com', 'username': 'jannaerin'}

Message: SERVER-70430 Change DatabaseCloner to be tenant aware
Branch: master
https://github.com/mongodb/mongo/commit/56f173061badee364bd965b740da7f8f31bc3b69

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