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: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Cluster Scalability
    • ALL

      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:
            Unassigned Unassigned
            Reporter:
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: