diff options
author | Paolo Polato <paolo.polato@mongodb.com> | 2022-02-15 13:20:57 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-15 13:51:54 +0000 |
commit | d1b01bd5da2dee6a0252f1171777a3c1a53339c5 (patch) | |
tree | 92a3e561626509efbe663c74429d2cf6f77f97b3 | |
parent | b5d49056f67ee01108a41bf5d1b7d2532c0af500 (diff) | |
download | mongo-d1b01bd5da2dee6a0252f1171777a3c1a53339c5.tar.gz |
SERVER-63334 Fix "list iterators incompatible" error in windows debug
-rw-r--r-- | src/mongo/db/s/balancer/balancer_defragmentation_policy_impl.cpp | 16 | ||||
-rw-r--r-- | src/mongo/db/s/balancer/balancer_defragmentation_policy_impl.h | 4 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/mongo/db/s/balancer/balancer_defragmentation_policy_impl.cpp b/src/mongo/db/s/balancer/balancer_defragmentation_policy_impl.cpp index a7e0cc7908c..c6b93df26dc 100644 --- a/src/mongo/db/s/balancer/balancer_defragmentation_policy_impl.cpp +++ b/src/mongo/db/s/balancer/balancer_defragmentation_policy_impl.cpp @@ -412,7 +412,7 @@ public: return boost::none; } - _outstandingMerges.push_back(_actionableMerges.front()); + _outstandingMerges.push_back(std::move(_actionableMerges.front())); _actionableMerges.pop_front(); const auto& nextRequest = _outstandingMerges.back(); auto version = getShardVersion(opCtx, nextRequest.getDestinationShard(), _nss); @@ -575,10 +575,8 @@ public: mergedChunk->range = mergeRequest.asMergedRange(); mergedChunk->estimatedSizeBytes += chunkToDelete->estimatedSizeBytes; mergedChunk->busyInOperation = false; - // the collection... auto deletedChunkShard = chunkToDelete->shard; - _collectionChunks.erase(chunkToDelete); - //... and the lookup data structures. + // the lookup data structures... _removeIteratorFromSmallChunks(chunkToDelete, deletedChunkShard); if (mergedChunk->estimatedSizeBytes > _smallChunkSizeThresholdBytes) { _removeIteratorFromSmallChunks(mergedChunk, mergedChunk->shard); @@ -590,6 +588,8 @@ public: smallChunksInRecipient.sort(compareChunkRangeInfoIterators); } } + //... and the collection + _collectionChunks.erase(chunkToDelete); }; auto onRetriableError = [&] { @@ -679,7 +679,7 @@ private: }; using ChunkRangeInfos = std::list<ChunkRangeInfo>; - using ChunkRangeInfoIterator = std::list<ChunkRangeInfo>::iterator; + using ChunkRangeInfoIterator = ChunkRangeInfos::iterator; static bool compareChunkRangeInfoIterators(const ChunkRangeInfoIterator& lhs, const ChunkRangeInfoIterator& rhs) { @@ -1427,6 +1427,12 @@ void BalancerDefragmentationPolicyImpl::abortCollectionDefragmentation(Operation } } +bool BalancerDefragmentationPolicyImpl::isDefragmentingCollection(const UUID& uuid) { + stdx::lock_guard<Latch> lk(_stateMutex); + return _defragmentationStates.contains(uuid); +} + + BSONObj BalancerDefragmentationPolicyImpl::reportProgressOn(const UUID& uuid) { stdx::lock_guard<Latch> lk(_stateMutex); auto match = _defragmentationStates.find(uuid); diff --git a/src/mongo/db/s/balancer/balancer_defragmentation_policy_impl.h b/src/mongo/db/s/balancer/balancer_defragmentation_policy_impl.h index b9fc3409ab1..68b30cdfc29 100644 --- a/src/mongo/db/s/balancer/balancer_defragmentation_policy_impl.h +++ b/src/mongo/db/s/balancer/balancer_defragmentation_policy_impl.h @@ -76,9 +76,7 @@ public: ~BalancerDefragmentationPolicyImpl() {} - bool isDefragmentingCollection(const UUID& uuid) override { - return _defragmentationStates.contains(uuid); - } + bool isDefragmentingCollection(const UUID& uuid) override; virtual BSONObj reportProgressOn(const UUID& uuid) override; |