[SERVER-85975] Clear database state when dropping last collection Created: 30/Jan/24  Updated: 06/Feb/24

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Felipe Gasper Assignee: Henrik Edin
Resolution: Unresolved Votes: 0
Labels: time-series-mongosync
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-43925 Proactively close newly empty databases Backlog
is related to SERVER-76342 Drop system.views when the last view ... Backlog
Assigned Teams:
Storage Execution
Sprint: Execution Team 2024-02-19
Participants:

 Description   

> db.getSiblingDB('mydb').createCollection('foo')
> db.getSiblingDB('mydb').foo.drop()
> db.getSiblingDB('Mydb').createCollection('foo')
MongoServerError: db already exists with different case already have: [mydb] trying to create [Mydb]

^^ The above happens even in replica sets (i.e., unsharded clusters). Happens in the last 4.2 version as well as 7.0.5.

Per matt.kneiser@mongodb.com, it looks like the reason is:

It looks like the DatabaseHolderImpl/DBsIndex, requires an explicit dropDb() call to unregister the namespace. Otherwise, we keep state around in memory that a database with "mydb" exists.

(Slack thread)

Ideas:

  • The last collection drop should probably clear out the DB state.
  • Should that mean we get an oplog dropDatabase entry (and change event), too?

Additional context: Mongosync can’t do `dropDatabase` commands—even in response to events of that name—because there’s no UUID.


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