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

The balancingWindow does not work

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • ALL
    • 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.

      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"

            Assignee:
            sam.kleinman Sam Kleinman (Inactive)
            Reporter:
            eshujiushiwo Edision chow
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: