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

The balancer settings refresh can overwrite newer config

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 7.0.13, 8.0.0-rc14
    • Affects Version/s: 6.0.16, 7.3.3, 7.0.12, 5.0.28, 8.0.0-rc13
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • ALL
    • v8.0, v7.3, v7.0, v6.0, v5.0
    • Hide

      Repro attached as bf-33831.diff

       

      Show
      Repro attached as bf-33831.diff  
    • CAR Team 2024-07-08, CAR Team 2024-07-22
    • 0

      The _refreshBalancerSettings function reads from the config server and constructs the new setting object outside the mutex, and then swaps it under the mutex.

      In the presence of multiple threads doing refreshes, an interleaving where:

      1. Thread1 has created a BalancerSettingsType at T(1)
      2. Thread2 creates a BalancerSettingsType at T(2) and performs the swap
      3. Thread1 performs the swap with BalancerSettingsType for T(1)

      This causes the BalancerConfiguration to go back in time.

      A particular example is the Balancer thread, which performs a refresh in each round, interleaving with a _configsvrBalancerStatus refreshing to report status.

      We should also check _refreshChunkSizeSettings and _refreshAutoMergeSettings.

        1. bf-33831.diff
          5 kB
          Yujin Kang Park

            Assignee:
            silvia.surroca@mongodb.com Silvia Surroca
            Reporter:
            yujin.kang@mongodb.com Yujin Kang Park
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: