diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2017-06-28 17:13:47 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2017-07-21 08:46:59 -0400 |
commit | 43441676092ae87f4d0cc1bf81877f9610149454 (patch) | |
tree | 402b30249f6ea98141ad6970b63120c53cc26266 /src/mongo/s | |
parent | a045e38ca392f8354ea85ec5cebfb6d52892f444 (diff) | |
download | mongo-43441676092ae87f4d0cc1bf81877f9610149454.tar.gz |
SERVER-29817 Use hinted insert when building chunkRangeMap
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/chunk_manager.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp index d07dc9a66eb..1b09f52f577 100644 --- a/src/mongo/s/chunk_manager.cpp +++ b/src/mongo/s/chunk_manager.cpp @@ -380,14 +380,17 @@ ChunkManager::ChunkMapViews ChunkManager::_constructChunkMapViews(const OID& epo const BSONObj rangeMin = firstChunkInRange->getMin(); const BSONObj rangeMax = rangeLast->second->getMax(); - const auto insertResult = chunkRangeMap.insert(std::make_pair( - rangeMax, ShardAndChunkRange{{rangeMin, rangeMax}, firstChunkInRange->getShardId()})); + const auto oldSize = chunkRangeMap.size(); + const auto insertIterator = chunkRangeMap.insert( + chunkRangeMap.end(), + std::make_pair( + rangeMax, + ShardAndChunkRange{{rangeMin, rangeMax}, firstChunkInRange->getShardId()})); uassert(ErrorCodes::ConflictingOperationInProgress, str::stream() << "Metadata contains two chunks with the same max value " << rangeMax, - insertResult.second); + oldSize + 1 == chunkRangeMap.size()); - const auto& insertIterator = insertResult.first; if (insertIterator != chunkRangeMap.begin()) { // Make sure there are no gaps in the ranges |