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

Remove invalid invariants from processResponseFromRemote()

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 8.0.4
    • Affects Version/s: 8.1.0-rc0
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0, v7.0
    • 200

      batch_write_exec.cpp processResponseFromRemote() contains two invalid invariant calls:

          if (!staleConfigErrors.empty()) {
      1:      invariant(staleDbErrors.empty());
              ...
          }
      
          if (!staleDbErrors.empty()) {
      2:       invariant(staleConfigErrors.empty());
                ...
          }
      

      These insist that ErrorCodes::StaleConfig and ErrorCodes::StaleDbVersion cannot both occur on a single call to batchOp.noteBatchResponse(), however that method calls batch_write_op.cpp trackErrors() which has a vector of errors, and it just adds all of them that are marked for tracking to its response.

      The invariants() are thus enforcing a constraint that is not guaranteed to be true. Even if it was true at one time, changes to the error tracking on the receiving end of the call can easily be envisioned that would make it possible to occur, and the invariant calls thus change a rare but harmless event into a server crash. This kind of check introduces too tight a coupling between the caller and the internal details of the callee's implementation and thus should be removed.

            Assignee:
            kevin.cherkauer@mongodb.com Kevin Cherkauer
            Reporter:
            kevin.cherkauer@mongodb.com Kevin Cherkauer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: