[SERVER-7567] Improve error message for incorrect "w" values. Created: 06/Nov/12  Updated: 11/Jul/16  Resolved: 28/Nov/12

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 2.2.1
Fix Version/s: 2.3.2

Type: Improvement Priority: Minor - P4
Reporter: Derick Rethans Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

While looking at implementing the new "w=1" default setting for MongoClient I noticed that setting values for w sometimes shows a confusing warning. This also cause the confusion in PHP-556 and https://github.com/doctrine/mongodb-odm/pull/439#issuecomment-9871420.

Right now, when you send a w value of anything but int(0), int(1), bool(false) or bool(true) with getLastError and replication is not enabled, you receive a warning message back from mongod: "no replication has been enabled, so w=2+ won't work".

If however you (incorrectly) specify as getLastError value, string(true) or string(false) then you will get the same error message. From the PHP driver, we do not handle different string values differently because getLastErrorModes, and we should not use string(false) and string(true) as magical keywords to actually mean bool(false) and bool(true). It would be a useful improvement if the error message from mongod would include the real value of "w" that it received, instead of just using "w=2+" all the time. For example:

  • "no replication enabled, so w=3 won't work"
  • "no replication enabled, so w="allDCs" won't work"
  • "no replication enabled, so w="true" won't work"


 Comments   
Comment by auto [ 28/Nov/12 ]

Author:

{u'date': u'2012-11-27T22:54:56Z', u'email': u'shaun.verch@10gen.com', u'name': u'Shaun Verch'}

Message: SERVER-7567 Print actual value passed to w in getLastError message
Branch: master
https://github.com/mongodb/mongo/commit/2d006f07c0355a68c8724fe8eef9c2ba38c3320a

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