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

Only acquire database X-lock on the recipient if the collection does not exist

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.7
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • Sharding 2018-12-17, Sharding 2018-12-31, Sharding 2019-01-14

      The chunk migration logic on the recipient side unconditionally acquires database X-lock acquisition at migration start in order to copy the collection indexes and options from the donor.

      Similarly to the donor side, this lock acquisition can block behind active transactions and lead to stalls. However, what makes them worse than the donor is that while these lock requests are waiting to be granted, the recipient is not making any progress cloning the chunk. This in turn has the potential to cause buildup of xferMods on the donor side, leading to high memory utilization and/or increased duration of the migration.

      Because of this, the MigrationDestinationManager should first use AutoGetCollection with MODE_IX lock to check whether the collection exists and only if it doesn't exist should it resort to MODE_X database lock.

            Assignee:
            kimberly.tao@mongodb.com Kim Tao
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: