- 
    Type:Bug 
- 
    Resolution: Fixed
- 
    Priority:Major - P3 
- 
    Affects Version/s: 6.0.15
- 
    Component/s: None
- 
    None
- 
        Query Execution
- 
        Fully Compatible
- 
        ALL
- 
        v8.0, v7.3, v7.0, v6.0
- 
        
- 
        QE 2024-06-24, QE 2024-07-08
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
The $changeStreamSplitLargeEvent stage is expected to move before the $_internalChangeStreamEnsureResumeTokenPresent stage when the latter stage is present. If this does not happen the user assertion 7182803 is thrown.
It appears that it will not happen when there is a non-renameable user-defined $match stage in the change stream pipeline. In such a case, this $match stage will remain between $_internalChangeStreamEnsureResumeTokenPresent and $changeStreamSplitLargeEvent stages after the optimization, which will block the $changeStreamSplitLargeEvent from moving ahead of $_internalChangeStreamEnsureResumeTokenPresent.
Possible solutions:
- Remove the assertion. This solution is not practical, because in the presence of non-renameable $match the $changeStreamSplitLargeEvent stage will not move before $_internalChangeStreamEnsureResumeTokenPresent and $_internalChangeStreamHandleTopologyChange and won't be pushed into the shard pipelines and will fail to split large events created on the shards with BSONObjectTooLarge error.
- Always move $match before the two stages. This solution might interfere with SERVER-71565 and SERVER-67677 and change the behaviour of some change stream pipelines (resumable pipelines might become non-resumable).
- Backport SERVER-75853. Large backports like this are risky and likely not solve the problem entirely. And we need alsoSERVER-73914(thanks to catalin.sumanaru@mongodb.com for pointing at this).
Solving this problem might also improve the performance of $match stages, because they will be "pushed-down" and eventually merge with other $match stages improving the overall performance.
Regardless of this problem we should consider the following:
- Document any additional limitations of $changeStreamSplitLargeEvent (see also SERVER-91313).
- Use ChangeStreamFatalError instead of 7182803, because 7182803 is of NonspecificAssertionException category and it won't be logged with the default logging settings.
- Add the $changeStreamSplitLargeEvent stage to the change stream fuzzer (DEVPROD-8085).
- is related to
- 
                    SERVER-75853 Have hasOnlyRenameableMatchExpressionChildren() examine renames would succeed -         
- Closed
 
-         
- related to
- 
                    SERVER-92938 Allow $match move before stages that do not rename or modify any paths -         
- Backlog
 
-