diff options
author | Blake Oler <blake.oler@mongodb.com> | 2020-01-21 16:49:51 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2020-01-21 16:49:51 +0000 |
commit | ed78b6d54e794bddc99b9b9bc01c62cce22c9b56 (patch) | |
tree | 36ac6d4644a38968977c0526b64b6c5c70924661 /src | |
parent | 3d6953c361213c5bfab23e51ab274ce592edafe6 (diff) | |
download | mongo-ed78b6d54e794bddc99b9b9bc01c62cce22c9b56.tar.gz |
SERVER-43195 Add namespace to ChunkManager ShardKeyNotFound errors in order to better diagnose failures
(cherry picked from commit 20761c26375cd0febaade9d93af5b8848845bef9)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/s/chunk_manager.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp index 003100aee1e..a1989ade52b 100644 --- a/src/mongo/s/chunk_manager.cpp +++ b/src/mongo/s/chunk_manager.cpp @@ -86,14 +86,18 @@ std::shared_ptr<Chunk> ChunkManager::findIntersectingChunk(const BSONObj& shardK for (BSONElement elt : shardKey) { uassert(ErrorCodes::ShardKeyNotFound, str::stream() << "Cannot target single shard due to collation of key " - << elt.fieldNameStringData(), + << elt.fieldNameStringData() + << " for namespace " + << getns(), !CollationIndexKey::isCollatableType(elt.type())); } } const auto it = _chunkMap.upper_bound(shardKey); uassert(ErrorCodes::ShardKeyNotFound, - str::stream() << "Cannot target single shard using key " << shardKey, + str::stream() << "Cannot target single shard using key " << shardKey + << " for namespace " + << getns(), it != _chunkMap.end() && it->second->containsKey(shardKey)); return it->second; |