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.
- fixes
-
SERVER-71932 Refactor executeBatch logic in batch_write_exec
- Closed