From e0359268121833e7c29d62e5dff28532910b996f Mon Sep 17 00:00:00 2001 From: Louis Williams Date: Fri, 22 Sep 2017 13:55:59 -0400 Subject: SERVER-31209 Persist targetVersion in FCV document to indicate an upgrade/downgrade in progress. --- src/mongo/db/server_options.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/mongo/db/server_options.h') diff --git a/src/mongo/db/server_options.h b/src/mongo/db/server_options.h index a82d20acc79..23f8bddff4f 100644 --- a/src/mongo/db/server_options.h +++ b/src/mongo/db/server_options.h @@ -158,14 +158,22 @@ struct ServerGlobalParams { * 3.4 node can participate in a cluster whose feature compatibility version is 3.6. */ k36, + /** + * This is only used for targetVersion to indicate that no upgrade is in progress. + */ + kUnset }; // Read-only parameter featureCompatibilityVersion. AtomicWord version{Version::k34}; - // Read-only global isSchemaVersion36. This determines whether to give Collections UUIDs - // upon creation. - AtomicWord isSchemaVersion36{false}; + // If set, an upgrade or downgrade is in progress to the set version. + AtomicWord targetVersion{Version::kUnset}; + + // This determines whether to give Collections UUIDs upon creation. + bool isSchemaVersion36() { + return (version.load() == Version::k36 || targetVersion.load() == Version::k36); + } // Feature validation differs depending on the role of a mongod in a replica set or // master/slave configuration. Masters/primaries can accept user-initiated writes and -- cgit v1.2.1