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

ReshardCollection can sometimes trigger invalidate event on change streams

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Cluster Scalability
    • Fully Compatible
    • ALL
    • v8.0, v7.0, v6.0, v5.0
    • Cluster Scalability 2024-11-11

      ReshardCollection performs a rename with dropTarget: true during commit when it switches the temporary collection to have the name of the real collection. The oplog generated from this operation has fromMigrate: true, so the changeStreams will not include this event.

      However, there is a logic in the cleanup phase to make sure the original collection doesn't exist anymore that sends drop to all shards. If the drop was not a no-op, this will generate a drop collection oplog entry without fromMigrate: true causing the change stream to pick it up and cause a invalid event type.

      As a summary, all of these conditions must be present to trigger bug:

      • change stream on specific namespace or database (change stream on the entire cluster doesn't produce invalidate events)
      • original collection had shards that had an empty collection of the same namespace and doesn't own any chunks, both before and after resharding. If the shard would own chunks after resharding, it would have been renamed instead of dropped.

            Assignee:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Reporter:
            randolph@mongodb.com Randolph Tan
            Votes:
            1 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: