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

Interleaved operations during sharded collection drop violate change stream guarantees

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • Affects Version/s: 4.2.0, 4.4.0, 5.0.0, 6.0.0
    • Component/s: None
    • None
    • Query Execution
    • Sharding EMEA 2021-12-27, Sharding EMEA 2022-01-10

      Following a conversation with max.hirschhorn, it appears that while dropping a sharded collection, it is possible for CRUD or DDL events to interleave with the collection drops from the individual shards, based on their respective clusterTimes:

        Shard 1 Shard 2 Shard 3
      T1 drop    
      T2   insert  
      T3   drop  
      T4     drop

      In the above scenario, for a single-collection stream, this will cause change streams to break in two significant ways:

      In order for change stream semantics to remain robust through collection drops, there cannot be any CRUD or DDL events on that collection at or later than the clusterTime of the earliest drop event across all shards. Max tells me that this is already the case for sharded renameCollection, and that it may be possible to apply a similar approach to drop. The individual collection drops performed by the dropDatabase command should similarly obey the above constraints.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            bernard.gorman@mongodb.com Bernard Gorman
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: