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

Deserialize AsyncResultsMergerParams correctly in multitenant environment

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

      In order to correctly deserialize the NamespaceString field in the AsyncResultsMergeParams type, we'll have to pass the tenantId to the IDLParserContext when parsing AsyncResultsMergerParams. We can grab the tenantId from NamespaceString on the expCtx passed to the function to pass to the IDLParserContext constructor. An example of constructing an IDLParserContext object and passing the tenantId is here. We can pass "false" for the "apiStrict" parameter, since it defaults to false today.

      Let's add a couple of tests to document_source_merge_cursors_test.cpp, since AsyncResultsMergerParams is used to create DocumentSourceMergeCursors. We'll want to test using a NamespaceString that contains a tenantId, and we can do something like create a ServerlessDocumentSourceMergeCursorsTest fixture that inherits from the DocumentSourceMergeCursorsTest fixture slightly, but constructs the expCtx with a different NamespaceString object (one that has a tenantId). Then create two test cases that are essentially the same as this one, but we really only need to check that the nss field looks correct, so we can ignore the other fields (note that we'll have to pass the tenantId to the IDLParserContext here as well):
      1. The first should enable just multitenancySupport. Let's also check what the serialized version looks like, and in this case the tenantId should be prefixed to the namespace field - we can check that the namespace field in the BSONObj has the tenantId.
      2. The second should enable both multitenancySupport and featureFlagRequireTenantID. In this case, the serialized version should not contain the tenantId as a prefix, so let's check this as well.

            Assignee:
            mathis.bessa@mongodb.com Mathis Bessa (Inactive)
            Reporter:
            janna.golden@mongodb.com Janna Golden
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: