-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
DB Integration & Observability
-
Fully Compatible
-
QI 2025-02-17
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Deliverable
Record the in-flight event identity and signal failures without building an event.
- Transform stage: Record each event’s identity as it is built, and clear the identity slot before pulling the next entry.
- Pre-image, post-image, and updateLookup stages: On a convertible lookup failure, set activeChangeStreamErrorSource = internal-pipeline and rethrow. Do not build the event.
- BatchedEnrichmentStage (batched updateLookup): Record each event’s identity before enriching it. On a convertible failure, defer the error in _pendingConvertibleError so the already-enriched prefix is emittedfirst. Then re-record the failing event’s identity and surface the error in stream order.
- CheckInvalidate: Re-record the identity when releasing a queued invalidate.
- Required-mode identity clearing: When fullDocument or fullDocumentBeforeChange is required and the image is missing, clear the recorded identity before rethrowing NoMatchingDocument (fail closed).
Files
- src/mongo/db/exec/agg/change_stream_transform_stage.cpp
- src/mongo/db/exec/agg/change_stream_add_pre_image_stage.{h,cpp}
- src/mongo/db/exec/agg/change_stream_add_post_image_stage.{h,cpp}
- src/mongo/db/exec/agg/change_stream_update_lookup_stage.{h,cpp}
- src/mongo/db/exec/agg/batched_enrichment_stage.{h,cpp}
- src/mongo/db/exec/agg/change_stream_check_invalidate_stage.cpp
Tests
- Verify the transform stage records identity for each event and clears it before the next pull.
- Verify image and updateLookup stages set the source slot and rethrow on failure.
- Verify batched enrichment emits the enriched prefix first, then surfaces the deferred error in stream order, re-recording the failing event’s identity on release.
- Verify required mode clears identity and the failure is not converted.
Dependencies
Stage implementation.
Expression context support