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

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v3.6
    • Epic Link:
    • Sprint:
      Query 2017-12-04
    • Linked BF Score:
      0

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              david.storch David Storch
              Reporter:
              david.storch David Storch
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: