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

Improve error message for incorrect "w" values.

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 2.3.2
    • 2.2.1
    • Replication

    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"

      Attachments

        Activity

          People

            sverch Shaun Verch
            derick Derick Rethans
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: