[SERVER-60286] Global IS lock needed to read from CollectionCatalog in appendCollectionStorageStats Created: 28/Sep/21  Updated: 06/Oct/21  Resolved: 06/Oct/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Henrik Edin Assignee: Rui Liu
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-60460 Add invariant to check that global lo... Closed
Operating System: ALL
Sprint: QE 2021-10-18
Participants:
Linked BF Score: 145

 Description   

appendCollectionStorageStats reads from the CollectionCatalog without holding any locks:
https://github.com/mongodb/mongo/blob/78ef9784e77a2411e8aa2b582bc80033f0f36228/src/mongo/db/stats/storage_stats.cpp#L58-L59

This is not safe as there can be a writer with the global lock in exclusive mode modifying the CollectionCatalog in place. See: https://github.com/mongodb/mongo/blob/625072e57daff2a654df209b55602a2eba8054b2/src/mongo/db/catalog/collection_catalog.h#L126-L131



 Comments   
Comment by Rui Liu [ 06/Oct/21 ]

This can be closed as the need of taking the lock has been reverted. https://jira.mongodb.org/browse/SERVER-58736?focusedCommentId=4104121&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-4104121

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