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

Newly-elected primaries do not wait for single-phase background index builds to complete before accepting writes

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.2.9, 4.0.21
    • Affects Version/s: 4.0.0, 4.2.0
    • Component/s: None
    • Labels:
    • Minor Change
    • ALL
    • v4.0
    • Execution Team 2020-06-29, Execution Team 2020-07-13
    • 17

      Definition of "single-phase background builds": Index builds started on versions 4.2 and prior; in 4.4, index builds started in FCV 4.2. 

      Consider the scenario:

      • Node 1, Primary, starts and completes a single-phase background index build. It replicates a "createIndexes" oplog entry
      • Node 2, Secondary, starts the index build
      • Node 2 steps up as primary, but the index build is still incomplete

      Say a client created an index and waited for it to complete on the primary before issuing read queries. After the state transition, the client will see that the index build is no longer available for queries until the new primary completes the index build. 

      Proposed solution: on a state transition to primary, wait for all BackgroundOperations to complete like we already do for rollback.

            louis.williams@mongodb.com Louis Williams
            louis.williams@mongodb.com Louis Williams
            0 Vote for this issue
            4 Start watching this issue