[SERVER-3451] It might still be possible to create two DBs whose names differ only by case Created: 20/Jul/11  Updated: 30/Mar/12  Resolved: 23/Aug/11

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: 1.9.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Paul Harvey Assignee: Aaron Staple
Resolution: Cannot Reproduce Votes: 1
Labels: perl
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 10.04.2 LTS on amd64. Single mongod, no replication, no sharding.

noprealloc = true
smallfiles = true
directoryperdb = true

mongod --version
db version v1.9.0, pdfile version 4.5
Wed Jul 20 10:51:51 git version: 434d8b47e569578d932e3caedd3bb16e8c0836a3


Attachments: Text File mongoload_crash.txt    
Operating System: ALL
Participants:

 Description   

In production, our site developed a problem where we couldn't write any updates. The perl MongoDB driver merely returned: "db assertion failed". That's it. No errors logged in mongodb's log.

That's my biggest complaint. I had taken mongod down, run a repair, restarted the app, restarted mongod, and it was still unable to take updates. I had no idea what was going on.

The only reason I was able to figure out the illegal duplicate database (as a different capitalisation) was because I trashed our 14GB (in mongo) of data and re-imported the whole site again from scratch. This time, I got a hint:

query error: db already exists with different case other: [foswiki__Marine__AusLarv] me [foswiki__Marine__Auslarv] at /usr/local
/lib/perl/5.10.1/MongoDB/Collection.pm line 246.
at /usr/local/lib/perl/5.10.1/MongoDB/Collection.pm line 246

Attached a full backtrace, although it probably isn't very useful.

Now, the timing of this coincides exactly with a user who tried to rename their 'area' (= mongod database). So what's happened is that the 'rename' code (really just a copy/delete, I suspect) in our perl app was somehow allowed to create a new database of the same name/different case, and afterward we are unable to write any updates at all to any database served by that mongod at all.



 Comments   
Comment by Paul Harvey [ 23/Aug/11 ]

I guess there may have been some other error to cause mongo to fail to take any updates. I didn't think to look for this error until after I'd trashed the DB and discovered the problem when re-populating mongo.

I just tried (and failed) to reproduce with db version v1.9.2, pdfile version 4.5 git version: 94ce2d93733dcbc515a1325d759b8312962279db using the code we had in production at the time.

So I guess we can close this.

Comment by Aaron Staple [ 22/Aug/11 ]

It's not clear from the description that two databases differing in name only by casing existed at the same time, which is what we're supposed to prevent. You say you re imported the data and saw a casing error while doing this. Is it possible the user created or renamed their database at the same time as this, causing an error on your side but not causing duplicate databases to exist simultaneously?

Comment by Paul Harvey [ 18/Aug/11 ]

Foswiki's MongoDBPlugin now uses an md5 hash of the web name, as the mongodb database name.

Not sure how to progress this item any further from my end.

Comment by Paul Harvey [ 20/Jul/11 ]

This also exposes a bug in --repair mode of mongod.

I ran --repair before blowing away the data, and it failed to inform me that I had illegal/duplicate database names.

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