diff options
author | Louis Williams <louis.williams@mongodb.com> | 2017-09-22 13:55:59 -0400 |
---|---|---|
committer | Louis Williams <louis.williams@mongodb.com> | 2017-10-03 15:02:29 -0400 |
commit | e0359268121833e7c29d62e5dff28532910b996f (patch) | |
tree | 50f6c51e9c3735d5d7c22c1ccc4536b7197fcd1c /src/mongo/db/server_options.h | |
parent | 0c41f7a8da614d1427968b6fd08b5de529f82125 (diff) | |
download | mongo-e0359268121833e7c29d62e5dff28532910b996f.tar.gz |
SERVER-31209 Persist targetVersion in FCV document to indicate an upgrade/downgrade in progress.
Diffstat (limited to 'src/mongo/db/server_options.h')
-rw-r--r-- | src/mongo/db/server_options.h | 14 |
1 files changed, 11 insertions, 3 deletions
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{Version::k34}; - // Read-only global isSchemaVersion36. This determines whether to give Collections UUIDs - // upon creation. - AtomicWord<bool> isSchemaVersion36{false}; + // If set, an upgrade or downgrade is in progress to the set version. + AtomicWord<Version> 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 |