-
Type:
Investigation
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Tools and Replicator
-
0
This change adds a new change stream option "showEndOfTransaction" for change stream queries. This will allow change stream consumers to opt in to receiving information about the final event in a transaction, and thus unambiguously tell when a specific transaction has finished.
The option can be set inside the {$changeStream} stage in the aggregation pipeline, e.g. {$changeStream: {showEndOfTransaction: "whenAvailable"}}.
Specifying the field is optional. If specified, it needs to have one of these values:
- "off": no endOfTransaction change events will be returned by the change stream
- "whenAvailable": the change stream will generate endOfTransaction change events when possible, but won't fail if it doesn't have all required data to produce the event for a transaction
- "required": the change stream will generate endOfTransaction change events when possible, and will fail if it doesn't have all required data to produce the event for a transaction
Not setting the option on a change stream is equivalent to setting the option to "off", which preserves downwards compatibility.
Note that this change only introduces the new field on the change stream pipeline stage, but no endOfTransaction change events will currently be emitted by change streams. This will be implemented in follow-up PRs in SPM-4826.
Description of Linked Ticket
This change adds an `showEndOfTransaction` option to change streams.
The option has values `off`, `whenAvailable` and `required`. Not setting the option is identical to `off`.
The option value is only serialized and affects the query shape hash if it is set to `whenAvailable` or `required`. This keeps compatibility with older versions.
The option can only be set if the feature flag `featureFlagChangeStreamEventOfTransactionEventSynthesis` is enabled, and if a v2 change stream reader can be used for the change stream.
The option value is currently not read elsewhere, but it will be in future PRs for SPM-4826.
- depends on
-
SERVER-137614 Add `showEndOfTransaction` change stream option
-
- Closed
-