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

Possible for read starvation to cause migration to get stuck in critical section

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.2.2, 2.3.1
    • 2.2.0
    • Sharding
    • None
    • Fully Compatible
    • ALL

    Description

      If a migration aborts it calls the done() method on MigrateFromStatus, which is what takes that server out of the critical section. That method, however, tries to acquire the database read lock on the database for which the migration is taking place. While in the critical section, however, all requests on that collection hang in running setShardVersion, which waits for the server to be out of the critical section. setShardVersion, however, takes the database's write-lock. So if you have a lot of queries coming in to that namespace on a lot of different threads, all the setShardVersion commands can cause read starvation on the database lock, preventing the migration from ever finishing.

      Proposed fix is to change MigrateFromStatus::done to use a write lock rather than a read lock so that the lock acquisition will be greedy.

      Attachments

        Activity

          People

            spencer@mongodb.com Spencer Brody (Inactive)
            spencer@mongodb.com Spencer Brody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: