[SERVER-72478] Construct uuidGen on first use to avoid static init order fiasco Created: 03/Jan/23 Updated: 29/Oct/23 Resolved: 04/Jan/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.3.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Daniel Gomez Ferro | Assignee: | Daniel Gomez Ferro |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Execution Team 2023-01-09 |
| Participants: |
| Description |
|
uuidGen is a static object in uuid.cpp . When working on a test I created a static DatabaseVersion with DatabaseVersion::makeFixed() that internally depends on uuidGen. This worked on some build variants but failed in others, this problem is called the static initialization order fiasco. We can use the construct on first use idiom to avoid this problem. |
| Comments |
| Comment by Githook User [ 04/Jan/23 ] |
|
Author: {'name': 'Daniel Gómez Ferro', 'email': 'daniel.gomezferro@mongodb.com', 'username': 'dgomezferro'}Message: |