[SERVER-11126] addUser does not work on mongos without shards Created: 10/Oct/13  Updated: 29/Jan/18  Resolved: 09/Aug/17

Status: Closed
Project: Core Server
Component/s: Security, Sharding
Affects Version/s: 2.5.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Andreas Nilsson Assignee: Sara Golemon
Resolution: Cannot Reproduce Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-11816 In sharded system with no shards, can... Closed
Duplicate
is duplicated by SERVER-10016 Can't add a shard after first user is... Closed
Related
related to SERVER-12621 Reduce localhost exception permissions Closed
related to SERVER-10016 Can't add a shard after first user is... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

./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
		}
	]
}

Participants:

 Description   

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.



 Comments   
Comment by Sara Golemon [ 09/Aug/17 ]

Hi, thank you for being patient. I've just verified that on 3.5.11 the above issue no longer presents. Indeed the error message from 2.5.2 doesn't even exist in the code any more. If you run into this kind of problem again, please open a new ticket with detailed reproduce steps and we'll try to work out a fix a little quicker.

Time heals all wounds.

Comment by Spencer Brody (Inactive) [ 21/Nov/13 ]

Fixing this requires some major changes to the sharding code - see SERVER-11816.

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