diff options
author | Robert Guo <robert.guo@10gen.com> | 2015-11-17 11:53:12 -0500 |
---|---|---|
committer | Robert Guo <robert.guo@10gen.com> | 2015-11-18 10:30:13 -0500 |
commit | d284e9eee88b97e42ca78ad46d0c7b52fe7c41b5 (patch) | |
tree | 2f2f33638515b2867bc4530687b57ac4e7f14299 /src | |
parent | 02125134302a6d07729eb60095af2bd85f729dfa (diff) | |
download | mongo-d284e9eee88b97e42ca78ad46d0c7b52fe7c41b5.tar.gz |
SERVER-21479 Check if listIndexes can find valid shards
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/s/commands/commands_public.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp index 6215e4f1e4e..c5e7f38b67c 100644 --- a/src/mongo/s/commands/commands_public.cpp +++ b/src/mongo/s/commands/commands_public.cpp @@ -86,6 +86,10 @@ bool cursorCommandPassthrough(OperationContext* txn, int options, BSONObjBuilder* out) { const auto shard = grid.shardRegistry()->getShard(txn, conf->getPrimaryId()); + if (!shard) { + return Command::appendCommandStatus( + *out, {ErrorCodes::ShardNotFound, "failed to find a valid shard"}); + } ScopedDbConnection conn(shard->getConnString()); auto cursor = conn->query(str::stream() << conf->name() << ".$cmd", cmdObj, |