-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Catalog and Routing
-
ALL
-
200
-
🟦 Shard Catalog
-
None
-
None
-
None
-
None
-
None
-
None
An aggregation that runs against a collection that has been recently created or that is concurrently created may fail with QueryPlanKilled.
This is the sequence of operations run in a jstest that has triggered the error. The aggregation uses $out, but we assume the issue would occur with any aggregation that is not collectionless.
// create the collection through an insert with write concern {w:1} coll.insert({x:1}, {writeConcern: {w:1}}) // run aggregation with readConcern: 'majority' coll.aggregate([{$match: {}},{$out: "collOut"}], {readConcern: {level:'majority'}})
Reasoning
During aggregation, all involved collections are acquired up front, then released, and re-acquired when pipeline execution starts.
It could happen that the aggregation's target collection appears only after the second acquisition. At that point, the operation would fail with QueryPlanKilled, because a collection participating in the aggregation cannot be created while the aggregation is in progress.
- is related to
-
SERVER-119826 Temporarily mark QueryPlanKilled as expected on aggregation commands in read_write_concern_defaults_application.js
-
- Closed
-
- related to
-
SERVER-120637 Remove TODO for SERVER-119827 that was closed as work as designed
-
- Backlog
-