diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2017-06-28 16:52:56 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2017-07-12 15:25:22 -0400 |
commit | 4b9d69eb00361083ce835d42c4107a4caa52f6fc (patch) | |
tree | 4cbdb8f69dbe7b8333f6c5ddf05afe662dcae413 /src/mongo/db/s/sharding_state.cpp | |
parent | 4c15828d7bd7222fbcb5dc5b3c2060ea2c136dc7 (diff) | |
download | mongo-4b9d69eb00361083ce835d42c4107a4caa52f6fc.tar.gz |
SERVER-29817 Move construction of CollectionMetadata data structures out of ShardingState.
Diffstat (limited to 'src/mongo/db/s/sharding_state.cpp')
-rw-r--r-- | src/mongo/db/s/sharding_state.cpp | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/src/mongo/db/s/sharding_state.cpp b/src/mongo/db/s/sharding_state.cpp index 12925694b6c..91a2fc6f9eb 100644 --- a/src/mongo/db/s/sharding_state.cpp +++ b/src/mongo/db/s/sharding_state.cpp @@ -490,21 +490,7 @@ ChunkVersion ShardingState::_refreshMetadata(OperationContext* opCtx, const Name return nullptr; } - RangeMap shardChunksMap = - SimpleBSONObjComparator::kInstance.makeBSONObjIndexedMap<CachedChunkInfo>(); - - for (const auto& chunk : cm->chunks()) { - if (chunk->getShardId() != shardId) - continue; - - shardChunksMap.emplace(chunk->getMin(), - CachedChunkInfo(chunk->getMax(), chunk->getLastmod())); - } - - return stdx::make_unique<CollectionMetadata>(cm->getShardKeyPattern().toBSON(), - cm->getVersion(), - cm->getVersion(shardId), - std::move(shardChunksMap)); + return stdx::make_unique<CollectionMetadata>(cm, shardId); }(); // Exclusive collection lock needed since we're now changing the metadata |