diff options
author | David Storch <david.storch@10gen.com> | 2016-09-14 18:02:10 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-09-20 17:40:43 -0400 |
commit | 2ac0e07e7f82406e989fa272c68d1205ced81d78 (patch) | |
tree | eece2e1323d243c48e10304181a8678884035acd /src/mongo/db/commands | |
parent | 585edf79040ed44db42e174b8659ca7290fa48cf (diff) | |
download | mongo-2ac0e07e7f82406e989fa272c68d1205ced81d78.tar.gz |
SERVER-25969 make slaves and secondaries always use BSON 1.1 validation
This allows secondaries and slaves to sync NumberDecimal even while
in featureCompatibilityVersion:"3.2" mode.
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/count_cmd.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/commands/create_indexes.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/dbcommands.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/distinct.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/commands/drop_indexes.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/feature_compatibility_version.cpp | 32 | ||||
-rw-r--r-- | src/mongo/db/commands/feature_compatibility_version.h | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/find_cmd.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/commands/geo_near_cmd.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/group_cmd.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/mr.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/pipeline_command.cpp | 4 |
12 files changed, 42 insertions, 42 deletions
diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp index 9631cc9a51d..65b02e1ba88 100644 --- a/src/mongo/db/commands/count_cmd.cpp +++ b/src/mongo/db/commands/count_cmd.cpp @@ -114,8 +114,8 @@ public: } if (!request.getValue().getCollation().isEmpty() && - serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_32) { + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32) { return Status(ErrorCodes::InvalidOptions, "The featureCompatibilityVersion must be 3.4 to use collation. See " "http://dochub.mongodb.org/core/3.4-feature-compatibility."); @@ -171,8 +171,8 @@ public: } if (!request.getValue().getCollation().isEmpty() && - serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_32) { + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32) { return appendCommandStatus( result, Status(ErrorCodes::InvalidOptions, diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp index 176b6a84b6d..5d660f024ce 100644 --- a/src/mongo/db/commands/create_indexes.cpp +++ b/src/mongo/db/commands/create_indexes.cpp @@ -74,7 +74,7 @@ const StringData kIndexesFieldName = "indexes"_sd; StatusWith<std::vector<BSONObj>> parseAndValidateIndexSpecs( const NamespaceString& ns, const BSONObj& cmdObj, - ServerGlobalParams::FeatureCompatibilityVersions featureCompatibilityVersion) { + ServerGlobalParams::FeatureCompatibility::Version featureCompatibilityVersion) { bool hasIndexesField = false; std::vector<BSONObj> indexSpecs; @@ -238,7 +238,7 @@ public: return appendCommandStatus(result, status); const auto featureCompatibilityVersion = - serverGlobalParams.featureCompatibilityVersion.load(); + serverGlobalParams.featureCompatibility.version.load(); auto specsWithStatus = parseAndValidateIndexSpecs(ns, cmdObj, featureCompatibilityVersion); if (!specsWithStatus.isOK()) { return appendCommandStatus(result, specsWithStatus.getStatus()); diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp index f73166e42fa..3b5f16ce52d 100644 --- a/src/mongo/db/commands/dbcommands.cpp +++ b/src/mongo/db/commands/dbcommands.cpp @@ -539,8 +539,8 @@ public: result.append("note", deprecationWarning); } - auto featureCompatibilityVersion = serverGlobalParams.featureCompatibilityVersion.load(); - if (ServerGlobalParams::FeatureCompatibilityVersion_32 == featureCompatibilityVersion && + auto featureCompatibilityVersion = serverGlobalParams.featureCompatibility.version.load(); + if (ServerGlobalParams::FeatureCompatibility::Version::k32 == featureCompatibilityVersion && cmdObj.hasField("collation")) { return appendCommandStatus( result, diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp index e86a204e488..d580f4059f4 100644 --- a/src/mongo/db/commands/distinct.cpp +++ b/src/mongo/db/commands/distinct.cpp @@ -127,8 +127,8 @@ public: } if (!parsedDistinct.getValue().getQuery()->getQueryRequest().getCollation().isEmpty() && - serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_32) { + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32) { return Status(ErrorCodes::InvalidOptions, "The featureCompatibilityVersion must be 3.4 to use collation. See " "http://dochub.mongodb.org/core/3.4-feature-compatibility."); @@ -176,8 +176,8 @@ public: } if (!parsedDistinct.getValue().getQuery()->getQueryRequest().getCollation().isEmpty() && - serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_32) { + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32) { return appendCommandStatus( result, Status(ErrorCodes::InvalidOptions, diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp index cdca8e10bcb..fc18cdd3c86 100644 --- a/src/mongo/db/commands/drop_indexes.cpp +++ b/src/mongo/db/commands/drop_indexes.cpp @@ -145,7 +145,7 @@ public: BackgroundOperation::assertNoBgOpInProgForNs(toReIndexNs.ns()); const auto featureCompatibilityVersion = - serverGlobalParams.featureCompatibilityVersion.load(); + serverGlobalParams.featureCompatibility.version.load(); const auto defaultIndexVersion = IndexDescriptor::getDefaultIndexVersion(featureCompatibilityVersion); diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp index cabbbb8c754..2ebc3b89354 100644 --- a/src/mongo/db/commands/feature_compatibility_version.cpp +++ b/src/mongo/db/commands/feature_compatibility_version.cpp @@ -48,10 +48,10 @@ constexpr StringData FeatureCompatibilityVersion::kVersionField; constexpr StringData FeatureCompatibilityVersion::kVersion34; constexpr StringData FeatureCompatibilityVersion::kVersion32; -StatusWith<ServerGlobalParams::FeatureCompatibilityVersions> FeatureCompatibilityVersion::parse( +StatusWith<ServerGlobalParams::FeatureCompatibility::Version> FeatureCompatibilityVersion::parse( const BSONObj& featureCompatibilityVersionDoc) { bool foundVersionField = false; - ServerGlobalParams::FeatureCompatibilityVersions version; + ServerGlobalParams::FeatureCompatibility::Version version; for (auto&& elem : featureCompatibilityVersionDoc) { auto fieldName = elem.fieldNameStringData(); @@ -72,9 +72,9 @@ StatusWith<ServerGlobalParams::FeatureCompatibilityVersions> FeatureCompatibilit << featureCompatibilityVersionDoc); } if (elem.String() == FeatureCompatibilityVersion::kVersion34) { - version = ServerGlobalParams::FeatureCompatibilityVersion_34; + version = ServerGlobalParams::FeatureCompatibility::Version::k34; } else if (elem.String() == FeatureCompatibilityVersion::kVersion32) { - version = ServerGlobalParams::FeatureCompatibilityVersion_32; + version = ServerGlobalParams::FeatureCompatibility::Version::k32; } else { return Status(ErrorCodes::BadValue, str::stream() << "Invalid value for " @@ -146,11 +146,11 @@ void FeatureCompatibilityVersion::set(OperationContext* txn, StringData version) // Update server parameter. if (version == FeatureCompatibilityVersion::kVersion34) { - serverGlobalParams.featureCompatibilityVersion.store( - ServerGlobalParams::FeatureCompatibilityVersion_34); + serverGlobalParams.featureCompatibility.version.store( + ServerGlobalParams::FeatureCompatibility::Version::k34); } else if (version == FeatureCompatibilityVersion::kVersion32) { - serverGlobalParams.featureCompatibilityVersion.store( - ServerGlobalParams::FeatureCompatibilityVersion_32); + serverGlobalParams.featureCompatibility.version.store( + ServerGlobalParams::FeatureCompatibility::Version::k32); } } @@ -180,8 +180,8 @@ void FeatureCompatibilityVersion::setIfCleanStartup(OperationContext* txn, << FeatureCompatibilityVersion::kVersion34))); // Update server parameter. - serverGlobalParams.featureCompatibilityVersion.store( - ServerGlobalParams::FeatureCompatibilityVersion_34); + serverGlobalParams.featureCompatibility.version.store( + ServerGlobalParams::FeatureCompatibility::Version::k34); } } @@ -191,7 +191,7 @@ void FeatureCompatibilityVersion::onInsertOrUpdate(const BSONObj& doc) { idElement.String() != FeatureCompatibilityVersion::kParameterName) { return; } - serverGlobalParams.featureCompatibilityVersion.store( + serverGlobalParams.featureCompatibility.version.store( uassertStatusOK(FeatureCompatibilityVersion::parse(doc))); } @@ -201,8 +201,8 @@ void FeatureCompatibilityVersion::onDelete(const BSONObj& doc) { idElement.String() != FeatureCompatibilityVersion::kParameterName) { return; } - serverGlobalParams.featureCompatibilityVersion.store( - ServerGlobalParams::FeatureCompatibilityVersion_32); + serverGlobalParams.featureCompatibility.version.store( + ServerGlobalParams::FeatureCompatibility::Version::k32); } /** @@ -218,10 +218,10 @@ public: ) {} StringData featureCompatibilityVersionStr() { - switch (serverGlobalParams.featureCompatibilityVersion.load()) { - case ServerGlobalParams::FeatureCompatibilityVersion_34: + switch (serverGlobalParams.featureCompatibility.version.load()) { + case ServerGlobalParams::FeatureCompatibility::Version::k34: return FeatureCompatibilityVersion::kVersion34; - case ServerGlobalParams::FeatureCompatibilityVersion_32: + case ServerGlobalParams::FeatureCompatibility::Version::k32: return FeatureCompatibilityVersion::kVersion32; default: MONGO_UNREACHABLE; diff --git a/src/mongo/db/commands/feature_compatibility_version.h b/src/mongo/db/commands/feature_compatibility_version.h index bea195f73ed..ed1d82d7423 100644 --- a/src/mongo/db/commands/feature_compatibility_version.h +++ b/src/mongo/db/commands/feature_compatibility_version.h @@ -52,7 +52,7 @@ public: * Parses the featureCompatibilityVersion document from admin.system.version, and returns the * version. */ - static StatusWith<ServerGlobalParams::FeatureCompatibilityVersions> parse( + static StatusWith<ServerGlobalParams::FeatureCompatibility::Version> parse( const BSONObj& featureCompatibilityVersionDoc); /** diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp index 5df8ba41e75..e86f3aa9cc6 100644 --- a/src/mongo/db/commands/find_cmd.cpp +++ b/src/mongo/db/commands/find_cmd.cpp @@ -149,8 +149,8 @@ public: } if (!qrStatus.getValue()->getCollation().isEmpty() && - serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_32) { + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32) { return Status(ErrorCodes::InvalidOptions, "The featureCompatibilityVersion must be 3.4 to use collation. See " "http://dochub.mongodb.org/core/3.4-feature-compatibility."); @@ -253,8 +253,8 @@ public: auto& qr = qrStatus.getValue(); if (!qr->getCollation().isEmpty() && - serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_32) { + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32) { return appendCommandStatus( result, Status(ErrorCodes::InvalidOptions, diff --git a/src/mongo/db/commands/geo_near_cmd.cpp b/src/mongo/db/commands/geo_near_cmd.cpp index 04bec8f0b1c..6e291e65f58 100644 --- a/src/mongo/db/commands/geo_near_cmd.cpp +++ b/src/mongo/db/commands/geo_near_cmd.cpp @@ -185,8 +185,8 @@ public: } } if (!collation.isEmpty() && - serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_32) { + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32) { return appendCommandStatus( result, Status(ErrorCodes::InvalidOptions, diff --git a/src/mongo/db/commands/group_cmd.cpp b/src/mongo/db/commands/group_cmd.cpp index c7453865900..809ef8d2d1c 100644 --- a/src/mongo/db/commands/group_cmd.cpp +++ b/src/mongo/db/commands/group_cmd.cpp @@ -268,8 +268,8 @@ private: request->collation = collationElt.embeddedObject().getOwned(); } if (!request->collation.isEmpty() && - serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_32) { + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32) { return Status(ErrorCodes::InvalidOptions, "The featureCompatibilityVersion must be 3.4 to use collation. See " "http://dochub.mongodb.org/core/3.4-feature-compatibility."); diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index eb304a56f49..ab6329b76d2 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -1364,8 +1364,8 @@ public: Config config(dbname, cmd); if (!config.collation.isEmpty() && - serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_32) { + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32) { return appendCommandStatus( result, Status(ErrorCodes::InvalidOptions, diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index 66ab66b55e9..46cc4e8a40d 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -644,8 +644,8 @@ public: // collection metadata. So the merger needs to accept a collation, and we rely on the shards // to reject collations from the user. if (!request.getValue().getCollation().isEmpty() && - serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_32 && + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32 && !isMergePipeline(request.getValue().getPipeline())) { return appendCommandStatus( result, |