[SERVER-69722] Deserialize AsyncResultsMergerParams correctly in multitenant environment Created: 15/Sep/22  Updated: 29/Oct/23  Resolved: 07/Nov/22

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

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

Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2022-10-31, Server Serverless 2022-11-14
Participants:

 Description   

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.



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

Author:

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

Message: SERVER-69722 Deserialize AsyncResultsMergerParams correctly in multitenant environment
Branch: master
https://github.com/mongodb/mongo/commit/4ae35a3110adc3571e1fdd267db6234983f41dcd

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