summaryrefslogtreecommitdiff
path: root/src/mongo/db/auth/authorization_manager_impl.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2020-05-03 01:09:53 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-07 05:42:43 +0000
commit7ee768a17cbc78f42c8e8938df2c68635f871bdf (patch)
tree77c99859031e3b96012ef829875fa922365f7252 /src/mongo/db/auth/authorization_manager_impl.cpp
parent59b1b711a622b6b1b77accbe459b064e52d45375 (diff)
downloadmongo-7ee768a17cbc78f42c8e8938df2c68635f871bdf.tar.gz
SERVER-47916 Make InvalidatingLRUCache use an 'epoch' when invalidating evicted checked-out values
Diffstat (limited to 'src/mongo/db/auth/authorization_manager_impl.cpp')
-rw-r--r--src/mongo/db/auth/authorization_manager_impl.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/mongo/db/auth/authorization_manager_impl.cpp b/src/mongo/db/auth/authorization_manager_impl.cpp
index 5b79c377f05..e3552ae7332 100644
--- a/src/mongo/db/auth/authorization_manager_impl.cpp
+++ b/src/mongo/db/auth/authorization_manager_impl.cpp
@@ -655,11 +655,16 @@ AuthorizationManagerImpl::AuthSchemaVersionCache::AuthSchemaVersionCache(
ServiceContext* service,
ThreadPoolInterface& threadPool,
AuthzManagerExternalState* externalState)
- : ReadThroughCache(_mutex, service, threadPool, 1 /* cacheSize */),
+ : ReadThroughCache(
+ _mutex,
+ service,
+ threadPool,
+ [this](OperationContext* opCtx, int unusedKey) { return _lookup(opCtx, unusedKey); },
+ 1 /* cacheSize */),
_externalState(externalState) {}
-boost::optional<int> AuthorizationManagerImpl::AuthSchemaVersionCache::lookup(
- OperationContext* opCtx, const int& unusedKey) {
+boost::optional<int> AuthorizationManagerImpl::AuthSchemaVersionCache::_lookup(
+ OperationContext* opCtx, int unusedKey) {
invariant(unusedKey == 0);
int authzVersion;
@@ -674,12 +679,18 @@ AuthorizationManagerImpl::UserCacheImpl::UserCacheImpl(
int cacheSize,
AuthSchemaVersionCache* authSchemaVersionCache,
AuthzManagerExternalState* externalState)
- : UserCache(_mutex, service, threadPool, cacheSize),
+ : UserCache(_mutex,
+ service,
+ threadPool,
+ [this](OperationContext* opCtx, const UserRequest& userReq) {
+ return _lookup(opCtx, userReq);
+ },
+ cacheSize),
_authSchemaVersionCache(authSchemaVersionCache),
_externalState(externalState) {}
-boost::optional<User> AuthorizationManagerImpl::UserCacheImpl::lookup(OperationContext* opCtx,
- const UserRequest& userReq) {
+boost::optional<User> AuthorizationManagerImpl::UserCacheImpl::_lookup(OperationContext* opCtx,
+ const UserRequest& userReq) {
LOGV2_DEBUG(20238, 1, "Getting user record", "user"_attr = userReq.name);
// Number of times to retry a user document that fetches due to transient AuthSchemaIncompatible