summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-05-14 12:01:30 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-05-14 12:04:47 -0400
commitfc8815a8a7f7c57fea53f9684b47be2e9e039cf4 (patch)
tree7c54e9ed7e84663a34df960b48d4e7a208f3da57
parent825567624244ab595ef9468ca50473e489363a6a (diff)
downloadmongo-fc8815a8a7f7c57fea53f9684b47be2e9e039cf4.tar.gz
SERVER-18049 getShardMap command on MongoD should check if shard registry is initialized
-rw-r--r--src/mongo/s/client/shard.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/s/client/shard.cpp b/src/mongo/s/client/shard.cpp
index 0a5be63b855..1daf5c27a34 100644
--- a/src/mongo/s/client/shard.cpp
+++ b/src/mongo/s/client/shard.cpp
@@ -81,7 +81,13 @@ namespace {
std::string& errmsg ,
mongo::BSONObjBuilder& result) {
- grid.shardRegistry()->toBSON(&result);
+ // MongoD instances do not know that they are part of a sharded cluster until they
+ // receive a setShardVersion command and that's when the catalog manager and the shard
+ // registry get initialized.
+ if (grid.shardRegistry()) {
+ grid.shardRegistry()->toBSON(&result);
+ }
+
return true;
}