[SERVER-74703] Primary running dropDatabase may fail to finish database drop after replicating it due to a step down Created: 08/Mar/23  Updated: 29/Oct/23  Resolved: 13/Mar/23

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

Type: Bug Priority: Major - P3
Reporter: Gregory Wlodarek Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
causes SERVER-75395 Handle write conflict retries for dro... Closed
Related
is related to SERVER-77278 Replication rollback of a dropDatabas... Closed
is related to SERVER-77281 Investigate removing use of the Datab... Backlog
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2023-03-20
Participants:
Linked BF Score: 135

 Description   

_finishDropDatabase() replicates the dropDatabase oplog entry before clearing the collection catalog. This is not done atomically.

The problem is if we step down after writing out the dropDatabase oplog entry, the node becomes a secondary with the collection catalog still containing the database name. If the new primary creates the same database name with a different casing, the secondary will fatally assert with the following:

[js_test:database_differ_case] d20040| {"t":{"$date":"2023-03-08T17:57:17.451+00:00"},"s":"F",  "c":"ASSERT",   "id":23095,   "ctx":"OplogApplier-0","msg":"Fatal assertion","attr":{"msgid":34437,"error":"DatabaseDifferCase: db already exists with different case already have: [test] trying to create [TEST]","file":"src/mongo/db/repl/oplog_applier_impl.cpp","line":394}}



 Comments   
Comment by Githook User [ 13/Mar/23 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-74703 Replicating the dropDatabase oplog entry and clearing the collection catalog during dropDatabase is done atomically
Branch: master
https://github.com/mongodb/mongo/commit/97b0299462d39456f57bde04b96b65e385971b4e

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