[SERVER-13085] Improve error message when using createUser command with invalid write concern for config servers Created: 06/Mar/14  Updated: 11/Jul/16  Resolved: 13/Mar/14

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.6.0-rc0, 2.6.0-rc1
Fix Version/s: 2.6.0-rc2

Type: Bug Priority: Major - P3
Reporter: Christian Amor Kvalheim Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-12069 Better error message when specifying ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

use admin
db.runCommand({ createUser: 'admin3',
  customData: {},
  roles: [ 'root' ],
  digestPassword: false,
  writeConcern: { w: 2, wtimeout: 3000 },
  pwd: '105663aee552e715fc10efb6eed2c8bb' })

returns the following error

{ [MongoError: invalid batch request for config write]
  name: 'MongoError',
  ok: 0,
  errmsg: 'invalid batch request for config write',
  code: 72 }

Participants:

 Description   

Attempting to create a user using createUser command via mongos gives unexpected error.



 Comments   
Comment by Spencer Brody (Inactive) [ 13/Mar/14 ]

https://github.com/mongodb/mongo/commit/169da10f6c36eeed1655c897612f1ace16114257

Comment by Spencer Brody (Inactive) [ 10/Mar/14 ]

I think the real issue here is just that the error message is really unclear, just put together a patch to have clearer error messages: http://codereview.10gen.com/4692017258954752/

Comment by Christian Amor Kvalheim [ 10/Mar/14 ]

yes you are right but the issue is still there when

db.runCommand({ createUser: 'admin3',
  customData: {},
  roles: [ 'root' ],
  digestPassword: false,
  writeConcern: { w: 2, wtimeout: 3000 },
  pwd: '105663aee552e715fc10efb6eed2c8bb' })

the system has a single shard with 1 primary and 2 secondaries.

Comment by Spencer Brody (Inactive) [ 10/Mar/14 ]

Haha, whoops! christkv, can you try again with the 1 not quoted and confirm that it works properly?

Comment by Greg Studer [ 10/Mar/14 ]

That comment is actually incorrect - if you look above we accept w : 0 and w : 1

Actually think the problem is that '1' is "quoted"

Comment by Spencer Brody (Inactive) [ 10/Mar/14 ]

It seems like this is because we only support w:0 write concerns for config server writes: https://github.com/mongodb/mongo/blob/master/src/mongo/s/cluster_write.cpp#L340

greg_10gen Why don't we support w:1? For that matter, what's the difference between w:0 and w:1? A brief skim of https://github.com/mongodb/mongo/blob/master/src/mongo/db/repl/write_concern.cpp#L211 makes it look like the replication code treats them the same, which would make it weird that the sharding code is treating them differently...

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