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

Current use of DatabaseShardingState::isMovePrimaryInProgress in createIndex is not sufficient to prevent running together with movePrimary

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL
    • 0
    • 2

      The movePrimary coordinator currently sets the _movePrimaryInProgress flag (while holding database lock in MODE_X). The flag is kept to true during the duration of cloning. Create indexes checks that there is no concurrent movePrimary running. However, the check is insufficient because it is only performed during the phase where it will decide to implicitly create a collection. It will release the database lock after this and the index coordinator will reacquire the database lock later multiple times without checking _movePrimaryInProgress. This enables a scenario like this:

      1. createIndex starts and passes the "no movePrimary in progess" test.
      2. movePrimary sets the _movePrimaryInProgress flag and starts cloning.
      3. createIndex proceeds to creating the new index.

            Assignee:
            Unassigned Unassigned
            Reporter:
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: