summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog_cache.h
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/s/catalog_cache.h
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
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.
*/