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

The balancingWindow does not work

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Sharding
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      1.set activewindow
      use config
      db.settings.update({_id:"balancer"},{$set:{activeWindow:

      {start:"time to start",stop:"time to stop"}

      }},

      {upsert:true}

      )

      2.check
      sh.getBalancerWindow()

      3.start insert documents outside the activeWindow time.
      for(i=1,i<1000000;i++){db.test2.insert(

      {num:i}

      )} (shard key is num)

      4.check the chunks and log
      sh.status()& vim mongod.log

      5.found out the migration is done.

      Show
      1.set activewindow use config db.settings.update({_id:"balancer"},{$set:{activeWindow: {start:"time to start",stop:"time to stop"} }}, {upsert:true} ) 2.check sh.getBalancerWindow() 3.start insert documents outside the activeWindow time. for(i=1,i<1000000;i++){db.test2.insert( {num:i} )} (shard key is num) 4.check the chunks and log sh.status()& vim mongod.log 5.found out the migration is done.

      Description

      HI all
      we set the balancingWindow like below

      db.settings.update({_id:"balancer"},{$set:{activeWindow:{start:"15:00",stop:"16:00"}}},{upsert:true})
      

      But found out that the migrate and balancing is still working outside the activeWindow.

      And then check the source code of balancing.

      I found out the source code in "mongo/src/mongo/s/grid.cpp" is like below:

      bool Grid::shouldBalance(const SettingsType& balancerSettings) const {
          if (balancerSettings.isBalancerStoppedSet() && balancerSettings.getBalancerStopped()) {
              return false;
          }
       
          if (balancerSettings.isBalancerActiveWindowSet()) {
              boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
              return balancerSettings.inBalancingWindow(now);
          }
       
          return true;
      }
      

      It looks like whether the time is outside the activeWindow or not ,the return is always "true"

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: