diff options
author | Spencer T Brody <spencer@mongodb.com> | 2014-05-13 15:13:06 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2014-05-14 11:21:30 -0400 |
commit | a51c7bcac0b93ea0a0da73974bac6c469075864d (patch) | |
tree | a85b8fd269f1fc5eed0cc06bcd43526ba92bc31f /src/mongo/db/auth/authorization_manager.h | |
parent | 06033e18fb1fe66d00f130227317d9ae531bb6f5 (diff) | |
download | mongo-a51c7bcac0b93ea0a0da73974bac6c469075864d.tar.gz |
SERVER-11980 Only invalidate the user cache on mongos if authorization information actually changed
Diffstat (limited to 'src/mongo/db/auth/authorization_manager.h')
-rw-r--r-- | src/mongo/db/auth/authorization_manager.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mongo/db/auth/authorization_manager.h b/src/mongo/db/auth/authorization_manager.h index d46c07053ab..8782ae06d5c 100644 --- a/src/mongo/db/auth/authorization_manager.h +++ b/src/mongo/db/auth/authorization_manager.h @@ -38,6 +38,7 @@ #include "mongo/base/disallow_copying.h" #include "mongo/base/status.h" #include "mongo/bson/mutable/element.h" +#include "mongo/bson/oid.h" #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/resource_pattern.h" #include "mongo/db/auth/role_graph.h" @@ -165,6 +166,11 @@ namespace mongo { */ Status getAuthorizationVersion(int* version); + /** + * Returns the user cache generation identifier. + */ + OID getCacheGeneration(); + // Returns true if there exists at least one privilege document in the system. bool hasAnyPrivilegeDocuments() const; @@ -444,6 +450,11 @@ namespace mongo { const BSONObj* o2); /** + * Updates _cacheGeneration to a new OID + */ + void _updateCacheGeneration_inlock(); + + /** * Fetches user information from a v2-schema user document for the named user, * and stores a pointer to a new user object into *acquiredUser on success. */ @@ -485,10 +496,10 @@ namespace mongo { unordered_map<UserName, User*> _userCache; /** - * Current generation of cached data. Bumped every time part of the cache gets - * invalidated. + * Current generation of cached data. Updated every time part of the cache gets + * invalidated. Protected by CacheGuard. */ - uint64_t _cacheGeneration; + OID _cacheGeneration; /** * True if there is an update to the _userCache in progress, and that update is currently in |