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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.4.11, 5.0.4, 5.1.0-rc2, 5.1.0-rc3
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v5.1, v5.0, v4.4
    • Sprint:
      Repl 2021-11-01
    • Linked BF Score:
      39

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: