[SERVER-73210] Fix concurrency bug in OplogStones Created: 23/Jan/23  Updated: 29/Oct/23  Resolved: 27/Jan/23

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

Type: Bug Priority: Major - P3
Reporter: Jordi Olivares Provencio Assignee: Jordi Olivares Provencio
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File diff.patch    
Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2023-02-06
Participants:

 Description   

If a truncate of the oplog occurs (
WiredTigerRecordStore::OplogStones::clearStonesOnCommit), it first: * Sets the number of current records and bytes for the new OplogStone to 0

  • Acquires the modification mutex
  • Clears the stones list

Modifying the first two variable outside of the lock could potentially lead to an invalid state since other OplogStones modifications first take the mutex then perform the other modifications.

We should protect the first two variables under the mutex to avoid potential invalid states. The attached patch fixes this.



 Comments   
Comment by Githook User [ 27/Jan/23 ]

Author:

{'name': 'Jordi Olivares Provencio', 'email': 'jordi.olivares-provencio@mongodb.com', 'username': 'jordiolivares'}

Message: SERVER-73210 Modify OplogStones atomics under the lock when clearing
Branch: master
https://github.com/mongodb/mongo/commit/183324bafa4753b04cd860b6f7110b8d604e87bb

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