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

Allow change stream with updateLookup to run directly against a shard mongoD in a sharded cluster

    • Fully Compatible
    • v4.2
    • Query 2019-12-16

      FTS needs the ability to run an updateLookup change stream directly against a shard mongoD in a cluster. At present, this is not possible, because MongoInterfaceShardServer::attachCursorSourceToPipeline only expects to run in the context of a $lookup, and therefore uasserts if the collection is sharded.

      When a change stream specifies {fullDocument: "updateLookup"} and we come across an update event, we do the updateLookup here. This calls into MongoInterfaceStandalone::lookupSingleDocument and eventually reaches MongoInterfaceStandalone::makePipeline. When this attempts to call attachCursorSourceToPipeline, though, the fact that this is a shard server becomes relevant. Instead of calling MongoInterfaceStandalone::attachCursorSourceToPipeline, we instead call MongoInterfaceShardServer::attachCursorSourceToPipeline. We only expect this to be called for $lookup, never for a change stream; and so we unconditionally throw if the collection we are attempting to read from is sharded.

            Assignee:
            bernard.gorman@mongodb.com Bernard Gorman
            Reporter:
            bernard.gorman@mongodb.com Bernard Gorman
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: