summaryrefslogtreecommitdiff
path: root/src/mongo/s/chunk_manager.h
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-02-24 13:15:07 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-03-01 16:04:31 -0500
commit3b0cfc71832f8bed99f27efba2e07a4258c24f29 (patch)
tree919dff67385217d5c35fcd3e63932637e795939d /src/mongo/s/chunk_manager.h
parentd50fe6a7b43302a9f8afd6b40702ce287caf0d86 (diff)
downloadmongo-3b0cfc71832f8bed99f27efba2e07a4258c24f29.tar.gz
SERVER-28106 Cleanup the contract of ChunkManager::findIntersectingChunk
(cherry picked from commit 21c2b106d16d69590d46b02cf252bae8ed055b3d)
Diffstat (limited to 'src/mongo/s/chunk_manager.h')
-rw-r--r--src/mongo/s/chunk_manager.h25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/mongo/s/chunk_manager.h b/src/mongo/s/chunk_manager.h
index f184c60ee5a..08d1d9fe229 100644
--- a/src/mongo/s/chunk_manager.h
+++ b/src/mongo/s/chunk_manager.h
@@ -110,27 +110,24 @@ public:
//
/**
- * Given a key that has been extracted from a document, returns the
- * chunk that contains that key.
+ * Given a shard key (or a prefix) that has been extracted from a document, returns the chunk
+ * that contains that key.
*
- * For instance, to locate the chunk for document {a : "foo" , b : "bar"}
- * when the shard key is {a : "hashed"}, you can call
- * findIntersectingChunk() on {a : hash("foo") }
+ * Example: findIntersectingChunk({a : hash('foo')}) locates the chunk for document
+ * {a: 'foo', b: 'bar'} if the shard key is {a : 'hashed'}.
*
* If 'collation' is empty, we use the collection default collation for targeting.
*
- * Returns the error status ShardKeyNotFound if unable to target a single shard due to the
- * collation.
+ * Throws a DBException with the ShardKeyNotFound code if unable to target a single shard due to
+ * collation or due to the key not matching the shard key pattern.
*/
- StatusWith<std::shared_ptr<Chunk>> findIntersectingChunk(OperationContext* txn,
- const BSONObj& shardKey,
- const BSONObj& collation) const;
+ std::shared_ptr<Chunk> findIntersectingChunk(const BSONObj& shardKey,
+ const BSONObj& collation) const;
/**
- * Finds the intersecting chunk, assuming the simple collation.
+ * Same as findIntersectingChunk, but assumes the simple collation.
*/
- std::shared_ptr<Chunk> findIntersectingChunkWithSimpleCollation(OperationContext* txn,
- const BSONObj& shardKey) const;
+ std::shared_ptr<Chunk> findIntersectingChunkWithSimpleCollation(const BSONObj& shardKey) const;
/**
* Finds the shard IDs for a given filter and collation. If collation is empty, we use the
@@ -257,8 +254,6 @@ private:
// constructed map must cover the complete space from [MinKey, MaxKey).
ChunkRangeMap _chunkRangeMap;
- std::set<ShardId> _shardIds;
-
// Max known version per shard
ShardVersionMap _shardVersions;