[SERVER-4284] Don't create entries in config.databases if the dbname is invalid Created: 15/Nov/11  Updated: 11/Jul/16  Resolved: 16/Nov/11

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.0.1
Fix Version/s: 2.1.0

Type: Bug Priority: Minor - P4
Reporter: Richard Kreuter (Inactive) Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MacOSX, mongodb version 2.0.1


Operating System: ALL
Participants:

 Description   

It looks as if the mongos can create databases with invalid names, leading to subsequent problems draining the shard with the invalid db name (see https://groups.google.com/group/mongodb-user/browse_thread/thread/7186e51d5a31bcd2?pli=1).

Here's a reproduction case for creating an entry in config.databases with an invalid name:

mongos> config=db.getSiblingDB("config")
config
mongos> config.databases.find()

{ "_id" : "admin", "partitioned" : false, "primary" : "config" } { "_id" : "test", "partitioned" : false, "primary" : "repl0" }

mongos> foo=db.getSiblingDB("foo ");
foo
mongos> foo.c.insert(

{ _id : 1 }

);
invalid db name: foo .c
mongos> config.databases.find()

{ "_id" : "admin", "partitioned" : false, "primary" : "config" } { "_id" : "test", "partitioned" : false, "primary" : "repl0" } { "_id" : "foo ", "partitioned" : false, "primary" : "repl1" }

mongos> db.adminCommand(

{ listDatabases : 1 }

);
{
"databases" : [
{
"name" : "test",
"sizeOnDisk" : 218103808,
"empty" : false,
"shards" :

{ "repl0" : 218103808 }

},

{ "name" : "config", "empty" : false, "sizeOnDisk" : 201326592 }

],
"totalSize" : 218103808,
"totalSizeMb" : 208,
"ok" : 1
}



 Comments   
Comment by auto [ 16/Nov/11 ]

Author:

{u'login': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: Don't create entries in config.databases if the dbname is invalid SERVER-4284
Branch: master
https://github.com/mongodb/mongo/commit/c7af76fe5f01e08d86d34ed2cb2f90677f044a6e

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