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

Pass SerializationContext obj to DocumentSourceOut

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Service Arch

      `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.

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            hugh.tong@mongodb.com Hugh Tong (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: