summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorJon Streets <jonathan.streets@mongodb.com>2021-05-19 20:10:31 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-23 15:49:23 +0000
commit05a0f8e98b633a6e6c26c10576a1044f9da161b5 (patch)
tree3952e670c0e71987b5173eb02e1a279f60bf7b6e /src/mongo/db
parent785c2ed58a5e98335faf37b14cef0bbce5832ee2 (diff)
downloadmongo-05a0f8e98b633a6e6c26c10576a1044f9da161b5.tar.gz
SERVER-56366 Update FCV constants to recognize 5.1 as latest
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp2
-rw-r--r--src/mongo/db/commands/feature_compatibility_version_parser.cpp12
-rw-r--r--src/mongo/db/commands/feature_compatibility_version_parser.h44
-rw-r--r--src/mongo/db/commands/find_and_modify.cpp2
-rw-r--r--src/mongo/db/commands/set_feature_compatibility_version_command.cpp10
-rw-r--r--src/mongo/db/exec/upsert_stage.cpp2
-rw-r--r--src/mongo/db/matcher/expression_parser.cpp2
-rw-r--r--src/mongo/db/ops/insert.cpp2
-rw-r--r--src/mongo/db/pipeline/accumulator_sum.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_set_window_fields.cpp4
-rw-r--r--src/mongo/db/pipeline/expression.cpp55
-rw-r--r--src/mongo/db/pipeline/field_path.cpp2
-rw-r--r--src/mongo/db/s/create_collection_coordinator.cpp2
-rw-r--r--src/mongo/db/s/resharding/resharding_coordinator_service.cpp2
-rw-r--r--src/mongo/db/s/shard_collection_legacy.cpp2
-rw-r--r--src/mongo/db/s/sharding_ddl_50_upgrade_downgrade.cpp10
-rw-r--r--src/mongo/db/s/sharding_ddl_util.cpp2
-rw-r--r--src/mongo/db/server_options.h62
-rw-r--r--src/mongo/db/update/pipeline_executor.cpp2
-rw-r--r--src/mongo/db/update/storage_validation.cpp6
-rw-r--r--src/mongo/db/wire_version.h7
21 files changed, 119 insertions, 115 deletions
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index 423cb137edc..5a54dd455e4 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -863,7 +863,7 @@ void CollectionImpl::_cappedDeleteAsNeeded(OperationContext* opCtx,
}
bool useOldCappedDeleteBehaviour = serverGlobalParams.featureCompatibility.isLessThan(
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50);
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50);
if (!useOldCappedDeleteBehaviour && !opCtx->isEnforcingConstraints()) {
// With new capped delete behavior, secondaries only delete from capped collections via
diff --git a/src/mongo/db/commands/feature_compatibility_version_parser.cpp b/src/mongo/db/commands/feature_compatibility_version_parser.cpp
index 12f2fb3132d..087755d9186 100644
--- a/src/mongo/db/commands/feature_compatibility_version_parser.cpp
+++ b/src/mongo/db/commands/feature_compatibility_version_parser.cpp
@@ -69,8 +69,12 @@ FeatureCompatibilityParams::Version FeatureCompatibilityVersionParser::parseVers
FeatureCompatibilityParams::Version FeatureCompatibilityVersionParser::parseVersionForFeatureFlags(
StringData versionString) {
+ if (versionString == kVersion51) {
+ return FeatureCompatibilityParams::Version::kVersion51;
+ }
+
if (versionString == kVersion50) {
- return FeatureCompatibilityParams::Version::kVersion50;
+ return FeatureCompatibilityParams::Version::kFullyDowngradedTo50;
}
if (versionString == kVersion49) {
@@ -111,7 +115,11 @@ StringData FeatureCompatibilityVersionParser::serializeVersion(
StringData FeatureCompatibilityVersionParser::serializeVersionForFeatureFlags(
FeatureCompatibilityParams::Version version) {
- if (version == FeatureCompatibilityParams::Version::kVersion50) {
+ if (version == FeatureCompatibilityParams::Version::kVersion51) {
+ return kVersion51;
+ }
+
+ if (version == FeatureCompatibilityParams::Version::kFullyDowngradedTo50) {
return kVersion50;
}
diff --git a/src/mongo/db/commands/feature_compatibility_version_parser.h b/src/mongo/db/commands/feature_compatibility_version_parser.h
index e54e16a71f9..b20cb3a1b01 100644
--- a/src/mongo/db/commands/feature_compatibility_version_parser.h
+++ b/src/mongo/db/commands/feature_compatibility_version_parser.h
@@ -41,41 +41,29 @@ using FeatureCompatibilityParams = ServerGlobalParams::FeatureCompatibility;
*/
class FeatureCompatibilityVersionParser {
public:
- static constexpr StringData kVersion44 = "4.4"_sd;
- static constexpr StringData kVersion47 = "4.7"_sd;
- static constexpr StringData kVersion48 = "4.8"_sd;
- static constexpr StringData kVersionDowngradingFrom47To44 = "downgrading from 4.7 to 4.4"_sd;
- static constexpr StringData kVersionDowngradingFrom48To44 = "downgrading from 4.8 to 4.4"_sd;
- static constexpr StringData kVersionDowngradingFrom48To47 = "downgrading from 4.8 to 4.7"_sd;
- static constexpr StringData kVersionUpgradingFrom44To47 = "upgrading from 4.4 to 4.7"_sd;
- static constexpr StringData kVersionUpgradingFrom47To48 = "upgrading from 4.7 to 4.8"_sd;
- static constexpr StringData kVersionUpgradingFrom44To48 = "upgrading from 4.4 to 4.8"_sd;
- static constexpr StringData kVersionDowngradingFrom49To44 = "downgrading from 4.9 to 4.4"_sd;
- static constexpr StringData kVersionUpgradingFrom44To49 = "upgrading from 4.4 to 4.9"_sd;
- static constexpr StringData kVersionDowngradingFrom49To48 = "downgrading from 4.9 to 4.8"_sd;
- static constexpr StringData kVersionUpgradingFrom48To49 = "upgrading from 4.8 to 4.9"_sd;
- static constexpr StringData kVersion49 = "4.9"_sd;
- static constexpr StringData kVersionDowngradingFrom50To44 = "downgrading from 5.0 to 4.4"_sd;
- static constexpr StringData kVersionUpgradingFrom44To50 = "upgrading from 4.4 to 5.0"_sd;
- static constexpr StringData kVersionDowngradingFrom50To49 = "downgrading from 5.0 to 4.9"_sd;
- static constexpr StringData kVersionUpgradingFrom49To50 = "upgrading from 4.9 to 5.0"_sd;
+ static constexpr StringData kVersion44 = "4.4"_sd; // Remove once old feature flags are deleted
+ static constexpr StringData kVersion47 = "4.7"_sd; // Remove once old feature flags are deleted
+ static constexpr StringData kVersion48 = "4.8"_sd; // Remove once old feature flags are deleted
+ static constexpr StringData kVersion49 = "4.9"_sd; // Remove once old feature flags are deleted
static constexpr StringData kVersion50 = "5.0"_sd;
+ static constexpr StringData kVersion51 = "5.1"_sd;
+ static constexpr StringData kVersionDowngradingFrom51To50 = "downgrading from 5.1 to 5.0"_sd;
+ static constexpr StringData kVersionUpgradingFrom50To51 = "upgrading from 5.0 to 5.1"_sd;
static constexpr StringData kVersionUnset = "Unset"_sd;
static constexpr StringData kParameterName = "featureCompatibilityVersion"_sd;
- static constexpr StringData kLastLTS = kVersion44;
- static constexpr StringData kLastContinuous = kVersion49;
- static constexpr StringData kLatest = kVersion50;
- static constexpr StringData kUpgradingFromLastLTSToLatest = kVersionUpgradingFrom44To50;
- static constexpr StringData kUpgradingFromLastContinuousToLatest = kVersionUpgradingFrom49To50;
+ static constexpr StringData kLastLTS = kVersion50;
+ static constexpr StringData kLastContinuous = kVersion50;
+ static constexpr StringData kLatest = kVersion51;
+ static constexpr StringData kUpgradingFromLastLTSToLatest = kVersionUpgradingFrom50To51;
+ static constexpr StringData kUpgradingFromLastContinuousToLatest = kVersionUpgradingFrom50To51;
// kVersionUpgradingFromLastLTSToLastContinuous should assigned kVersionUnset when kLastLTS and
// kLastContinuous are equal.
- static constexpr StringData kVersionUpgradingFromLastLTSToLastContinuous =
- kVersionUpgradingFrom44To49;
- static constexpr StringData kDowngradingFromLatestToLastLTS = kVersionDowngradingFrom50To44;
+ static constexpr StringData kVersionUpgradingFromLastLTSToLastContinuous = kVersionUnset;
+ static constexpr StringData kDowngradingFromLatestToLastLTS = kVersionDowngradingFrom51To50;
static constexpr StringData kDowngradingFromLatestToLastContinuous =
- kVersionDowngradingFrom50To49;
+ kVersionDowngradingFrom51To50;
// Used to verify that FCV values in 'admin.system.version' are valid and equal to one of
// { lastLTS, lastContinuous, latest }.
@@ -106,7 +94,7 @@ public:
* Useful for message logging.
*/
static StringData toString(FeatureCompatibilityParams::Version version) {
- if (version == FeatureCompatibilityParams::Version::kUnsetDefault44Behavior) {
+ if (version == FeatureCompatibilityParams::Version::kUnsetDefault50Behavior) {
return kVersionUnset;
} else if (version == FeatureCompatibilityParams::kLastLTS) {
return kLastLTS;
diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp
index b7066244fcc..9222576fbe7 100644
--- a/src/mongo/db/commands/find_and_modify.cpp
+++ b/src/mongo/db/commands/find_and_modify.cpp
@@ -488,7 +488,7 @@ write_ops::FindAndModifyCommandReply CmdFindAndModify::Invocation::writeConflict
if (updateResult.containsDotsAndDollarsField &&
serverGlobalParams.featureCompatibility.isVersionInitialized() &&
serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- FeatureCompatibilityParams::Version::kVersion50)) {
+ FeatureCompatibilityParams::Version::kFullyDowngradedTo50)) {
// If it's an upsert, increment 'inserts' metric, otherwise increment 'updates'.
dotsAndDollarsFieldsCounters.incrementForUpsert(!updateResult.upsertedId.isEmpty());
}
diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
index d3b7a39728d..c226e06a1af 100644
--- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
+++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
@@ -566,7 +566,7 @@ private:
if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) {
// TODO SERVER-53283: This block can removed once 5.0 becomes last-lts.
- if (requestedVersion >= FeatureCompatibility::Version::kVersion50) {
+ if (requestedVersion == FeatureCompatibility::Version::kFullyDowngradedTo50) {
ShardingCatalogManager::get(opCtx)->upgradeMetadataFor50Phase1(opCtx);
}
@@ -580,7 +580,7 @@ private:
opCtx, CommandHelpers::appendMajorityWriteConcern(requestPhase2.toBSON({}))));
// TODO SERVER-53283: This block can removed once 5.0 becomes last-lts.
- if (requestedVersion >= FeatureCompatibility::Version::kVersion50) {
+ if (requestedVersion == FeatureCompatibility::Version::kFullyDowngradedTo50) {
ShardingCatalogManager::get(opCtx)->upgradeMetadataFor50Phase2(opCtx);
}
@@ -685,7 +685,7 @@ private:
abortAllReshardCollection(opCtx);
// TODO SERVER-53283: This block can removed once 5.0 becomes last-lts.
- if (requestedVersion < FeatureCompatibility::Version::kVersion50) {
+ if (requestedVersion < FeatureCompatibility::Version::kFullyDowngradedTo50) {
ShardingCatalogManager::get(opCtx)->downgradeMetadataToPre50Phase1(opCtx);
// TODO: SERVER-55912 remove after 5.0 becomes last-lts.
@@ -702,12 +702,12 @@ private:
opCtx, CommandHelpers::appendMajorityWriteConcern(requestPhase2.toBSON({}))));
// TODO SERVER-53283: This block can removed once 5.0 becomes last-lts.
- if (requestedVersion < FeatureCompatibility::Version::kVersion50) {
+ if (requestedVersion < FeatureCompatibility::Version::kFullyDowngradedTo50) {
ShardingCatalogManager::get(opCtx)->downgradeMetadataToPre50Phase2(opCtx);
}
} else if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) {
// TODO: SERVER-55912 remove after 5.0 becomes last-lts.
- if (requestedVersion < FeatureCompatibility::Version::kVersion50) {
+ if (requestedVersion < FeatureCompatibility::Version::kFullyDowngradedTo50) {
dropReshardingCollectionsOnShard(opCtx);
}
}
diff --git a/src/mongo/db/exec/upsert_stage.cpp b/src/mongo/db/exec/upsert_stage.cpp
index 1b352fc4d38..20904ae1909 100644
--- a/src/mongo/db/exec/upsert_stage.cpp
+++ b/src/mongo/db/exec/upsert_stage.cpp
@@ -279,7 +279,7 @@ void UpsertStage::_assertDocumentToBeInsertedIsValid(const mb::Document& documen
bool allowTopLevelDollarPrefixes =
serverGlobalParams.featureCompatibility.isVersionInitialized() &&
serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- FeatureCompatibilityParams::Version::kVersion50);
+ FeatureCompatibilityParams::Version::kFullyDowngradedTo50);
storage_validation::storageValid(document,
allowTopLevelDollarPrefixes,
true, /* Should validate for storage */
diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp
index 3a2a1bc63b6..32a32d66683 100644
--- a/src/mongo/db/matcher/expression_parser.cpp
+++ b/src/mongo/db/matcher/expression_parser.cpp
@@ -296,7 +296,7 @@ StatusWithMatchExpression parse(const BSONObj& obj,
const auto dotsAndDollarsHint =
serverGlobalParams.featureCompatibility.isVersionInitialized() &&
serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- FeatureCompatibilityParams::Version::kVersion50)
+ FeatureCompatibilityParams::Version::kFullyDowngradedTo50)
? ". If you have a field name that starts with a '$' symbol, consider using "
"$getField or $setField."
: "";
diff --git a/src/mongo/db/ops/insert.cpp b/src/mongo/db/ops/insert.cpp
index 44f22c877d5..e0accaac460 100644
--- a/src/mongo/db/ops/insert.cpp
+++ b/src/mongo/db/ops/insert.cpp
@@ -112,7 +112,7 @@ StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx,
if (fieldName[0] == '$') {
if (!serverGlobalParams.featureCompatibility.isVersionInitialized() ||
!serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- FeatureCompatibilityParams::Version::kVersion50)) {
+ FeatureCompatibilityParams::Version::kFullyDowngradedTo50)) {
return StatusWith<BSONObj>(ErrorCodes::BadValue,
str::stream()
<< "Document can't have $ prefixed field names: "
diff --git a/src/mongo/db/pipeline/accumulator_sum.cpp b/src/mongo/db/pipeline/accumulator_sum.cpp
index b25fe3939ae..8322048df55 100644
--- a/src/mongo/db/pipeline/accumulator_sum.cpp
+++ b/src/mongo/db/pipeline/accumulator_sum.cpp
@@ -50,7 +50,7 @@ REGISTER_ACCUMULATOR(sum, genericParseSingleExpressionAccumulator<AccumulatorSum
REGISTER_STABLE_EXPRESSION(sum, ExpressionFromAccumulator<AccumulatorSum>::parse);
REGISTER_REMOVABLE_WINDOW_FUNCTION(sum, AccumulatorSum, WindowFunctionSum);
REGISTER_ACCUMULATOR_WITH_MIN_VERSION(
- count, parseCountAccumulator, ServerGlobalParams::FeatureCompatibility::Version::kVersion50);
+ count, parseCountAccumulator, ServerGlobalParams::FeatureCompatibility::Version::kVersion51);
REGISTER_WINDOW_FUNCTION(count, window_function::parseCountWindowFunction);
diff --git a/src/mongo/db/pipeline/document_source_set_window_fields.cpp b/src/mongo/db/pipeline/document_source_set_window_fields.cpp
index ff728f14349..eaee99d5b82 100644
--- a/src/mongo/db/pipeline/document_source_set_window_fields.cpp
+++ b/src/mongo/db/pipeline/document_source_set_window_fields.cpp
@@ -78,14 +78,14 @@ REGISTER_DOCUMENT_SOURCE_WITH_MIN_VERSION(
LiteParsedDocumentSourceDefault::parse,
document_source_set_window_fields::createFromBson,
AllowedWithApiStrict::kNeverInVersion1,
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50);
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50);
REGISTER_DOCUMENT_SOURCE_WITH_MIN_VERSION(
_internalSetWindowFields,
LiteParsedDocumentSourceDefault::parse,
DocumentSourceInternalSetWindowFields::createFromBson,
AllowedWithApiStrict::kNeverInVersion1,
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50);
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50);
list<intrusive_ptr<DocumentSource>> document_source_set_window_fields::createFromBson(
BSONElement elem, const intrusive_ptr<ExpressionContext>& expCtx) {
diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp
index 064caf30224..4d0f4a29893 100644
--- a/src/mongo/db/pipeline/expression.cpp
+++ b/src/mongo/db/pipeline/expression.cpp
@@ -7328,11 +7328,12 @@ void ExpressionDateTrunc::_doAddDependencies(DepsTracker* deps) const {
}
/* -------------------------- ExpressionGetField ------------------------------ */
-REGISTER_EXPRESSION_WITH_MIN_VERSION(getField,
- ExpressionGetField::parse,
- AllowedWithApiStrict::kNeverInVersion1,
- AllowedWithClientType::kAny,
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50);
+REGISTER_EXPRESSION_WITH_MIN_VERSION(
+ getField,
+ ExpressionGetField::parse,
+ AllowedWithApiStrict::kNeverInVersion1,
+ AllowedWithClientType::kAny,
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50);
intrusive_ptr<Expression> ExpressionGetField::parse(ExpressionContext* const expCtx,
BSONElement expr,
@@ -7439,18 +7440,20 @@ Value ExpressionGetField::serialize(const bool explain) const {
}
/* -------------------------- ExpressionSetField ------------------------------ */
-REGISTER_EXPRESSION_WITH_MIN_VERSION(setField,
- ExpressionSetField::parse,
- AllowedWithApiStrict::kNeverInVersion1,
- AllowedWithClientType::kAny,
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50);
+REGISTER_EXPRESSION_WITH_MIN_VERSION(
+ setField,
+ ExpressionSetField::parse,
+ AllowedWithApiStrict::kNeverInVersion1,
+ AllowedWithClientType::kAny,
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50);
// $unsetField is syntactic sugar for $setField where value is set to $$REMOVE.
-REGISTER_EXPRESSION_WITH_MIN_VERSION(unsetField,
- ExpressionSetField::parse,
- AllowedWithApiStrict::kNeverInVersion1,
- AllowedWithClientType::kAny,
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50);
+REGISTER_EXPRESSION_WITH_MIN_VERSION(
+ unsetField,
+ ExpressionSetField::parse,
+ AllowedWithApiStrict::kNeverInVersion1,
+ AllowedWithClientType::kAny,
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50);
intrusive_ptr<Expression> ExpressionSetField::parse(ExpressionContext* const expCtx,
BSONElement expr,
@@ -7581,11 +7584,12 @@ Value ExpressionTsSecond::evaluate(const Document& root, Variables* variables) c
return Value(static_cast<long long>(operand.getTimestamp().getSecs()));
}
-REGISTER_EXPRESSION_WITH_MIN_VERSION(tsSecond,
- ExpressionTsSecond::parse,
- AllowedWithApiStrict::kNeverInVersion1,
- AllowedWithClientType::kAny,
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50);
+REGISTER_EXPRESSION_WITH_MIN_VERSION(
+ tsSecond,
+ ExpressionTsSecond::parse,
+ AllowedWithApiStrict::kNeverInVersion1,
+ AllowedWithClientType::kAny,
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50);
/* ------------------------- ExpressionTsIncrement ----------------------------- */
@@ -7604,11 +7608,12 @@ Value ExpressionTsIncrement::evaluate(const Document& root, Variables* variables
return Value(static_cast<long long>(operand.getTimestamp().getInc()));
}
-REGISTER_EXPRESSION_WITH_MIN_VERSION(tsIncrement,
- ExpressionTsIncrement::parse,
- AllowedWithApiStrict::kNeverInVersion1,
- AllowedWithClientType::kAny,
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50);
+REGISTER_EXPRESSION_WITH_MIN_VERSION(
+ tsIncrement,
+ ExpressionTsIncrement::parse,
+ AllowedWithApiStrict::kNeverInVersion1,
+ AllowedWithClientType::kAny,
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50);
MONGO_INITIALIZER_GROUP(BeginExpressionRegistration, ("default"), ("EndExpressionRegistration"))
MONGO_INITIALIZER_GROUP(EndExpressionRegistration, ("BeginExpressionRegistration"), ())
diff --git a/src/mongo/db/pipeline/field_path.cpp b/src/mongo/db/pipeline/field_path.cpp
index 00dc46b520c..6a78400d9cc 100644
--- a/src/mongo/db/pipeline/field_path.cpp
+++ b/src/mongo/db/pipeline/field_path.cpp
@@ -100,7 +100,7 @@ void FieldPath::uassertValidFieldName(StringData fieldName) {
const auto dotsAndDollarsHint =
serverGlobalParams.featureCompatibility.isVersionInitialized() &&
serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- FeatureCompatibilityParams::Version::kVersion50)
+ FeatureCompatibilityParams::Version::kFullyDowngradedTo50)
? " Consider using $getField or $setField."
: "";
diff --git a/src/mongo/db/s/create_collection_coordinator.cpp b/src/mongo/db/s/create_collection_coordinator.cpp
index 02f43ee953e..b030289ab67 100644
--- a/src/mongo/db/s/create_collection_coordinator.cpp
+++ b/src/mongo/db/s/create_collection_coordinator.cpp
@@ -679,7 +679,7 @@ void CreateCollectionCoordinator::_createPolicyAndChunks(OperationContext* opCtx
*_collectionUUID,
ShardingState::get(opCtx)->shardId(),
ChunkEntryFormat::getForVersionCallerGuaranteesFCVStability(
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50)});
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50)});
// There must be at least one chunk.
invariant(!_initialChunks.chunks.empty());
diff --git a/src/mongo/db/s/resharding/resharding_coordinator_service.cpp b/src/mongo/db/s/resharding/resharding_coordinator_service.cpp
index 743815a3633..2c81cf671c6 100644
--- a/src/mongo/db/s/resharding/resharding_coordinator_service.cpp
+++ b/src/mongo/db/s/resharding/resharding_coordinator_service.cpp
@@ -892,7 +892,7 @@ ReshardingCoordinatorExternalStateImpl::calculateParticipantShardsAndChunks(
coordinatorDoc.getReshardingUUID(),
*donorShardIds.begin(),
ChunkEntryFormat::getForVersionCallerGuaranteesFCVStability(
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50)};
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50)};
auto splitResult = initialSplitter.createFirstChunks(opCtx, shardKey, splitParams);
initialChunks = std::move(splitResult.chunks);
diff --git a/src/mongo/db/s/shard_collection_legacy.cpp b/src/mongo/db/s/shard_collection_legacy.cpp
index 2730d7c3ee2..028df745a3d 100644
--- a/src/mongo/db/s/shard_collection_legacy.cpp
+++ b/src/mongo/db/s/shard_collection_legacy.cpp
@@ -562,7 +562,7 @@ CreateCollectionResponse shardCollection(OperationContext* opCtx,
serverGlobalParams.featureCompatibility.getVersion() == FCVersion::kVersion49) {
checkForExistingChunks(opCtx, nss, boost::none);
} else if (serverGlobalParams.featureCompatibility.getVersion() ==
- FCVersion::kVersion50) {
+ FCVersion::kFullyDowngradedTo50) {
if (auto optUUID = sharding_ddl_util::getCollectionUUID(opCtx, nss))
checkForExistingChunks(opCtx, nss, optUUID);
} else {
diff --git a/src/mongo/db/s/sharding_ddl_50_upgrade_downgrade.cpp b/src/mongo/db/s/sharding_ddl_50_upgrade_downgrade.cpp
index 8e3a68eed6b..6f8fe9e4247 100644
--- a/src/mongo/db/s/sharding_ddl_50_upgrade_downgrade.cpp
+++ b/src/mongo/db/s/sharding_ddl_50_upgrade_downgrade.cpp
@@ -40,7 +40,10 @@ DatabaseEntryFormat::Format DatabaseEntryFormat::get(const FixedFCVRegion& fcvRe
switch (fcvRegion->getVersion()) {
case FCVersion::kUpgradingFrom44To50:
case FCVersion::kUpgradingFrom49To50:
- case FCVersion::kVersion50:
+ case FCVersion::kUpgradingFrom50To51:
+ case FCVersion::kDowngradingFrom51To50:
+ case FCVersion::kFullyDowngradedTo50:
+ case FCVersion::kVersion51:
return feature_flags::gShardingFullDDLSupportTimestampedVersion.isEnabledAndIgnoreFCV()
? Format::kUUIDandTimestamp
: Format::kUUIDOnly;
@@ -61,7 +64,10 @@ ChunkEntryFormat::Format ChunkEntryFormat::getForVersionCallerGuaranteesFCVStabi
return feature_flags::gShardingFullDDLSupportTimestampedVersion.isEnabledAndIgnoreFCV()
? Format::kNamespaceAndUUIDWithTimestamps
: Format::kNamespaceOnlyNoTimestamps;
- case FCVersion::kVersion50:
+ case FCVersion::kFullyDowngradedTo50:
+ case FCVersion::kVersion51:
+ case FCVersion::kUpgradingFrom50To51:
+ case FCVersion::kDowngradingFrom51To50:
return feature_flags::gShardingFullDDLSupportTimestampedVersion.isEnabledAndIgnoreFCV()
? Format::kUUIDOnlyWithTimestamps
: Format::kNamespaceOnlyNoTimestamps;
diff --git a/src/mongo/db/s/sharding_ddl_util.cpp b/src/mongo/db/s/sharding_ddl_util.cpp
index 107bd3df64b..85682a5925c 100644
--- a/src/mongo/db/s/sharding_ddl_util.cpp
+++ b/src/mongo/db/s/sharding_ddl_util.cpp
@@ -313,7 +313,7 @@ void shardedRenameMetadata(OperationContext* opCtx,
// Only bump the epoch if the whole cluster is in FCV 5.0, so chunks do not contain epochs.
FixedFCVRegion fixedFCVRegion(opCtx);
if (serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- ServerGlobalParams::FeatureCompatibility::Version::kVersion50)) {
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo50)) {
fromCollType.setEpoch(OID::gen());
}
}
diff --git a/src/mongo/db/server_options.h b/src/mongo/db/server_options.h
index 7a5e3cd226f..c8aa3037866 100644
--- a/src/mongo/db/server_options.h
+++ b/src/mongo/db/server_options.h
@@ -165,64 +165,58 @@ struct ServerGlobalParams {
* (Y, Y, X): Only Y features are available and new storage engine entries use the
* Y format, but existing entries may have either the Y or X format
*
- * kUnsetDefault44Behavior
+ * kUnsetDefault{LTS}Behavior
* (Unset, Unset, Unset): This is the case on startup before the fCV document is loaded into
* memory. isVersionInitialized() will return false, and getVersion()
- * will return the default (kUnsetDefault44Behavior).
+ * will return the default (kUnsetDefault{LTS}Behavior).
*
*/
enum class Version {
// The order of these enums matter: sort by (version, targetVersion, previousVersion).
kInvalid,
- kUnsetDefault44Behavior,
- kFullyDowngradedTo44, // { version: 4.4 }
- kDowngradingFrom47To44, // { version: 4.4, targetVersion: 4.4, previousVersion: 4.7 }
- kDowngradingFrom48To44, // { version: 4.4, targetVersion: 4.4, previousVersion: 4.8 }
- kDowngradingFrom49To44, // { version: 4.4, targetVersion: 4.4, previousVersion: 4.9 }
- kDowngradingFrom50To44, // { version: 4.4, targetVersion: 4.4, previousVersion: 5.0 }
- kUpgradingFrom44To47, // { version: 4.4, targetVersion: 4.7 }
- kUpgradingFrom44To48, // { version: 4.4, targetVersion: 4.8 }
- kUpgradingFrom44To49, // { version: 4.4, targetVersion: 4.9 }
- kUpgradingFrom44To50, // { version: 4.4, targetVersion: 5.0 }
- kVersion47, // { version: 4.7 }
- kDowngradingFrom48To47, // { version: 4.7, targetVersion: 4.7, previousVersion: 4.8 }
- kUpgradingFrom47To48, // { version: 4.7, targetVersion: 4.8 }
- kVersion48, // { version: 4.8 }
- kDowngradingFrom49To48, // { version: 4.8, targetVersion: 4.8, previousVersion: 4.9 }
- kUpgradingFrom48To49, // { version: 4.8, targetVersion: 4.9 }
- kVersion49, // { version: 4.9 }
- kDowngradingFrom50To49, // { version: 4.9, targetVersion: 4.9, previousVersion: 5.0 }
- kUpgradingFrom49To50, // { version: 4.9, targetVersion: 5.0 }
- kVersion50, // { version: 5.0 }
+ kVersion44, // To be removed once old feature flags are deleted
+ kVersion47, // To be removed once old feature flags are deleted
+ kVersion48, // To be removed once old feature flags are deleted
+ kVersion49, // To be removed once old feature flags are deleted
+ kFullyDowngradedTo44, // To be removed once old feature flags are deleted
+ kDowngradingFrom50To49, // To be removed once old feature flags are deleted
+ kDowngradingFrom50To44, // To be removed once old feature flags are deleted
+ kUpgradingFrom44To50, // To be removed once old feature flags are deleted
+ kUpgradingFrom44To47, // To be removed once old feature flags are deleted
+ kUpgradingFrom49To50, // To be removed once old feature flags are deleted
+ kUnsetDefault50Behavior,
+ kFullyDowngradedTo50, // { version: 5.0 }
+ kDowngradingFrom51To50, // { version: 5.0, targetVersion: 5.0, previousVersion: 5.1 }
+ kUpgradingFrom50To51, // { version: 5.0, targetVersion: 5.1 }
+ kVersion51, // { version: 5.1 }
};
// These constants should only be used for generic FCV references. Generic references are
// FCV references that are expected to exist across LTS binary versions.
- static constexpr Version kLatest = Version::kVersion50;
- static constexpr Version kLastContinuous = Version::kVersion49;
- static constexpr Version kLastLTS = Version::kFullyDowngradedTo44;
+ static constexpr Version kLatest = Version::kVersion51;
+ static constexpr Version kLastContinuous = Version::kFullyDowngradedTo50;
+ static constexpr Version kLastLTS = Version::kFullyDowngradedTo50;
// These constants should only be used for generic FCV references. Generic references are
// FCV references that are expected to exist across LTS binary versions.
// NOTE: DO NOT USE THEM FOR REGULAR FCV CHECKS.
- static constexpr Version kUpgradingFromLastLTSToLatest = Version::kUpgradingFrom44To50;
+ static constexpr Version kUpgradingFromLastLTSToLatest = Version::kUpgradingFrom50To51;
static constexpr Version kUpgradingFromLastContinuousToLatest =
- Version::kUpgradingFrom49To50;
- static constexpr Version kDowngradingFromLatestToLastLTS = Version::kDowngradingFrom50To44;
+ Version::kUpgradingFrom50To51;
+ static constexpr Version kDowngradingFromLatestToLastLTS = Version::kDowngradingFrom51To50;
static constexpr Version kDowngradingFromLatestToLastContinuous =
- Version::kDowngradingFrom50To49;
+ Version::kDowngradingFrom51To50;
// kUpgradingFromLastLTSToLastContinuous is only ever set to a valid FCV when
// kLastLTS and kLastContinuous are not equal. Otherwise, this value should be set to
// kInvalid.
- static constexpr Version kUpgradingFromLastLTSToLastContinuous =
- Version::kUpgradingFrom44To49;
+ static constexpr Version kUpgradingFromLastLTSToLastContinuous = Version::kInvalid;
/**
* On startup, the featureCompatibilityVersion may not have been explicitly set yet. This
* exposes the actual state of the featureCompatibilityVersion if it is uninitialized.
*/
const bool isVersionInitialized() const {
- return _version.load() != Version::kUnsetDefault44Behavior;
+ return _version.load() != Version::kUnsetDefault50Behavior;
}
/**
@@ -275,7 +269,7 @@ struct ServerGlobalParams {
}
void reset() {
- _version.store(Version::kUnsetDefault44Behavior);
+ _version.store(Version::kUnsetDefault50Behavior);
}
void setVersion(Version version) {
@@ -283,7 +277,7 @@ struct ServerGlobalParams {
}
private:
- AtomicWord<Version> _version{Version::kUnsetDefault44Behavior};
+ AtomicWord<Version> _version{Version::kUnsetDefault50Behavior};
} mutableFeatureCompatibility;
diff --git a/src/mongo/db/update/pipeline_executor.cpp b/src/mongo/db/update/pipeline_executor.cpp
index 3bd5ec062fe..c2e77fb1e90 100644
--- a/src/mongo/db/update/pipeline_executor.cpp
+++ b/src/mongo/db/update/pipeline_executor.cpp
@@ -104,7 +104,7 @@ UpdateExecutor::ApplyResult PipelineExecutor::applyUpdate(ApplyParams applyParam
bool allowTopLevelDollarPrefixedFields =
serverGlobalParams.featureCompatibility.isVersionInitialized() &&
serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- FeatureCompatibilityParams::Version::kVersion50);
+ FeatureCompatibilityParams::Version::kFullyDowngradedTo50);
auto ret = ObjectReplaceExecutor::applyReplacementUpdate(
applyParams, transformedDoc, transformedDocHasIdField, allowTopLevelDollarPrefixedFields);
diff --git a/src/mongo/db/update/storage_validation.cpp b/src/mongo/db/update/storage_validation.cpp
index 12f7559fefd..444637470f3 100644
--- a/src/mongo/db/update/storage_validation.cpp
+++ b/src/mongo/db/update/storage_validation.cpp
@@ -115,7 +115,7 @@ void validateDollarPrefixElement(mutablebson::ConstElement elem) {
const auto replaceWithHint =
serverGlobalParams.featureCompatibility.isVersionInitialized() &&
serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- FeatureCompatibilityParams::Version::kVersion50)
+ FeatureCompatibilityParams::Version::kFullyDowngradedTo50)
? "' is not allowed in the context of an update's replacement document. Consider using "
"an aggregation pipeline with $replaceWith."
: "' is not valid for storage.";
@@ -140,7 +140,7 @@ Status storageValidIdField(const mongo::BSONElement& element) {
if (!status.isOK() && status.code() == ErrorCodes::DollarPrefixedFieldName &&
serverGlobalParams.featureCompatibility.isVersionInitialized() &&
serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- FeatureCompatibilityParams::Version::kVersion50)) {
+ FeatureCompatibilityParams::Version::kFullyDowngradedTo50)) {
return Status(status.code(),
str::stream() << "_id fields may not contain '$'-prefixed fields: "
<< status.reason());
@@ -203,7 +203,7 @@ void storageValid(mutablebson::ConstElement elem,
const bool dotsAndDollarsFeatureEnabled =
serverGlobalParams.featureCompatibility.isVersionInitialized() &&
serverGlobalParams.featureCompatibility.isGreaterThanOrEqualTo(
- FeatureCompatibilityParams::Version::kVersion50);
+ FeatureCompatibilityParams::Version::kFullyDowngradedTo50);
const bool checkFields = !dotsAndDollarsFeatureEnabled || checkTopLevelFields;
auto fieldName = elem.getFieldName();
diff --git a/src/mongo/db/wire_version.h b/src/mongo/db/wire_version.h
index 45712e1c298..9d1c72d20f3 100644
--- a/src/mongo/db/wire_version.h
+++ b/src/mongo/db/wire_version.h
@@ -95,16 +95,19 @@ enum WireVersion {
// Supports features available from 5.0 and onwards.
WIRE_VERSION_50 = 13,
+ // Supports features available from 5.1 and onwards.
+ WIRE_VERSION_51 = 14,
+
// Set this to the highest value in this enum - it will be the default maxWireVersion for
// the WireSpec values.
- LATEST_WIRE_VERSION = WIRE_VERSION_50,
+ LATEST_WIRE_VERSION = WIRE_VERSION_51,
// Set this to LATEST_WIRE_VERSION - 1.
LAST_CONT_WIRE_VERSION = LATEST_WIRE_VERSION - 1,
// Set this to the wire version of the previous LTS version. We expect to update this after
// each LTS release.
- LAST_LTS_WIRE_VERSION = RESUMABLE_INITIAL_SYNC,
+ LAST_LTS_WIRE_VERSION = WIRE_VERSION_50,
};
/**