[SERVER-62759] applyOps of dropDatabase causes invariant failure Created: 19/Jan/22  Updated: 29/Oct/23  Resolved: 28/Feb/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.2.0
Fix Version/s: 6.0.0-rc0, 5.3.0-rc3

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

Issue Links:
Backports
Depends
is depended on by TOOLS-3016 Re-enable TestOplogRestoreUpdatesInde... Accepted
is depended on by TOOLS-3069 Investigate changes in SERVER-62759: ... Closed
is depended on by TOOLS-3075 Investigate changes in SERVER-62759: ... Closed
is depended on by TOOLS-3085 Investigate changes in SERVER-62759: ... Closed
Problem/Incident
Related
related to SERVER-49866 Remove TempRelease Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Backport Requested:
v5.3
Sprint: Execution Team 2022-02-21, Execution Team 2022-03-07
Participants:
Linked BF Score: 149

 Description   

Running this command on a 5.2 ReplicaSet with a nonempty database:

db.adminCommand({"applyOps":[{"op":"c","ns":"test.$cmd","o":{"dropDatabase":1}}]}) 

Results in a fatal error:

{"t":{"$date":"2022-01-19T19:14:56.503+01:00"},"s":"F",  "c":"ASSERT",   "id":23079,   "ctx":"conn33","msg":"Invariant failure","attr":{"expr":"!opCtx->lockState()->isLocked()","file":"src/mongo/db/catalog/drop_database.cpp","line":309}}
{"t":{"$date":"2022-01-19T19:14:56.503+01:00"},"s":"F",  "c":"ASSERT",   "id":23080,   "ctx":"conn33","msg":"\n\n***aborting after invariant() failure\n\n"}
{"t":{"$date":"2022-01-19T19:14:56.503+01:00"},"s":"F",  "c":"CONTROL",  "id":4757800, "ctx":"conn33","msg":"Writing fatal message","attr":{"message":"Got signal: 6 (Abort trap: 6).\n"}} 

Looks like this is due to SERVER-49866.



 Comments   
Comment by Githook User [ 04/Mar/22 ]

Author:

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

Message: SERVER-62759 Add lock release in dropDatabase for applyOps

(cherry picked from commit 8696ce442652f7a69232b35901b73684bbcf7a88)
Branch: v5.3
https://github.com/mongodb/mongo/commit/bfb0050115264b7459194ae3f566745c0917a69f

Comment by Jordi Olivares Provencio [ 04/Mar/22 ]

Requesting backport as it affects multiversion compatibility

Comment by Githook User [ 25/Feb/22 ]

Author:

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

Message: SERVER-62759 Add lock release in dropDatabase for applyOps
Branch: master
https://github.com/mongodb/mongo/commit/8696ce442652f7a69232b35901b73684bbcf7a88

Comment by Tim Fogarty [ 15/Feb/22 ]

You do have to create a collection in the database first. I tested this on 5.3.0-alpha4-70-gce43fa5 and hit the bug after creating the collection. If the database is empty it looks like it works fine.

Comment by Jordi Olivares Provencio [ 08/Feb/22 ]

Hey tim.fogarty, I'm having difficulties reproducing the conditions for this error locally. I've tested it on my environment (mongod debug build from master with clean /data folder + mongosh) and can't seem to reproduce the invariant failure.

Could you give me more details as to what steps you followed to obtain the failure? Namely if you had to create something before or some concurrent operation running.

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