[SERVER-72703] Downgrade $out's db lock to MODE_IX Created: 10/Jan/23  Updated: 19/Jan/24  Resolved: 18/Dec/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.2.1, 7.3.0-rc0, 7.0.6

Type: Bug Priority: Major - P3
Reporter: Charlie Swanson Assignee: Damian Wasilewicz
Resolution: Fixed Votes: 0
Labels: storex-ranked
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
is depended on by SERVER-73040 Ban all lock upgrades Closed
Problem/Incident
Related
is related to SERVER-81286 Investigate usages of exclusive locks... Backlog
Assigned Teams:
Storage Execution NAMER
Backwards Compatibility: Fully Compatible
Backport Requested:
v7.2, v7.0, v6.0, v5.0, v4.4
Sprint: Execution Team 2023-05-29, Execution Team 2023-06-12, Execution NAMR Team 2023-06-26, Execution NAMR Team 2023-07-10, Execution NAMR Team 2023-07-24, Execution NAMR Team 2023-08-07, Execution NAMR Team 2023-10-02, Execution Team 2023-12-11, Execution Team 2023-12-25
Participants:
Case:
Linked BF Score: 135

 Description   

It looks like as of 4.2 the renameCollection command supports doing a rename - even with dropTarget: true - with only a MODE_IX lock, not MODE_X as is currently taken. At the very least, that lock acquisition could use a comment indicating why MODE_X is required.

I think if we change the DB lock to MODE_X, we'll need to acquire both collection locks in MODE_X (and in the right order) to inspect and verify the index catalog and collection options, but that should be fine and is an improvement.



 Comments   
Comment by Githook User [ 12/Jan/24 ]

Author:

{'name': 'Damian Wasilewicz', 'email': '33820523+DamianWasilewicz@users.noreply.github.com', 'username': 'DamianWasilewicz'}

Message: SERVER-72703 Downgrade out's db lock to IX (#18009)

SERVER-72703 Downgrade out's db lock to IX

(cherry picked from commit d31885ce2c61a2acf2d19e8ab30c00f3c4308f0e)

GitOrigin-RevId: 352ae2d9d70cdf474078ac8d6cf39ca2fb3c0f8b
Branch: v7.0
https://github.com/mongodb/mongo/commit/fd57bf47efcc45ab7ad450bc3a8be0509ac3042d

Comment by Githook User [ 02/Jan/24 ]

Author:

{'name': 'Damian Wasilewicz', 'email': 'damian.wasilewicz@mongodb.com', 'username': 'DamianWasilewicz'}

Message: SERVER-72703 Downgrade out's db lock to IX
Branch: v7.2
https://github.com/mongodb/mongo/commit/d31885ce2c61a2acf2d19e8ab30c00f3c4308f0e

Comment by Githook User [ 18/Dec/23 ]

Author:

{'name': 'Damian Wasilewicz', 'email': 'damian.wasilewicz@mongodb.com', 'username': 'DamianWasilewicz'}

Message: SERVER-72703 Downgrade out's DB lock

GitOrigin-RevId: add971aec3dc798a608985f39681dbf8af62ceb9
Branch: master
https://github.com/mongodb/mongo/commit/bb6eea51253c2e1762f876eefec2b9c2b81452cf

Comment by Steven Vannelli [ 05/Oct/23 ]

We need to make sure we only access the collection under a collection lock

Comment by Damian Wasilewicz [ 05/Oct/23 ]

This change was reverted because it caused BF-30104 , where not using an exclusive lock led to heap-use-after-free/invalid access error. It appears that changing the mode from X to IX exposed a bug on the query side.

Comment by Githook User [ 02/Oct/23 ]

Author:

{'name': 'Damian Wasilewicz', 'email': 'damian.wasilewicz@mongodb.com', 'username': 'DamianWasilewicz'}

Message: Revert "SERVER-72703 Downgrade $out's db lock to MODE_IX"
Branch: master
https://github.com/mongodb/mongo/commit/2e66042fd5536004025fdf59e39eb69e0994779e

Comment by Damian Wasilewicz [ 20/Sep/23 ]

Filed a follow up ticket to investigate these cases!

Comment by Githook User [ 20/Sep/23 ]

Author:

{'name': 'Damian Wasilewicz', 'email': 'damian.wasilewicz@mongodb.com', 'username': 'DamianWasilewicz'}

Message: SERVER-72703 Downgrade $out's db lock to MODE_IX
Branch: master
https://github.com/mongodb/mongo/commit/a8fecc65d3117d9f666c73de6c3c03c219608032

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