-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
DB Integration & Observability
-
Fully Compatible
-
QE 2026-10-26, QE 2026-11-23
-
None
-
None
-
None
-
None
-
None
-
None
-
None
With showErrorsAsEvents, a change stream event that exceeds the BSON size limit (~16MB) currently fails the stream exactly as on master. This ticket covers converting such oversized events into operationType:"error" events so the stream stays alive, and completing/hardening that path.
The core conversion landed in the change stream error-conversion stage:
- The stage serializes each delivered event through serializeChangeStreamEventForExecutor; an event exceeding the BSON size limit is converted into an oversized-event error event carrying the original event's resume token (as _id and sort key), so the client can resume past it.
- changeStreams.largeEventsFailed was moved from the plan executor into change_stream_helpers so it is counted in exactly one place on both the flag-off and flag-on serialization paths; the executor's opted-in path skips re-serializing the BSON-backed event as a cached no-op.
- An error event that is itself too large (e.g. a very large documentKey) fails closed with ChangeStreamFatalError rather than leaking a BSONObjectTooLarge that would wrongly imply a retryable oversized event.
Files
- src/mongo/db/pipeline/change_stream_helpers.{h,cpp}
- src/mongo/db/pipeline/change_stream_helpers_test.cpp
- src/mongo/db/exec/agg/change_stream_convert_errors_stage.cpp
- src/mongo/db/pipeline/plan_executor_pipeline.cpp