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

Change DatabaseCloner to be tenant aware

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Server Serverless 2022-11-14, Server Serverless 2022-11-28

      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.

            Assignee:
            janna.golden@mongodb.com Janna Golden
            Reporter:
            janna.golden@mongodb.com Janna Golden
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: