[SERVER-71691] Error 5643004 when using $setWindowFields in a facet Created: 30/Nov/22 Updated: 29/Oct/23 Resolved: 09/Jan/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 5.0.13, 6.0.3 |
| Fix Version/s: | 5.0.15, 6.0.4, 6.3.0-rc0, 6.2.0-rc6 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Gianluca Nitti | Assignee: | Alyssa Clark |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Assigned Teams: |
Query Execution
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backport Requested: |
v6.2, v6.0, v5.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: | The following is the most minimal example I've been able to set up which shows the bug. I have the following collection:
The following pipeline results in the error:
With the server log file containing:
The following pipelines both return the expected result without errors:
I'm using MongoDB 6.0.3-29-g3568ba7 on CentOS 7. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | QE 2023-01-09, QE 2023-01-23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
When running an aggregation pipeline with a $facet stage where one of the sub-pipelines contains a $setWindowFields stage, the execution fails with the following error:
The server log file reports the error code 5643004 (see "steps to reproduce" for more detail). If one of the two facets is removed,everything works as expected. |
| Comments |
| Comment by Gianluca Nitti [ 17/Jan/23 ] |
|
Hello, I just tried my use cases on MongoDB server version: 6.0.4-rc0-4-g92f6cdf (as shown in mongosh) and everything now works properly regardless of facets order. Thanks for fixing. |
| Comment by Githook User [ 10/Jan/23 ] |
|
Author: {'name': 'Alyssa Wagenmaker', 'email': 'alyssa.wagenmaker@mongodb.com', 'username': 'awagenmaker'}Message: |
| Comment by Githook User [ 09/Jan/23 ] |
|
Author: {'name': 'Alyssa Wagenmaker', 'email': 'alyssa.wagenmaker@mongodb.com', 'username': 'awagenmaker'}Message: |
| Comment by Githook User [ 09/Jan/23 ] |
|
Author: {'name': 'Alyssa Wagenmaker', 'email': 'alyssa.wagenmaker@mongodb.com', 'username': 'awagenmaker'}Message: |
| Comment by Githook User [ 06/Jan/23 ] |
|
Author: {'name': 'Alyssa Wagenmaker', 'email': 'alyssa.wagenmaker@mongodb.com', 'username': 'awagenmaker'}Message: |
| Comment by Alyssa Clark [ 05/Jan/23 ] |
|
This is caused by $setWindowFields not accounting for the possibility of execution being temporarily paused due to the other pipeline still needing to process results from the input source shared by the two. It only hits this case when it is before another pipeline, hence why the other pipeline's existence and ordering mattered. As a fix, the window pipeline stage needs to be able to detect execution being paused and propagate that state to its caller. |
| Comment by Chris Kelly [ 22/Dec/22 ] |
|
Hi Gianluca, Thanks for your report! I was able to reproduce this issue on 5.0.13 and 6.0.3.
I'll pass this on to the relevant team to take a look.
Christopher |
| Comment by Gianluca Nitti [ 30/Nov/22 ] |
|
This seems to be the same problem reported in this discussion, which got no follow-up: https://www.mongodb.com/community/forums/t/group-and-sum-add-all-greater-than/181319
Indeed, also in my example shown above exchanging the order of the facets (facet2 before facet1) solves the issue, however a) I believe this is still a problem (the order of facets should not be relevant - the documentation for $facet says "These sub-pipelines are completely independent of one another") and b) I have more complex examples where the pipeline fails no matter what the order of the facets is. |