[SERVER-10783] MongoDB displays databases even after dropDatabase() has completed successfully Created: 16/Sep/13  Updated: 10/Dec/14  Resolved: 19/Mar/14

Status: Closed
Project: Core Server
Component/s: Admin
Affects Version/s: 2.4.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Tito Ciuro Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mac OS X 10.8/10.9


Issue Links:
Related
related to SERVER-2080 Connecting to an authenticated server... Closed
related to SERVER-2329 Dropped database doesn't disappear du... Closed
Operating System: OS X
Steps To Reproduce:

1) Launch mongo
2) show dbs
3) use <database name>
4) db.dropDatabase()
5) Go to step #2 to #4 until you have deleted all the ones you want
6) exit mongo
7) Launch mongo

Something really interesting once the shell has opened:

TurboMonkey:~ tito$ mongo
MongoDB shell version: 2.4.4
connecting to: test
Server has startup warnings:
Sun Sep 15 22:08:29.401 [initandlisten]
Sun Sep 15 22:08:29.401 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
> show dbs
developer 0.203125GB
local 0.078125GB

List all databases again and voilĂ ! They're back!

> show dbs
13825aa067 (empty)
78002fa14d (empty)
89da4e1154 (empty)
bd24985d6a (empty)
befd1bcc5e (empty)
developer 0.203125GB
local 0.078125GB
>

Participants:

 Description   

I have several databases listed:

> show dbs
13825aa067 (empty)
78002fa14d (empty)
89da4e1154 (empty)
bd24985d6a (empty)
befd1bcc5e (empty)
developer 0.203125GB
local 0.078125GB

Except for developer and local, I remove them one by one like this:

> use befd1bcc5e
switched to db befd1bcc5e
> db.dropDatabase()

{ "dropped" : "befd1bcc5e", "ok" : 1 }

MongoDB reports something like this:

Mon Sep 16 08:14:53.085 [conn7305] dropDatabase befd1bcc5e starting
Mon Sep 16 08:14:53.089 [conn7305] removeJournalFiles
Mon Sep 16 08:14:53.089 [conn7305] dropDatabase befd1bcc5e finished

When I display all available databases, they're still reported:

> show dbs
13825aa067 (empty)
78002fa14d (empty)
89da4e1154 (empty)
bd24985d6a (empty)
befd1bcc5e (empty)
developer 0.203125GB
local 0.078125GB

These UUID-looking databases won't die.



 Comments   
Comment by Stennie Steneker (Inactive) [ 19/Mar/14 ]

Hi Tito,

Please be advised I'm now closing this issue as we have been unable to reproduce the reported problem.

If you do have any further information that would help us reproduce this issue (as per the last questions from Dan), please let us know.

Thanks,
Stephen

Comment by Daniel Pasette (Inactive) [ 09/Oct/13 ]

This could this be a side-effect of using MongoHub? Can you try without MongoHub in the reproduction? Querying an empty collection has the effect of caching the database name in the server, even if it's empty. You can see this easily by opening two shells, querying an empty collection with one and then running show dbs with the other. You'll see that the database is listed even though it's empty.

Comment by Tito Ciuro [ 01/Oct/13 ]

This is my setting:

1) I have mongo running
2) I also have MongoHub open which helps me diagnose and introspect the databases. (https://github.com/fotonauts/MongoHub-Mac)
3) My Node.js app at some point I create a db, performs some ops and then drops the database.
4) The dropped db disappears most of the time, only to re-appear later. I quit MongoHub and relaunch and the database still is there, though without collections or anything else.
5) Dropping it again makes no difference.
6) The only way to truly get rid of it is by killing mongo and relaunching it again.

Comment by Daniel Pasette (Inactive) [ 30/Sep/13 ]

Are you able to provide a precise repro?

Comment by Tito Ciuro [ 29/Sep/13 ]

Actually, I spoke too soon. I still see this with 2.4.6. I see a lot of "ghost" databases that go away the minute I restart MongoDB. Is there a way to trigger a "cleanup" of some sort?

Comment by Tito Ciuro [ 18/Sep/13 ]

Hello Dan,

I have a combination of clients: RoboMongo and MongoHub. These two clients are used to query documents and work in read-only mode. The other client is a Node.js app, which reads and writes data. Please note that the "ghost" databases are created when the unit tests execute and are supposed to be removed on tear down. The configuration is standalone, both client and server running on the same Mac (development phase.)

FWIW, upgrading to v2.4.6 has solved the issue. I worked exactly the same way and I cannot reproduce this problem.

Comment by Daniel Pasette (Inactive) [ 17/Sep/13 ]

Couple questions.

  • Do you have any clients trying to read from those databases? If any read is performed on an empty db an in-memory, "phantom" db entry will be created. It will disappear after a restart.
  • What is your configuration? Standalone or replica set?
Generated at Thu Feb 08 03:24:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.