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

Single phase index build (index creation with empty collections) does not abort migrations

    • Sharding EMEA
    • Fully Compatible
    • ALL
    • v6.0
    • Sharding EMEA 2023-03-20
    • 14

      When an index is being built, we have observers that abort any ongoing migrations for the namespace where the index is being built. This is done to ensure index consistency across shards, because if the migration already started and passed the point where it copied the collection indexes, any new index creation would leave the cluster with inconsistent indexes.

      Additionally, on an empty collection, an index build executes a single phase build, which only calls the onCreateIndex observer.

      Joining those two facts, we can see how we are missing aborting migrations in the onCreateIndex observer, which might cause inconsistent indexes across shards when an index creation is executed concurrently with a migration to a shard that previously did not have collection data. The file attached: migration_abort_index_creation.js contains a repro where a migration that should've been aborted, succeeds.

            Assignee:
            marcos.grillo@mongodb.com Marcos José Grillo Ramirez
            Reporter:
            marcos.grillo@mongodb.com Marcos José Grillo Ramirez
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: