[SERVER-68564] Update the DocumentSourceMerge serializer/deserializer to be tenant aware Created: 04/Aug/22  Updated: 29/Oct/23  Resolved: 02/Dec/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: Hugh Tong (Inactive) Assignee: Hugh Tong (Inactive)
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-11-28, Server Serverless 2022-12-12
Participants:
Story Points: 3

 Description   

The DocumentSourceMerge struct contains a custom MergeTargetNss struct, which is made up of a db and collection name (stored separately). This object has custom serializer and deserializer methods which should follow the same rules for serialization and deserialization as NamespaceString and DatabaseName do.
To make the deserializer tenant aware:

  • Change the "type" for the "db" field in NamespaceSpec to be database_name instead.
  • Add the option `deserialize_with_tenant: true` to the MergeTargetNss struct (see namespacestring and/or database_name in basic_types.idl for an example of how it's used already).
  • Add `boost::optional<TenantId> as the first parameter to mergeTargetNssParseFromBSON. Then, pass this tenantId to the IDLParserContext that's passed to NamespaceSpec::parse (see
    MutableOplogEntry::parse for an example).
  • We'll need to pass a tenantId to the IDLParserContext for DocumentSourceMergeSpec as well - use the tenantId that's on the defaultDb parameter for parseMergeSpecAndResolveTargetNamespace (the tenantIds shouldn't change).
    • DocumentSourceGraphLookup and DocumentSourceLookup use NamespaceSpec::parse(), we'll want to pass the tenantId at these call sites as well. Similar steps can be followed.

To make the serialization tenant aware:
Change mergeTargetNssSerializeToBSON to use DatabaseNameUtil::serialize for the dbName, rather than call targetNss.dbName().db() directly.



 Comments   
Comment by Githook User [ 02/Dec/22 ]

Author:

{'name': 'Hugh Tong', 'email': 'hugh.tong@mongodb.com', 'username': 'cortrain'}

Message: SERVER-68564 Update DocumentSourceMerge serializer/deserializer to be tenant-aware
Branch: master
https://github.com/mongodb/mongo/commit/0ec8f95180ad4b587e278501abd8841f0d475b79

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