diff options
author | Spencer T Brody <spencer@mongodb.com> | 2015-08-06 13:26:55 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2015-08-12 11:27:43 -0400 |
commit | be7db282c80c981882ea67f909eb6be4e53d2d4b (patch) | |
tree | 615bcfdcc2e25e5db24b4d82f3db7cff1f9c4f91 /src/mongo/db/auth/user_cache_invalidator_job.cpp | |
parent | 86a3e6352eb27fd2e6115299bcec5103a830fe36 (diff) | |
download | mongo-be7db282c80c981882ea67f909eb6be4e53d2d4b.tar.gz |
SERVER-19543 Thread OperationContext through to everywhere that accesses the CatalogManager
Diffstat (limited to 'src/mongo/db/auth/user_cache_invalidator_job.cpp')
-rw-r--r-- | src/mongo/db/auth/user_cache_invalidator_job.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mongo/db/auth/user_cache_invalidator_job.cpp b/src/mongo/db/auth/user_cache_invalidator_job.cpp index dd44b200f60..8ad27ca4484 100644 --- a/src/mongo/db/auth/user_cache_invalidator_job.cpp +++ b/src/mongo/db/auth/user_cache_invalidator_job.cpp @@ -88,10 +88,10 @@ public: } exportedIntervalParam; -StatusWith<OID> getCurrentCacheGeneration() { +StatusWith<OID> getCurrentCacheGeneration(OperationContext* txn) { try { BSONObjBuilder result; - const bool ok = grid.catalogManager()->runUserManagementReadCommand( + const bool ok = grid.catalogManager(txn)->runUserManagementReadCommand( "admin", BSON("_getUserCacheGeneration" << 1), &result); if (!ok) { return Command::getStatusFromCommandResult(result.obj()); @@ -107,8 +107,10 @@ StatusWith<OID> getCurrentCacheGeneration() { } // namespace UserCacheInvalidator::UserCacheInvalidator(AuthorizationManager* authzManager) - : _authzManager(authzManager) { - StatusWith<OID> currentGeneration = getCurrentCacheGeneration(); + : _authzManager(authzManager) {} + +void UserCacheInvalidator::initialize(OperationContext* txn) { + StatusWith<OID> currentGeneration = getCurrentCacheGeneration(txn); if (currentGeneration.isOK()) { _previousCacheGeneration = currentGeneration.getValue(); return; @@ -145,7 +147,8 @@ void UserCacheInvalidator::run() { break; } - StatusWith<OID> currentGeneration = getCurrentCacheGeneration(); + auto txn = cc().makeOperationContext(); + StatusWith<OID> currentGeneration = getCurrentCacheGeneration(txn.get()); if (!currentGeneration.isOK()) { if (currentGeneration.getStatus().code() == ErrorCodes::CommandNotFound) { warning() << "_getUserCacheGeneration command not found on config server(s), " |