summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog_cache.h
diff options
context:
space:
mode:
authorEsha Maharishi <esha.maharishi@mongodb.com>2018-04-13 08:52:44 -0400
committerEsha Maharishi <esha.maharishi@mongodb.com>2018-04-13 15:08:34 -0400
commit3a8494c12ecaf85f4456ba7da54b5623e60dacbf (patch)
treee340429a2f457e02d76ebe6cf624fd08bb7e92ee /src/mongo/s/catalog_cache.h
parent8cca1f4c2b19c5f430ed3cb330fd2ef7a925b12f (diff)
downloadmongo-3a8494c12ecaf85f4456ba7da54b5623e60dacbf.tar.gz
SERVER-34163 Make refreshing a database entry in the CatalogCache asynchronous
Diffstat (limited to 'src/mongo/s/catalog_cache.h')
-rw-r--r--src/mongo/s/catalog_cache.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/s/catalog_cache.h b/src/mongo/s/catalog_cache.h
index 9903f19b3ec..35fecda1081 100644
--- a/src/mongo/s/catalog_cache.h
+++ b/src/mongo/s/catalog_cache.h
@@ -198,11 +198,28 @@ private:
// unset if the cache entry has never been loaded, or should not be relied on).
bool needsRefresh{true};
+ // Contains a notification to be waited on for the refresh to complete (only available if
+ // needsRefresh is true)
+ std::shared_ptr<Notification<Status>> refreshCompletionNotification;
+
+ // Until SERVER-34061 goes in, after a database refresh, one thread should also load the
+ // sharded collections. In case multiple threads were queued up on the refresh, this bool
+ // ensures only the first loads the collections.
+ bool mustLoadShardedCollections{true};
+
// Contains the cached info about the database (only available if needsRefresh is false)
boost::optional<DatabaseType> dbt;
};
/**
+ * Non-blocking call which schedules an asynchronous refresh for the specified database. The
+ * database entry must be in the 'needsRefresh' state.
+ */
+ void _scheduleDatabaseRefresh(WithLock,
+ const StringData dbName,
+ std::shared_ptr<DatabaseInfoEntry> dbEntry);
+
+ /**
* Non-blocking call which schedules an asynchronous refresh for the specified namespace. The
* namespace must be in the 'needRefresh' state.
*/