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

Reconsider use of StubMongoProcessInterface when ViewCatalog validates a view pipeline

    XMLWordPrintable

    Details

    • Operating System:
      ALL
    • Epic Link:
    • Sprint:
      Query 2018-09-24

      Description

      When creating or modifying a view, the ViewCatalog will parse the view pipeline for validation. Doing so requires a MongoProcessInterface, and the ViewCatalog uses the stub implementation:

      view_catalog.cpp

      246
          boost::intrusive_ptr<ExpressionContext> expCtx =
      247
              new ExpressionContext(opCtx,
      248
                                    request,
      249
                                    CollatorInterface::cloneCollator(viewDef.defaultCollator()),
      250
                                    // We can use a stub MongoProcessInterface because we are only parsing
      251
                                    // the Pipeline for validation here. We won't do anything with the
      252
                                    // pipeline that will require a real implementation.
      253
                                    std::make_shared<StubMongoProcessInterface>(),
      254
                                    std::move(resolvedNamespaces),
      255
                                    boost::none);
      256
       
      257
          // Save this to a variable to avoid reading the atomic variable multiple times.
      258
          auto currentFCV = serverGlobalParams.featureCompatibility.getVersion();
      259
       
      260
          // If the feature compatibility version is not 4.2, and we are validating features as master,
      261
          // ban the use of new agg features introduced in 4.2 to prevent them from being persisted in the
      262
          // catalog.
      263
          if (serverGlobalParams.validateFeaturesAsMaster.load() &&
      264
              currentFCV != ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42) {
      265
              expCtx->maxFeatureCompatibilityVersion = currentFCV;
      266
          }
      267
          auto pipelineStatus = Pipeline::parse(viewDef.pipeline(), std::move(expCtx));
      268
          if (!pipelineStatus.isOK()) {
      269
              return pipelineStatus.getStatus();
      270
          }
      

      But with the new $out improvements in 4.1 to output to a sharded collection, $out parsing requires a valid implementation of MongoProcessInterface::isSharded(). We should revisit this code to prepare for a world where $out and $lookup might require a real MongoProcessInterface for parsing.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              nicholas.zolnierz Nicholas Zolnierz
              Reporter:
              kyle.suarez Kyle Suarez
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: