summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog_cache.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/catalog_cache.h')
-rw-r--r--src/mongo/s/catalog_cache.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/mongo/s/catalog_cache.h b/src/mongo/s/catalog_cache.h
index 1b40ffb5a53..48c781d27ad 100644
--- a/src/mongo/s/catalog_cache.h
+++ b/src/mongo/s/catalog_cache.h
@@ -140,16 +140,13 @@ 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);
+ StatusWith<CachedDatabaseInfo> getDatabase(OperationContext* opCtx,
+ StringData dbName,
+ bool allowLocks = false);
/**
* Blocking method to get the routing information for a specific collection at a given cluster
@@ -257,6 +254,13 @@ 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.
@@ -332,13 +336,6 @@ 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,
@@ -366,6 +363,18 @@ 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.
*/