diff options
Diffstat (limited to 'src/mongo/s/catalog_cache.h')
| -rw-r--r-- | src/mongo/s/catalog_cache.h | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/src/mongo/s/catalog_cache.h b/src/mongo/s/catalog_cache.h index 48c781d27ad..1b40ffb5a53 100644 --- a/src/mongo/s/catalog_cache.h +++ b/src/mongo/s/catalog_cache.h @@ -140,13 +140,16 @@ public: virtual ~CatalogCache(); /** + * Shuts down and joins the executor used by all the caches to run their blocking work. + */ + void shutDownAndJoin(); + + /** * Blocking method that ensures the specified database is in the cache, loading it if necessary, * and returns it. If the database was not in cache, all the sharded collections will be in the * 'needsRefresh' state. */ - StatusWith<CachedDatabaseInfo> getDatabase(OperationContext* opCtx, - StringData dbName, - bool allowLocks = false); + StatusWith<CachedDatabaseInfo> getDatabase(OperationContext* opCtx, StringData dbName); /** * Blocking method to get the routing information for a specific collection at a given cluster @@ -254,13 +257,6 @@ public: void report(BSONObjBuilder* builder) const; /** - * Checks if the current operation was ever marked as needing refresh. If the curent operation - * was marked as needing refresh, updates the relevant counters inside the Stats struct. - */ - void checkAndRecordOperationBlockedByRefresh(OperationContext* opCtx, mongo::LogicalOp opType); - - - /** * Non-blocking method that marks the current database entry for the dbName as needing * refresh. Will cause all further targetting attempts to block on a catalog cache refresh, * even if they do not require causal consistency. @@ -336,6 +332,13 @@ private: void _updateRefreshesStats(bool isIncremental, bool add); }; + // Callers of this internal function that are passing allowLocks must handle allowLocks failures + // by checking for ErrorCodes::ShardCannotRefreshDueToLocksHeld and addint the full namespace to + // the exception. + StatusWith<CachedDatabaseInfo> _getDatabase(OperationContext* opCtx, + StringData dbName, + bool allowLocks = false); + StatusWith<ChunkManager> _getCollectionRoutingInfoAt(OperationContext* opCtx, const NamespaceString& nss, boost::optional<Timestamp> atClusterTime, @@ -363,18 +366,6 @@ private: // combined AtomicWord<long long> totalRefreshWaitTimeMicros{0}; - // Cumulative, always-increasing counter of how many operations have been blocked by a - // catalog cache refresh. Broken down by operation type to match the operations tracked - // by the OpCounters class. - struct OperationsBlockedByRefresh { - AtomicWord<long long> countAllOperations{0}; - AtomicWord<long long> countInserts{0}; - AtomicWord<long long> countQueries{0}; - AtomicWord<long long> countUpdates{0}; - AtomicWord<long long> countDeletes{0}; - AtomicWord<long long> countCommands{0}; - } operationsBlockedByRefresh; - /** * Reports the accumulated statistics for serverStatus. */ |
