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

addUser does not work on mongos without shards

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.5.2
    • Component/s: Security, Sharding
    • None
    • Fully Compatible
    • ALL
    • Hide
      ./mongo --ssl --sslPEMKeyFile jstests/libs/client.pem                                                                                                     
      MongoDB shell version: 2.5.3-pre-
      connecting to: test
      mongos> use test
      switched to db test
      mongos> db.addUser({user: "admin", pwd:"pwd",roles:[
      ...            {'name': 'userAdminAnyDatabase', 'db': 'admin', 'hasRole': true, 'canDelegate': true}]});
      2013-10-10T14:59:29.104-0400 error: {
      	"$err" : "error creating initial database config information :: caused by :: can't find a shard to put new db on",
      	"code" : 10185
      } at src/mongo/shell/query.js:131
      mongos> use admin
      switched to db admin
      mongos> db.addUser({user: "admin", pwd:"pwd",roles:[
      ...            {'name': 'userAdminAnyDatabase', 'db': 'admin', 'hasRole': true, 'canDelegate': true}]});
      {
      	"user" : "admin",
      	"roles" : [
      		{
      			"name" : "userAdminAnyDatabase",
      			"db" : "admin",
      			"hasRole" : true,
      			"canDelegate" : true
      		}
      	]
      }
      
      Show
      ./mongo --ssl --sslPEMKeyFile jstests/libs/client.pem MongoDB shell version: 2.5.3-pre- connecting to: test mongos> use test switched to db test mongos> db.addUser({user: "admin" , pwd: "pwd" ,roles:[ ... { 'name' : 'userAdminAnyDatabase' , 'db' : 'admin' , 'hasRole' : true , 'canDelegate' : true }]}); 2013-10-10T14:59:29.104-0400 error: { "$err" : "error creating initial database config information :: caused by :: can't find a shard to put new db on" , "code" : 10185 } at src/mongo/shell/query.js:131 mongos> use admin switched to db admin mongos> db.addUser({user: "admin" , pwd: "pwd" ,roles:[ ... { 'name' : 'userAdminAnyDatabase' , 'db' : 'admin' , 'hasRole' : true , 'canDelegate' : true }]}); { "user" : "admin" , "roles" : [ { "name" : "userAdminAnyDatabase" , "db" : "admin" , "hasRole" : true , "canDelegate" : true } ] }

      Running addUser for any other DB then admin on a mongos without any shards fails with error:

      "error creating initial database config information :: caused by :: can't find a shard to put new db on"

      This is not expected behavior in 2.5.x since all DBs will reside on mongos. There is probably some old error check still in place even though the behavior is expected.

            Assignee:
            sara.golemon@mongodb.com Sara Golemon
            Reporter:
            andreas.nilsson Andreas Nilsson
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: