diff options
author | Dianna Hohensee <dianna.hohensee@mongodb.com> | 2021-01-28 18:25:50 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-02 16:51:18 +0000 |
commit | 168d5f983a3165d2271569b1fc0dbb671771a87f (patch) | |
tree | aeb2d6a99e5ba3a9c060cca921784d8e450bcc74 /src/mongo/db/db_raii.h | |
parent | 868785d084ea685f7d0a269d2a87e8a7df338e5d (diff) | |
download | mongo-168d5f983a3165d2271569b1fc0dbb671771a87f.tar.gz |
SERVER-54024 Use lock-free collection helpers in some auth read lookups and RolesLocks.
Diffstat (limited to 'src/mongo/db/db_raii.h')
-rw-r--r-- | src/mongo/db/db_raii.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mongo/db/db_raii.h b/src/mongo/db/db_raii.h index 0fa2d3526ed..f9ad58e9a4b 100644 --- a/src/mongo/db/db_raii.h +++ b/src/mongo/db/db_raii.h @@ -399,6 +399,25 @@ private: }; /** + * Acquires the global MODE_IS lock and establishes a consistent CollectionCatalog and storage + * snapshot. + */ +class AutoReadLockFree { +public: + AutoReadLockFree(OperationContext* opCtx, Date_t deadline = Date_t::max()); + +private: + // The CollectionCatalogStasher must outlive the LockFreeReadsBlock below. ~LockFreeReadsBlock + // clears a flag that the ~CollectionCatalogStasher checks. + CollectionCatalogStasher _catalogStash; + + // Sets a flag on the opCtx to inform subsequent code that the operation is running lock-free. + LockFreeReadsBlock _lockFreeReadsBlock; + + Lock::GlobalLock _globalLock; +}; + +/** * Establishes a consistent CollectionCatalog with a storage snapshot. Also verifies Database * sharding state for the provided Db. Takes MODE_IS global lock. * |