Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4284

Don't create entries in config.databases if the dbname is invalid

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.1.0
    • Affects Version/s: 2.0.1
    • Component/s: Sharding
    • None
    • Environment:
      MacOSX, mongodb version 2.0.1
    • ALL

      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
      }

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            richard.kreuter Richard Kreuter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: