summaryrefslogtreecommitdiff
path: root/src/mongo/db/startup_recovery.cpp
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2020-08-14 10:23:04 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-02 23:53:39 +0000
commitbf5914a20b596ba3bde772b42e579e028f733bac (patch)
tree2b26469571786d9adb5e95c47990c2416bfab9c4 /src/mongo/db/startup_recovery.cpp
parent6b3e341703b781bb1ff7b1263406a0f1d28dd77c (diff)
downloadmongo-bf5914a20b596ba3bde772b42e579e028f733bac.tar.gz
SERVER-50317 Const correct uses of Collection
Most of the code should only need a const Collection now. AutoGetCollection returns a const Collection by default. There is a placeholder getWritableCollection() interface that will handle the necessary steps we need for lock free reads in the future. Added some operators to AutoGetCollection so it behaves more like a smart pointer.
Diffstat (limited to 'src/mongo/db/startup_recovery.cpp')
-rw-r--r--src/mongo/db/startup_recovery.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/startup_recovery.cpp b/src/mongo/db/startup_recovery.cpp
index 11d38fa42c3..309ffa96180 100644
--- a/src/mongo/db/startup_recovery.cpp
+++ b/src/mongo/db/startup_recovery.cpp
@@ -105,7 +105,7 @@ Status restoreMissingFeatureCompatibilityVersionDocument(OperationContext* opCtx
createCollection(opCtx, fcvNss.db().toString(), BSON("create" << fcvNss.coll())));
}
- Collection* fcvColl = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(
+ const Collection* fcvColl = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(
opCtx, NamespaceString::kServerConfigurationNamespace);
invariant(fcvColl);
@@ -320,7 +320,7 @@ bool hasReplSetConfigDoc(OperationContext* opCtx) {
void assertCappedOplog(OperationContext* opCtx, Database* db) {
const NamespaceString oplogNss(NamespaceString::kRsOplogNamespace);
invariant(opCtx->lockState()->isDbLockedForMode(oplogNss.db(), MODE_IS));
- Collection* oplogCollection =
+ const Collection* oplogCollection =
CollectionCatalog::get(opCtx).lookupCollectionByNamespace(opCtx, oplogNss);
if (oplogCollection && !oplogCollection->isCapped()) {
LOGV2_FATAL_NOTRACE(
@@ -419,7 +419,7 @@ void setReplSetMemberInStandaloneMode(OperationContext* opCtx) {
}
invariant(opCtx->lockState()->isW());
- Collection* collection = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(
+ const Collection* collection = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(
opCtx, NamespaceString::kSystemReplSetNamespace);
if (collection && !collection->isEmpty(opCtx)) {
setReplSetMemberInStandaloneMode(opCtx->getServiceContext(), true);