summaryrefslogtreecommitdiff
path: root/src/mongo/s/chunk_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/chunk_manager.h')
-rw-r--r--src/mongo/s/chunk_manager.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/s/chunk_manager.h b/src/mongo/s/chunk_manager.h
index d3a67ff1631..6b4f97766ca 100644
--- a/src/mongo/s/chunk_manager.h
+++ b/src/mongo/s/chunk_manager.h
@@ -144,8 +144,19 @@ public:
return _collectionVersion;
}
+ /**
+ * Retrieves the shard version for the given shard. Will throw a ShardInvalidatedForTargeting
+ * exception if the shard is marked as stale.
+ */
ChunkVersion getVersion(const ShardId& shardId) const;
+ /**
+ * Retrieves the shard version for the given shard. Will not throw if the shard is marked as
+ * stale. Only use when logging the given chunk version -- if the caller must execute logic
+ * based on the returned version, use getVersion() instead.
+ */
+ ChunkVersion getVersionForLogging(const ShardId& shardId) const;
+
const ChunkInfoMap& getChunkMap() const {
return _chunkMap;
}
@@ -193,6 +204,8 @@ private:
*/
ShardVersionMap _constructShardVersionMap() const;
+ ChunkVersion _getVersion(const ShardId& shardName, bool throwOnStaleShard) const;
+
std::string _extractKeyString(const BSONObj& shardKeyValue) const;
// The shard versioning mechanism hinges on keeping track of the number of times we reload
@@ -317,6 +330,10 @@ public:
return _rt->getVersion(shardId);
}
+ ChunkVersion getVersionForLogging(const ShardId& shardId) const {
+ return _rt->getVersionForLogging(shardId);
+ }
+
ConstRangeOfChunks chunks() const {
return {ConstChunkIterator{_rt->getChunkMap().cbegin(), _clusterTime},
ConstChunkIterator{_rt->getChunkMap().cend(), _clusterTime}};