[SERVER-75635] Pre 7.0 dropDatabase implementation releases the critical section too early Created: 04/Apr/23  Updated: 29/Oct/23  Resolved: 04/Apr/23

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 7.0.0-rc0
Fix Version/s: 7.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Sergi Mateo Bellido Assignee: Sergi Mateo Bellido
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
is caused by SERVER-73391 Use recoverable critical section for ... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding EMEA 2023-04-17
Participants:
Linked BF Score: 135

 Description   

This issue was recently introduced in SERVER-73391.  Depending on the version of the coordinator we might use the Recoverable Critical Section  (7.0 or newer) or the just in-memory critical section (pre 7.0). The implementation of the latter one was refactored on SERVER-73391 and we introduced an issue in this statement: rather than directly emplacing the ScopedDatabaseCriticalSection  in the boost::optional what we are actually doing is building a temporary object and then copy construct it to perform the emplacement. Thus, when the temporary ScopedDatabaseCriticalSection is destroyed, the critical section is released. Note that the destruction of the  boost::optional will also call ~ScopedDatabaseCriticalSection, which will realize that the critical section was already released and do nothing.



 Comments   
Comment by Githook User [ 04/Apr/23 ]

Author:

{'name': 'Sergi Mateo Bellido', 'email': 'sergi.mateo-bellido@mongodb.com', 'username': 'smateo'}

Message: SERVER-75635 DropDb was releasing the critical section too soon
Branch: master
https://github.com/mongodb/mongo/commit/fca575743d1ffbc2b478b651eb387f2195f25b72

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