[SERVER-80703] Avoid traversing routing table in MigrationDestinationManager Created: 04/Sep/23  Updated: 29/Oct/23  Resolved: 06/Sep/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.2.24, 4.4.24, 5.0.20, 6.0.9
Fix Version/s: 4.4.25, 5.0.22, 6.0.11

Type: Bug Priority: Major - P3
Reporter: Tommaso Tocci Assignee: Tommaso Tocci
Resolution: Fixed Votes: 0
Labels: balancer-round-perf
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Problem/Incident
is caused by SERVER-44914 A shard receiving its first chunk sho... Closed
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0, v4.4, v4.2
Sprint: Sharding EMEA 2023-09-18
Participants:

 Description   

In the migration destination manager, in order to understand if the destination shard already have some chunk, we call CollectionMetadata::getChunks().empty(). This function scans the entire routing table and make a partial copy of it that contains only chunks belonging to the destination shard.

When the routing table for the collection has many chunks, this calls can be extremely expensive.

To avoid this overhead, we could simply use CollectionMetadata::currentShardHasAnyChunks() instead.



 Comments   
Comment by Githook User [ 06/Sep/23 ]

Author:

{'name': 'Tommaso Tocci', 'email': 'tommaso.tocci@mongodb.com', 'username': 'toto-dev'}

Message: SERVER-80703 Avoid traversing routing table in MigrationDestinationManager

(cherry picked from commit c1aaaa719d7a96cf21ba3f22f395a444558e10df)
Branch: v4.4
https://github.com/mongodb/mongo/commit/35be3826cdd7c5c24772b6374c6af0a4a145a7d4

Comment by Githook User [ 06/Sep/23 ]

Author:

{'name': 'Tommaso Tocci', 'email': 'tommaso.tocci@mongodb.com', 'username': 'toto-dev'}

Message: SERVER-80703 Avoid traversing routing table in MigrationDestinationManager

(cherry picked from commit c1aaaa719d7a96cf21ba3f22f395a444558e10df)
Branch: v5.0
https://github.com/mongodb/mongo/commit/f3fd24e6cc6b8c39fbf77fe3ef10d4b2f167f047

Comment by Githook User [ 06/Sep/23 ]

Author:

{'name': 'Tommaso Tocci', 'email': 'tommaso.tocci@mongodb.com', 'username': 'toto-dev'}

Message: SERVER-80703 Avoid traversing routing table in MigrationDestinationManager
Branch: v6.0
https://github.com/mongodb/mongo/commit/df53d277910175336dda5f27f95a0d8f31948997

Comment by Tommaso Tocci [ 04/Sep/23 ]

In versions 7.0+ this have been already fixed by SERVER-76779

Generated at Thu Feb 08 06:44:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.