diff options
author | Charlie Swanson <charlie.swanson@mongodb.com> | 2018-02-12 18:39:46 -0500 |
---|---|---|
committer | Charlie Swanson <charlie.swanson@mongodb.com> | 2018-02-27 11:16:08 -0500 |
commit | a77297dbe34d5cd838a4da55e9d83dc70c510bba (patch) | |
tree | 31af6e80ce89e6f0cfdde8f5ea66691f1bb03bff /src/mongo/db/views | |
parent | f5c2680d3e3f28f4e32e2f5fbbbc61c39d55c2c8 (diff) | |
download | mongo-a77297dbe34d5cd838a4da55e9d83dc70c510bba.tar.gz |
SERVER-33174 Prevent catalog storage of new syntax during lower FCV
This will prevent the persistence of expressions introduced in 4.0
while the server is in feature compatibility version (FCV) 3.6.
Diffstat (limited to 'src/mongo/db/views')
-rw-r--r-- | src/mongo/db/views/view_catalog.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/db/views/view_catalog.cpp b/src/mongo/db/views/view_catalog.cpp index 8c59710941e..1a029f0d5c4 100644 --- a/src/mongo/db/views/view_catalog.cpp +++ b/src/mongo/db/views/view_catalog.cpp @@ -43,9 +43,6 @@ #include "mongo/db/operation_context.h" #include "mongo/db/pipeline/aggregation_request.h" #include "mongo/db/pipeline/document_source.h" -#include "mongo/db/pipeline/document_source_facet.h" -#include "mongo/db/pipeline/document_source_lookup.h" -#include "mongo/db/pipeline/document_source_match.h" #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/pipeline/lite_parsed_pipeline.h" #include "mongo/db/pipeline/pipeline.h" @@ -251,6 +248,17 @@ StatusWith<stdx::unordered_set<NamespaceString>> ViewCatalog::_validatePipeline_ // pipeline that will require a real implementation. std::make_shared<StubMongoProcessInterface>(), std::move(resolvedNamespaces)); + + // Save this to a variable to avoid reading the atomic variable multiple times. + auto currentFCV = serverGlobalParams.featureCompatibility.getVersion(); + + // If the feature compatibility version is not 4.0, and we are validating features as master, + // ban the use of new agg features introduced in 4.0 to prevent them from being persisted in the + // catalog. + if (serverGlobalParams.validateFeaturesAsMaster.load() && + currentFCV != ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { + expCtx->maxFeatureCompatibilityVersion = currentFCV; + } auto pipelineStatus = Pipeline::parse(viewDef.pipeline(), std::move(expCtx)); if (!pipelineStatus.isOK()) { return pipelineStatus.getStatus(); |