[SERVER-41947] Disallow using the "system.views" collection name as the source or target names in the rename command Created: 27/Jun/19  Updated: 29/Oct/23  Resolved: 28/Aug/19

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 4.2.1, 4.3.1

Type: Bug Priority: Major - P3
Reporter: Gregory Wlodarek Assignee: Xiangyu Yao (Inactive)
Resolution: Fixed Votes: 0
Labels: KS, execution_intern_2019
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Documented
is documented by DOCS-12990 Investigate changes in SERVER-41947: ... Closed
Problem/Incident
Related
related to SERVER-64491 Reconsider allowing the system.js col... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Backport Requested:
v4.2
Sprint: Execution Team 2019-08-26, Execution Team 2019-09-09
Participants:
Linked BF Score: 5

 Description   

This is a bug fix for a build failure where the following scenario leads to a deadlock:

T1: Rename command is renaming 'test.coll' to 'test.system.views', so it has the MODE_IX on 'test' and MODE_X on both 'coll' and 'system.views'. The next step is to check if 'coll' is a view by calling the ViewCatalog::lookup() and waiting to acquire the ViewCatalog mutex which is currently held by T2.

T2: Running CountCmd on a collection that didn't exist, but in AutoGetCollection we check if it could be a view and call ViewCatalog::lookup(), here we see that the ViewCatalog is invalidated, so we call _reloadIfNeeded. Now _reloadIfNeeded() uses the DurableViewCatalog::iterate but that requires the MODE_IS lock on the 'test.system.views' collection which is currently held by T1.

So we have a deadlock where:
T1 has MODE_X on 'test.system.views' but is waiting for ViewCatalog mutex.
T2 has ViewCatalog mutex during reload and needs MODE_IS on 'test.system.views'.



 Comments   
Comment by Githook User [ 29/Aug/19 ]

Author:

{'name': 'Xiangyu Yao', 'username': 'xy24', 'email': 'xiangyu.yao@mongodb.com'}

Message: SERVER-41947 Disallow using the system.views collection name as the source or target names in the rename command

(cherry picked from commit 18f95f8ad46c685d8529dba2d5655b3e4ef968c1)
Branch: v4.2
https://github.com/mongodb/mongo/commit/1ea3fcc30ca036028b9f7527252bb55911c97f54

Comment by Githook User [ 28/Aug/19 ]

Author:

{'email': 'xiangyu.yao@mongodb.com', 'name': 'Xiangyu Yao', 'username': 'xy24'}

Message: SERVER-41947 Disallow using the system.views collection name as the source or target names in the rename command
Branch: master
https://github.com/mongodb/mongo/commit/18f95f8ad46c685d8529dba2d5655b3e4ef968c1

Comment by Githook User [ 19/Aug/19 ]

Author:

{'username': 'xy24', 'email': 'xiangyu.yao@mongodb.com', 'name': 'Xiangyu Yao'}

Message: Revert "SERVER-41947 Disallow using the system.views collection name as the source or target names in the rename command"

This reverts commit ab5e8175f64c33606861c8b659e3708944177871.
Branch: master
https://github.com/mongodb/mongo/commit/3fe21bd5cbc750b6123ab89374cffd77db03c4d6

Comment by Githook User [ 19/Aug/19 ]

Author:

{'name': 'Xiangyu Yao', 'email': 'xiangyu.yao@mongodb.com', 'username': 'xy24'}

Message: SERVER-41947 Disallow using the system.views collection name as the source or target names in the rename command
Branch: master
https://github.com/mongodb/mongo/commit/ab5e8175f64c33606861c8b659e3708944177871

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