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

Do not error when parsing change stream event documents

    • Type: Icon: Spec Change Spec Change
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: Change Streams
    • Needed
    • Hide

      Updated the Change Streams spec and added new unified tests. Drivers should sync unified change stream tests with dbed22d and 3cb20c1.

      Note: drivers that have yet to implement DRIVERS-2231 should do so before this ticket; otherwise, commandStartedEvent assertions may fail due to an unexpected fullDocument field appearing in observed events.

      Show
      Updated the Change Streams spec and added new unified tests. Drivers should sync unified change stream tests with dbed22d and 3cb20c1 . Note: drivers that have yet to implement DRIVERS-2231 should do so before this ticket; otherwise, commandStartedEvent assertions may fail due to an unexpected fullDocument field appearing in observed events.
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      CDRIVER-4279 Backlog
      CXX-2440 Fixed 3.7.0
      CSHARP-4036 Done 2.16.0
      GODRIVER-2296 Done
      JAVA-4470 Fixed 4.6.0
      NODE-3940 Done
      MOTOR-880 Duplicate
      PYTHON-3095 Duplicate
      PHPLIB-829 Fixed 1.13.0-beta1, 1.13.0
      RUBY-2893 Fixed 2.18.0
      RUST-1168 Fixed 2.3.0
      SWIFT-1474 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-4279 Backlog CXX-2440 Fixed 3.7.0 CSHARP-4036 Done 2.16.0 GODRIVER-2296 Done JAVA-4470 Fixed 4.6.0 NODE-3940 Done MOTOR-880 Duplicate PYTHON-3095 Duplicate PHPLIB-829 Fixed 1.13.0-beta1, 1.13.0 RUBY-2893 Fixed 2.18.0 RUST-1168 Fixed 2.3.0 SWIFT-1474 Won't Do

      Summary

      Some drivers parse change stream documents into language types.

      Proposed change is to avoid parsing errors of change stream events that prevent:

      • Server from adding new values to operationType.
      • Server from adding fields.
      • Users from applying projection.

      Motivation

      Some drivers parse operationType as an enumeration and throw an error if parsing an unrecognized operationType. See this spreadsheet for a list of affected drivers.

      That behavior necessitated an opt-in flag for adding new change stream events in PM-1950. PM-1950 makes the assumption that introducing new change stream event types does not break user applications.

      Drivers should permit new fields to allow extension. C# throws on extra fields in the ns subdocument. The ns document could have fields added in the future. E.g. viewOn.

      One motivation is to avoid opt-in flags when adding events in the future.

      Another motivation is to allow users to apply a $project stage. The server errors if _id is projected out. Users should be free to add, remove or modify any other fields in the change stream event as they see fit.

      Who is the affected end user?

      Permitting unrecognized operationType permits the server to add change stream events with a new operationType without breaking existing user applications. Allowing extra fields permits the server to extend change stream events in the future. Permitting missing / modified fields permits the user to apply $project.

      How does this affect the end user?

      If new operationType values result in an error, it requires the server to add new change stream events behind an "opt-in" flag.

      If there is no "opt-in" flag, user applications will error when a server upgrade occurs before a driver upgrade. Example:

      • Atlas upgrades the backing server
      • User is stuck on an old driver that does not recognize the new operationType
      • Change stream iteration errors when the new event is produced.

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

      The query team believes it is likely that new change stream events will be added in the future.

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

      If this is not done before PM-1950, the server will need to continue to add change stream events behind additional "opt-in" flags.

      Is this issue urgent?

      This ticket should be done on the timeline of PM-1950. That will enable all future events to be behind the one "opt-in" flag introduced in PM-1950.

      Is this ticket required by a downstream team?

      Possibly Shell.

      Is this ticket only for tests?

      No. This has functional impact.

            Assignee:
            james.kovacs@mongodb.com James Kovacs
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            James Kovacs James Kovacs
            Rachelle Palmer Rachelle Palmer
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: