summaryrefslogtreecommitdiff
path: root/src/mongo/db/sessions_collection_config_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/sessions_collection_config_server.cpp')
-rw-r--r--src/mongo/db/sessions_collection_config_server.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/sessions_collection_config_server.cpp b/src/mongo/db/sessions_collection_config_server.cpp
index 179687e33d4..35fc8c5c837 100644
--- a/src/mongo/db/sessions_collection_config_server.cpp
+++ b/src/mongo/db/sessions_collection_config_server.cpp
@@ -91,6 +91,11 @@ Status SessionsCollectionConfigServer::_generateIndexesIfNeeded(OperationContext
}
Status SessionsCollectionConfigServer::setupSessionsCollection(OperationContext* opCtx) {
+ // If the sharding state is not yet initialized, fail.
+ if (!Grid::get(opCtx)->isShardingInitialized()) {
+ return {ErrorCodes::ShardingStateNotInitialized, "sharding state is not yet initialized"};
+ }
+
stdx::lock_guard<stdx::mutex> lk(_mutex);
{
// Only try to set up this collection until we have done so successfully once.