[SERVER-77730] Avoid data race when calculating getApproximateSize of DocumentStorage::kEmptyDoc Created: 02/Jun/23  Updated: 29/Oct/23  Resolved: 14/Jun/23

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

Type: Task Priority: Major - P3
Reporter: Ivan Fefer Assignee: Ivan Fefer
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-78013 Clean-up the use of empty DocumentSto... Backlog
Backwards Compatibility: Fully Compatible
Sprint: QE 2023-06-12, QE 2023-06-26
Participants:
Linked BF Score: 135

 Description   

As kEmptyDoc is a global constant, several thread can end up calling getApproximateSize() on it causing a mostly harmless, but data race, that is triggering thread sanitizers.

Ideally, we can initialize it once during creating to avoid it



 Comments   
Comment by Githook User [ 13/Jun/23 ]

Author:

{'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}

Message: SERVER-77730 For kEmptyDoc init snapshottedApproximateSize on construction
Branch: master
https://github.com/mongodb/mongo/commit/ac1c310798371c6e42175aaaab1f29c9379b0cbf

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