summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/feature_compatibility_version.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-04-29 13:18:28 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-29 17:57:26 +0000
commitba92efbdba666465e7ccad076412174bc8673fc9 (patch)
tree7b4666042f7b4bdbb43e5731567028ee2abaf3a9 /src/mongo/db/commands/feature_compatibility_version.cpp
parent51bef6c2d9d035afed3735ea107d1e7b58392d93 (diff)
downloadmongo-ba92efbdba666465e7ccad076412174bc8673fc9.tar.gz
SERVER-47123 use collection lock to read FCV doc
This still locks the DB in MODE_IX but conveys the intent of the FCV function better.
Diffstat (limited to 'src/mongo/db/commands/feature_compatibility_version.cpp')
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp
index a79c6039794..ca316c343b3 100644
--- a/src/mongo/db/commands/feature_compatibility_version.cpp
+++ b/src/mongo/db/commands/feature_compatibility_version.cpp
@@ -241,7 +241,8 @@ void runUpdateCommand(OperationContext* opCtx, const FeatureCompatibilityVersion
boost::optional<BSONObj> FeatureCompatibilityVersion::findFeatureCompatibilityVersionDocument(
OperationContext* opCtx) {
- AutoGetOrCreateDb autoDb(opCtx, NamespaceString::kServerConfigurationNamespace.db(), MODE_IX);
+ AutoGetCollection autoColl(opCtx, NamespaceString::kServerConfigurationNamespace, MODE_IX);
+ invariant(autoColl.ensureDbExists(), NamespaceString::kServerConfigurationNamespace.ns());
const auto query = BSON("_id" << FeatureCompatibilityVersionParser::kParameterName);
const auto swFcv = repl::StorageInterface::get(opCtx)->findById(