diff options
author | Louis Williams <louis.williams@mongodb.com> | 2017-09-22 13:55:59 -0400 |
---|---|---|
committer | Louis Williams <louis.williams@mongodb.com> | 2017-09-28 11:10:05 -0400 |
commit | b0b99866781302ba8b16de033ff2681f20483c14 (patch) | |
tree | e5e988301e89390aebcf5ec12055465e353dbb77 /src/mongo/db/server_options.h | |
parent | f24fbb0011c6ded9101f08574e7cd07e63690a9b (diff) | |
download | mongo-b0b99866781302ba8b16de033ff2681f20483c14.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 |