summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMaria van Keulen <maria@mongodb.com>2018-04-20 16:52:39 -0400
committerMaria van Keulen <maria@mongodb.com>2018-04-23 12:56:53 -0400
commit5b40332d8d5cebdf47c43694bc5b9911841bde81 (patch)
tree2a9beb5b6b4039a5a50f3805050f5911d88ee8a0 /src/mongo
parent8157a4b01014753ce0f4a1b52a1410cb5887edb4 (diff)
downloadmongo-5b40332d8d5cebdf47c43694bc5b9911841bde81.tar.gz
SERVER-34600 uassert if using getParameter to read uninitialized fCV
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/base/error_codes.err1
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.cpp4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/base/error_codes.err b/src/mongo/base/error_codes.err
index 023bd887318..dceb57de618 100644
--- a/src/mongo/base/error_codes.err
+++ b/src/mongo/base/error_codes.err
@@ -255,6 +255,7 @@ error_code("FreeMonHttpTemporaryFailure", 254)
error_code("FreeMonHttpPermanentFailure", 255)
error_code("TransactionCommitted", 256)
error_code("TransactionTooLarge", 257)
+error_code("UnknownFeatureCompatibilityVersion", 258);
# Error codes 4000-8999 are reserved.
diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp
index 20935c0a4f2..a387b69d2a0 100644
--- a/src/mongo/db/commands/feature_compatibility_version.cpp
+++ b/src/mongo/db/commands/feature_compatibility_version.cpp
@@ -289,6 +289,10 @@ public:
virtual void append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& name) {
BSONObjBuilder featureCompatibilityVersionBuilder(b.subobjStart(name));
+ uassert(ErrorCodes::UnknownFeatureCompatibilityVersion,
+ str::stream() << FeatureCompatibilityVersionParser::kParameterName
+ << " is not yet known.",
+ serverGlobalParams.featureCompatibility.isVersionInitialized());
switch (serverGlobalParams.featureCompatibility.getVersion()) {
case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40:
featureCompatibilityVersionBuilder.append(