Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-2468

Add a test that drivers emit a CommandSucceededEvent when ok=1 and a writeConcernError is returned

    • Needed
    • Hide

      Sync the command monitoring and logging spec tests to https://github.com/mongodb/specifications/commit/18932c00f9e2f8be66b48c930cbbc428499db668 and ensure that write concern errors with ok: 1 in the result publish a command succeeded event and retry the operation.

      Show
      Sync the command monitoring and logging spec tests to https://github.com/mongodb/specifications/commit/18932c00f9e2f8be66b48c930cbbc428499db668 and ensure that write concern errors with ok: 1 in the result publish a command succeeded event and retry the operation.
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      CDRIVER-4554 Backlog
      CXX-2633 Backlog
      CSHARP-4480 Fixed 2.20.0
      GODRIVER-2733 Backlog
      JAVA-4842 Fixed 4.9.0
      NODE-4958 Fixed 5.0.0
      MOTOR-1081 Duplicate
      PYTHON-3566 Won't Do
      PHPLIB-1063 Fixed 1.16.0
      RUBY-3203 Fixed 2.19.0
      RUST-1567 Fixed 2.5.0
      SWIFT-1688 Won't Do
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion CDRIVER-4554 Backlog CXX-2633 Backlog CSHARP-4480 Fixed 2.20.0 GODRIVER-2733 Backlog JAVA-4842 Fixed 4.9.0 NODE-4958 Fixed 5.0.0 MOTOR-1081 Duplicate PYTHON-3566 Won't Do PHPLIB-1063 Fixed 1.16.0 RUBY-3203 Fixed 2.19.0 RUST-1567 Fixed 2.5.0 SWIFT-1688 Won't Do

      Summary

      The command monitoring spec defines a successful command as one with an ok:1 reply and a failed command as one with an ok:0 reply. However, it seems that at least the Node driver decides whether to emit a command succeeded or failed event based on whether or not an error is going to be thrown rather than the "ok" value.

      While this seems reasonable, that logic is problematic because server replies can have ok:1 and a writeConcernError. In these cases, based on the definition of "success" in the command monitoring spec, we should emit a CommandSucceededEvent but also throw an error.

      This came up because DRIVERS-2327 adds a prose test which sets a failpoint that results in an ok:1 response with a writeConcernError and then tells the driver to expect a command succeeded event. That prose test will implicitly cover this behavior but we should add a unified test to the command monitoring spec which explicitly covers it.

      Motivation

      Who is the affected end user?

      Driver developers who use command monitoring events in tests; driver users who consume APM events.

      How does this affect the end user?

      For driver developers the bug is impactful as it leads to discrepancy in what events the driver emits based on certain errors which can lead to the driver failing spec tests.

      Arguably this bug is less of a problem for driver users as they might expect that the buggy behavior is the right behavior (error = failed event).

      How likely is it that this problem or use case will occur?

      Any case where there is a writeConcernError and ok=1 (most write concern errors)

      If the problem does occur, what are the consequences and how severe are they?

      The wrong event type is emitted which could make e.g. logs generated from APM events confusing.

      Is this issue urgent?

      From a user facing perspective probably not, because we haven't heard about it yet from any users. That said, drivers will need to fix this bug to correctly implement DRIVERS-2327.

      Is this ticket required by a downstream team?

      No, but the Node driver having this bug would mean it also affects users of our dev tools like mongosh.

      Is this ticket only for tests?

      The only work here is to add a test, but this test would uncover a bug in drivers that do not pass it.

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            kaitlin.mahar@mongodb.com Kaitlin Mahar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: