summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog_cache.h
diff options
context:
space:
mode:
authorTommaso Tocci <tommaso.tocci@mongodb.com>2020-07-01 23:38:55 +0200
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-21 13:10:16 +0000
commita3598c1fbad542259a48505859c97414a01708ad (patch)
treeda4a9c8a637946a911abc8394fa13b599dd236f4 /src/mongo/s/catalog_cache.h
parent7c8da9266bb0b2f92dbe0dd2e584a48cd409b80d (diff)
downloadmongo-a3598c1fbad542259a48505859c97414a01708ad.tar.gz
SERVER-49292 Futurify CatalogCacheLoader API
Diffstat (limited to 'src/mongo/s/catalog_cache.h')
-rw-r--r--src/mongo/s/catalog_cache.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mongo/s/catalog_cache.h b/src/mongo/s/catalog_cache.h
index 0ce48cd7ffa..0d8b639c68d 100644
--- a/src/mongo/s/catalog_cache.h
+++ b/src/mongo/s/catalog_cache.h
@@ -40,6 +40,7 @@
#include "mongo/s/client/shard.h"
#include "mongo/s/database_version_gen.h"
#include "mongo/util/concurrency/notification.h"
+#include "mongo/util/concurrency/thread_pool.h"
#include "mongo/util/concurrency/with_lock.h"
#include "mongo/util/string_map.h"
@@ -128,7 +129,7 @@ class CatalogCache {
CatalogCache& operator=(const CatalogCache&) = delete;
public:
- CatalogCache(CatalogCacheLoader& cacheLoader);
+ CatalogCache(CatalogCacheLoader& cacheLoader, std::shared_ptr<ThreadPool> executor);
~CatalogCache();
/**
@@ -302,6 +303,13 @@ public:
*/
void checkAndRecordOperationBlockedByRefresh(OperationContext* opCtx, mongo::LogicalOp opType);
+ /**
+ * Returns a ThreadPool with default options to be used for CatalogCache.
+ *
+ * The returned ThreadPool is already started up.
+ */
+ static std::shared_ptr<ThreadPool> makeDefaultThreadPool();
+
private:
// Make the cache entries friends so they can access the private classes below
friend class CachedDatabaseInfo;
@@ -353,7 +361,7 @@ private:
* database entry must be in the 'needsRefresh' state.
*/
void _scheduleDatabaseRefresh(WithLock,
- const std::string& dbName,
+ StringData dbName,
std::shared_ptr<DatabaseInfoEntry> dbEntry);
/**
@@ -361,6 +369,7 @@ private:
* namespace must be in the 'needRefresh' state.
*/
void _scheduleCollectionRefresh(WithLock,
+ ServiceContext* service,
std::shared_ptr<CollectionRoutingInfoEntry> collEntry,
NamespaceString const& nss,
int refreshAttempt);
@@ -487,6 +496,8 @@ private:
} _stats;
+ std::shared_ptr<ThreadPool> _executor;
+
using DatabaseInfoMap = StringMap<std::shared_ptr<DatabaseInfoEntry>>;
using CollectionInfoMap = StringMap<std::shared_ptr<CollectionRoutingInfoEntry>>;
using CollectionsByDbMap = StringMap<CollectionInfoMap>;