[SERVER-33317] 3.7 sharded clusters ignore create command write concern Created: 14/Feb/18  Updated: 27/Oct/23  Resolved: 16/Apr/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.7.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Bernie Hackett Assignee: Randolph Tan
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by PYTHON-1470 Fix test_collection.TestCollection.te... Closed
Related
related to DOCS-11585 Mongos uses majority writeconcern for... Closed
is related to SERVER-33332 mongos create command should preserve... Closed
is related to SERVER-34776 dropDatabase should respect user prov... Closed
Operating System: ALL
Participants:

 Description   

Sending the create command with a nonsensical write concern to a 3.7 replica set with three members results in a write concern error:

>>> c = pymongo.MongoClient()
>>> c.foo.command('create', 'bar', writeConcern={'w': 1000})
{'ok': 1.0, 'operationTime': Timestamp(1518570804, 1), 'writeConcernError': {'codeName': 'CannotSatisfyWriteConcern', 'errmsg': 'Not enough data-bearing nodes', 'code': 100}, '$clusterTime': {'signature': {'keyId': 0, 'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}, 'clusterTime': Timestamp(1518570804, 1)}}
>>> c.admin.command('buildInfo')['version']
'3.7.1-370-gfab8bda846'

Sending the same command to a mongos in front of a single three member shard does not cause a write concern error:

>>> c = pymongo.MongoClient()
>>> c.foo.command('create', 'bar', writeConcern={'w': 1000})
{'ok': 1.0, '$clusterTime': {'signature': {'keyId': 0, 'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}, 'clusterTime': Timestamp(1518571939, 3)}, 'operationTime': Timestamp(1518571939, 2)}
>>> c.admin.command('buildInfo')['version']
'3.7.1-370-gfab8bda846'



 Comments   
Comment by Kaloian Manassiev [ 16/Apr/18 ]

Per renctan's comment I am closing this ticket as WAD pending documentation that now all sharding metadata commands must be run with majority write concern.

Comment by Bernie Hackett [ 14/Feb/18 ]

Thanks. What SERVER ticket was that change made for? It tried digging through git log before opening this ticket but didn't find anything.

Comment by Randolph Tan [ 14/Feb/18 ]

Mongos now converts writeConcern of all metadata operations (create/drop/dropDatabase, etc.) to w: majority. I think we should throw an error if the user specified something that is not majority instead of silently converting it (although this is a different behavior compared to mongod). What do you think, kaloian.manassiev, esha.maharishi & alyson.cabral?

Generated at Thu Feb 08 04:33:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.