Write concern with w=0 and j=true is a GLE op

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 1.1.5
    • Affects Version/s: 1.1.2
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently, _mongoc_write_concern_needs_gle() returns true only if w is neither 0 or -1. This function is used by both the legacy and write command code paths. If the user were to specify w:0 and j:true, the driver skips sending a GLE. Although an edge case, this is unfortunate in that the server would otherwise have upgraded that w:0 to w:1 in order to honor the j:true option. For write commands, if the user specifies any values for a write concern, they should be included in the command(s).

      I believe there are also implications for replSetGetConfig.settings.getLastErrorDefaults, as that option kicks in only when the driver does not specify a write concern.

      A fix will start with having the driver differentiate between false and unset values for journal and fsync_ on the write concern struct. From there, the logic for _mongoc_write_concern_needs_gle() and BSON serialization can be changed.

            Assignee:
            A. Jesse Jiryu Davis
            Reporter:
            Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: