[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: |
|
||||||||||||||||
| 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: (cherry picked from commit c1aaaa719d7a96cf21ba3f22f395a444558e10df) |
| Comment by Githook User [ 06/Sep/23 ] |
|
Author: {'name': 'Tommaso Tocci', 'email': 'tommaso.tocci@mongodb.com', 'username': 'toto-dev'}Message: (cherry picked from commit c1aaaa719d7a96cf21ba3f22f395a444558e10df) |
| Comment by Githook User [ 06/Sep/23 ] |
|
Author: {'name': 'Tommaso Tocci', 'email': 'tommaso.tocci@mongodb.com', 'username': 'toto-dev'}Message: |
| Comment by Tommaso Tocci [ 04/Sep/23 ] |
|
In versions 7.0+ this have been already fixed by |