[SERVER-63833] Refactor CollectionBulkLoaderImpl to not hold locks as members Created: 18/Feb/22  Updated: 29/Oct/23  Resolved: 30/Sep/22

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

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

Issue Links:
Related
is related to SERVER-70208 Revert SERVER-63833 Closed
is related to SERVER-57432 Prevent MODE_X and MODE_S locks from ... Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2022-10-03
Participants:

 Description   

As part of SERVER-57432 we discovered that the class itself is using the locks in an unconventional fashion that can lead to confusion by thinking it holds a lock in MODE_IX while actually having a MODE_X lock. What's more, the underlying code requires the lock to be MODE_X.

The confusion stems from the fact it treats locks as movable entities when they are meant to only be used within scopes, releasing themselves when they leave it. The class instead obtains a lock during construction and releases it only when it goes out of scope, even though it gets called during different times for the various stages.

As a result we should cleanup the method so that it acquires the lock in each method instead of assuming a lock during the entire lifetime of the object.



 Comments   
Comment by Githook User [ 30/Sep/22 ]

Author:

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

Message: SERVER-63833 Refactor CollectionBulkLoaderImpl locks
Branch: master
https://github.com/mongodb/mongo/commit/926591a3d5657eb271b275e6fd49db663b325227

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