Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-31978

Add an invariant that DocumentSourceCloseCursor does not execute on a mongod for a sharded $changeStream

    • Fully Compatible
    • v3.6
    • Query 2017-12-04
    • 0

      DocumentSourceCloseCursor is part of the internal $changeStream machinery. It is used to close change stream cursors that have been invalidated, due to an event such as a collection drop or database drop.

      DocumentSourceCloseCursor should always run on the mongos in the case that the $changeStream is run in a sharded configuration. This is because the mongos cursor manager is not prepared to correctly handle its child cursor being closed out from under it. Instead, the cursor should be closed via the DocumentSourceCloseCursor running on mongos. Cleanup of the mongos cursor should cause the underlying cursors on the shards to be cleaned up as well.

      As of commit d4a526fdcf under SERVER-30834, $changeStream will never pass through completely to the shards. Therefore, the DocumentSourceCloseCursor should always end up on mongos. Since it is not obviously wrong to pass through the change stream, we should add an invariant to make sure that this doesn't regress.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: