diff options
author | Benety Goh <benety@mongodb.com> | 2021-04-29 13:18:28 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-04-29 17:57:26 +0000 |
commit | ba92efbdba666465e7ccad076412174bc8673fc9 (patch) | |
tree | 7b4666042f7b4bdbb43e5731567028ee2abaf3a9 /src/mongo/db/commands/feature_compatibility_version.cpp | |
parent | 51bef6c2d9d035afed3735ea107d1e7b58392d93 (diff) | |
download | mongo-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.cpp | 3 |
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( |