summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/feature_compatibility_version.h
diff options
context:
space:
mode:
authorLingzhi Deng <lingzhi.deng@mongodb.com>2020-07-06 14:36:42 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-15 20:07:53 +0000
commit5446d926d8d21f3dd583b26980308519a2b67708 (patch)
tree9c9c05dcc1b669a587db47e57ba9aa47d84b0c10 /src/mongo/db/commands/feature_compatibility_version.h
parentc26b0c167e8db6506e547e1daaa51f09a6e6c1bd (diff)
downloadmongo-5446d926d8d21f3dd583b26980308519a2b67708.tar.gz
SERVER-49269: Add 'previousVersion' field to FCV document when in downgrading states
Diffstat (limited to 'src/mongo/db/commands/feature_compatibility_version.h')
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.h37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/mongo/db/commands/feature_compatibility_version.h b/src/mongo/db/commands/feature_compatibility_version.h
index f4d0263f029..b2076f6de7b 100644
--- a/src/mongo/db/commands/feature_compatibility_version.h
+++ b/src/mongo/db/commands/feature_compatibility_version.h
@@ -52,25 +52,29 @@ public:
static Lock::ResourceMutex fcvLock;
/**
- * Records intent to perform a 4.4 -> 4.5.1 upgrade by updating the on-disk feature
- * compatibility version document to have 'version'=4.4, 'targetVersion'=4.5.1.
- * Should be called before schemas are modified.
+ * Records intent to perform a currentVersion -> kLatest upgrade by updating the on-disk
+ * feature compatibility version document to have 'version'=currentVersion,
+ * 'targetVersion'=kLatest. Should be called before schemas are modified.
*/
- static void setTargetUpgrade(OperationContext* opCtx);
+ static void setTargetUpgradeFrom(OperationContext* opCtx,
+ ServerGlobalParams::FeatureCompatibility::Version fromVersion);
/**
- * Records intent to perform a 4.5.1 -> 4.4 downgrade by updating the on-disk feature
- * compatibility version document to have 'version'=4.4, 'targetVersion'=4.4.
- * Should be called before schemas are modified.
+ * Records intent to perform a downgrade from the latest version by updating the on-disk feature
+ * compatibility version document to have 'version'=version, 'targetVersion'=version and
+ * 'previousVersion'=kLatest. Should be called before schemas are modified.
*/
- static void setTargetDowngrade(OperationContext* opCtx);
+ static void setTargetDowngrade(OperationContext* opCtx,
+ ServerGlobalParams::FeatureCompatibility::Version version);
/**
- * Records the completion of a 4.4 <-> 4.5.1 upgrade or downgrade by updating the on-disk
+ * Records the completion of a upgrade or downgrade by updating the on-disk
* feature compatibility version document to have 'version'=version and unsetting the
- * 'targetVersion' field. Should be called after schemas are modified.
+ * 'targetVersion' field and the 'previousVersion' field. Should be called after schemas are
+ * modified.
*/
- static void unsetTargetUpgradeOrDowngrade(OperationContext* opCtx, StringData version);
+ static void unsetTargetUpgradeOrDowngrade(
+ OperationContext* opCtx, ServerGlobalParams::FeatureCompatibility::Version version);
/**
* If there are no non-local databases, store the featureCompatibilityVersion document. If we
@@ -106,17 +110,6 @@ public:
private:
/**
- * Validate version. Uasserts if invalid.
- */
- static void _validateVersion(StringData version);
-
- /**
- * Build update command.
- */
- typedef std::function<void(BSONObjBuilder)> UpdateBuilder;
- static void _runUpdateCommand(OperationContext* opCtx, UpdateBuilder callback);
-
- /**
* Set the FCV to newVersion, making sure to close any outgoing connections with incompatible
* servers and closing open transactions if necessary. Increments the server TopologyVersion.
*/