diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2020-11-03 12:42:38 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-11-13 20:15:34 +0000 |
commit | 8f9823f644d0b6beba8a301866141a578d278534 (patch) | |
tree | 1ef4bc439da93a2b39cff7c96a975668c27e7070 /src/mongo/db/introspect.cpp | |
parent | b670258ac185ecea0492c742f2f50da9d8ab618f (diff) | |
download | mongo-8f9823f644d0b6beba8a301866141a578d278534.tar.gz |
SERVER-52556 Versioned CollectionCatalog. Writes are performed using copy-on-write.
Internal mutexes when reading CollectionCatalog are removed, just one mutex for writes are needed.
Lock-free reads helper AutoGetCollectionForReadLockFree stashes a CollectionCatalog consistent with snapshot on OperationContext
Diffstat (limited to 'src/mongo/db/introspect.cpp')
-rw-r--r-- | src/mongo/db/introspect.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp index 12dc4c200f1..29b67e4c2eb 100644 --- a/src/mongo/db/introspect.cpp +++ b/src/mongo/db/introspect.cpp @@ -136,7 +136,8 @@ void profile(OperationContext* opCtx, NetworkOp op) { EnforcePrepareConflictsBlock enforcePrepare(opCtx); uassertStatusOK(createProfileCollection(opCtx, db)); - auto coll = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(opCtx, dbProfilingNS); + auto coll = + CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, dbProfilingNS); invariant(!opCtx->shouldParticipateInFlowControl()); WriteUnitOfWork wuow(opCtx); @@ -166,7 +167,7 @@ Status createProfileCollection(OperationContext* opCtx, Database* db) { // and see the collection exists in order to break free. return writeConflictRetry(opCtx, "createProfileCollection", dbProfilingNS.ns(), [&] { const CollectionPtr collection = - CollectionCatalog::get(opCtx).lookupCollectionByNamespace(opCtx, dbProfilingNS); + CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, dbProfilingNS); if (collection) { if (!collection->isCapped()) { return Status(ErrorCodes::NamespaceExists, |