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

Insert document in new collection in migration_id_index.js to await successful index build on secondary

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.4.11, 5.0.4, 5.1.0-rc2, 5.1.0-rc3
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v5.1, v5.0, v4.4
    • Repl 2021-11-01
    • 39

      In migration_id_index.js, we create an empty collection and then attempt to migrate it from shard 0 to shard 1. We then verify the _id index is built on both shard1 primary and secondary.

      When building an index, the replica set primary will wait until all voting members have successfully built the index before committing it (two-phase index build). However, for empty collections, we have an optimization where we don't wait for the _id index to be built. Instead, we rely on the createIndex command to be propagated via the oplog.

      As a result, in the test, we don't wait for the index to be built on the secondary node before we attempt to verify it exists (even with majority write concern). We should simply insert a document into the collection at the beginning of the test, so that the index build is two-phase.

            Assignee:
            ali.mir@mongodb.com Ali Mir
            Reporter:
            ali.mir@mongodb.com Ali Mir
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: