[SERVER-77000] Pass SerializationContext obj to DocumentSourceOut Created: 10/May/23  Updated: 18/Oct/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Hugh Tong (Inactive) Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Participants:

 Description   

`DocumentSourceOut::parseOutSpecAndResolveTargetNamespace()` is a static function that serializes a DatabaseName object into a DocumentSourceOutSpec obj.  As a static function, it doesn't have access to the pExpCtx member variable held in a DocumentSourceOut instance to retrieve the `SerializationContext` from, so this will need to be passed in.
 
The call stack looks like this:

DocumentSourceOut::parseOutSpecAndResolveTargetNamespace
    DocumentSourceOut::LiteParsed::parse(const NamespaceString& nss, const BSONElement& spec)
        LiteParsedDocumentSource::parse(const NamespaceString& nss, const BSONElement& spec)
            LiteParsedPipeline::LiteParsedPipeline(const NamespaceString& nss, const std::vector<BSONObj>& pipelineStages)
                LiteParsedPipeline::LiteParsedPipeline(const AggregateCommandRequest& request) <-- here we still have access to the agg req
                    PipelineCommand::Invocation::Invocation()
                        PipelineCommand::parseForExplain(...)
                            resolveInvolvedNamespaces()
    DocumentSourceOut::createFromBson()     <-- here we have access to the pExpCtx
        DocumentSource::registerParser(string name, SimpleParser simpleParser, boost::optional<FeatureFlag> featureFlag)
            DocumentSource::parse(const intrusive_ptr<ExpressionContext>& expCtx, BSONObj stageObj)
                runAggregate(...)
                    PipelineCommand::Invocation::run()
 

Because `LiteParsedPipeline` maintains a map of parsers which fit a specific function signature via `REGISTER_DOCUMENT_SOURCE`, this may affect quite a few call sites.  We may want to investigate a way to narrow this scope.

As $out will not be supported by Atlas Proxy, this work will be needed to support mongoq instead.


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