[SERVER-80596] Avoid useless initial iteration in ChunkMap chunks loops Created: 31/Aug/23  Updated: 29/Oct/23  Resolved: 06/Sep/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 7.1.0-rc0
Fix Version/s: 7.2.0-rc0, 7.1.0-rc2

Type: Improvement Priority: Major - P3
Reporter: Tommaso Tocci Assignee: Tommaso Tocci
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Problem/Incident
is caused by SERVER-71627 Refreshed cached collection route inf... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v7.1
Sprint: Sharding EMEA 2023-09-04, Sharding EMEA 2023-09-18
Participants:

 Description   

Here and here we use lower_bound instead of upper_bound to find the vector that contain the first chunk of the loop. The consequence is that when the start shard key is equal to the minKey of the first chunk of a vector, we will wrongly start iterating from the previous vector instead of the correct one.

This does not actually cause any correctness issue because in both cases the logic afterward will simply skip the initial wrong vector because it doesn't actually contain the initial shard Key.
In any case, this logic is wrong and should be fixed.



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

Author:

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

Message: SERVER-80596 Avoid useless initial iteration in ChunkMap chunks loops

(cherry picked from commit da03e4fb0c8b00702ca51606b54b39df504fc598)
Branch: v7.1
https://github.com/mongodb/mongo/commit/7b1be26457b77ab0f2031b3437442838898ee052

Comment by Githook User [ 06/Sep/23 ]

Author:

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

Message: SERVER-80596 Avoid useless initial iteration in ChunkMap chunks loops
Branch: master
https://github.com/mongodb/mongo/commit/da03e4fb0c8b00702ca51606b54b39df504fc598

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