Details
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.