[SERVER-71367] Make getDocumentKey get the shardKeyPattern from collectionPtr instead of asking the CSS every time Created: 15/Nov/22  Updated: 29/Oct/23  Resolved: 22/Nov/22

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Task Priority: Major - P3
Reporter: Jordi Serra Torrens Assignee: Jordi Serra Torrens
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-77473 remove unused OperationContext parame... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding EMEA 2022-11-28
Participants:
Linked BF Score: 132

 Description   

SERVER-69435 made obtaining the CollectionShardingState more costly, as it now needs to lock a mutex. This introduced a performance regression on some write paths – particularly the insert path. This is because getDocumentKey is called for every document in the batch, and every time getDocumentKey will obtain the CollectionShardingState.
It is unnecessary to get the CSS for every document in the batch. Instead, it can be obtained only once for the operation and use it for every document in the batch.



 Comments   
Comment by Githook User [ 22/Nov/22 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-71367 Make getDocumentKey get the shardKeyPattern from collectionPtr instead of asking the CSS every time
Branch: master
https://github.com/mongodb/mongo/commit/1f85ed64c763b05d8477a386a1a36fc1520da9b2

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