[SERVER-81398] Make analyzeShardKey and query sampling take locks when looking up collection UUID Created: 24/Sep/23  Updated: 29/Oct/23  Resolved: 27/Sep/23

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

Type: Bug Priority: Major - P3
Reporter: Cheahuychou Mao Assignee: Cheahuychou Mao
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.1, v7.0
Sprint: Sharding NYC 2023-10-02
Participants:
Linked BF Score: 2

 Description   

The code for analyzeShardKey and query sampling currently looks up the uuid for a collection by doing lookupUUIDByNSS() (e.g. here and here) which based on the documentation doesn't require holding locks. However, as described in SERVER-81182 and BF-29025, looking up the uuid this way isn't safe against rollback and shutdown. The code should be changed to use the shard_role helper acquireCollectionMaybeLockFree like suggested by the storage execution team. 



 Comments   
Comment by Githook User [ 10/Oct/23 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'mao.cheahuychou@gmail.com', 'username': 'cheahuychou'}

Message: SERVER-81398 Make analyzeShardKey and query sampling take locks when looking up collection UUID

(cherry picked from commit ece3037193bb341eb9adbbaa84c69ddbf5ed74b4)
Branch: v7.0
https://github.com/mongodb/mongo/commit/6c4e1e8eef2a427a44822af70bfca3f541d485b0

Comment by Githook User [ 27/Sep/23 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'mao.cheahuychou@gmail.com', 'username': 'cheahuychou'}

Message: SERVER-81398 Make analyzeShardKey and query sampling take locks when looking up collection UUID
Branch: master
https://github.com/mongodb/mongo/commit/ece3037193bb341eb9adbbaa84c69ddbf5ed74b4

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