diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2020-08-14 10:23:04 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-02 23:53:39 +0000 |
commit | bf5914a20b596ba3bde772b42e579e028f733bac (patch) | |
tree | 2b26469571786d9adb5e95c47990c2416bfab9c4 /src/mongo/db/introspect.cpp | |
parent | 6b3e341703b781bb1ff7b1263406a0f1d28dd77c (diff) | |
download | mongo-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/introspect.cpp')
-rw-r--r-- | src/mongo/db/introspect.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp index 41598963c5f..31749c46c96 100644 --- a/src/mongo/db/introspect.cpp +++ b/src/mongo/db/introspect.cpp @@ -160,7 +160,7 @@ void profile(OperationContext* opCtx, NetworkOp op) { EnforcePrepareConflictsBlock enforcePrepare(opCtx); uassertStatusOK(createProfileCollection(opCtx, db)); - Collection* const coll = + const Collection* const coll = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(opCtx, dbProfilingNS); invariant(!opCtx->shouldParticipateInFlowControl()); @@ -190,7 +190,7 @@ Status createProfileCollection(OperationContext* opCtx, Database* db) { // collection creation would endlessly throw errors because the collection exists: must check // and see the collection exists in order to break free. return writeConflictRetry(opCtx, "createProfileCollection", dbProfilingNS.ns(), [&] { - Collection* const collection = + const Collection* const collection = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(opCtx, dbProfilingNS); if (collection) { if (!collection->isCapped()) { |