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

Balancing Window Per Day of the week

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Catalog and Routing
    • 3

      A user should be able to specify a balancing window for each day of the week

      db.settings.updateOne(
         { _id: "balancer" },
         { $set: { activeWindowDOW : { day : "<day_name>", start : "<start-time>", stop : "<stop-time>" } } },
         { upsert: true }
      )

       
      Let's introduce a new field "activeWindowDOW" to not break backward compatibility or upgrades.

      For example, to set the balancing window from 9 to 5 Monday through Friday, and all day on weekends you would do the following:

      db.settings.updateOne(
         { _id: "balancer" },
         { $set: {activeWindowDOW: [
                     { day: "Monday", start: "00:01", stop: "23:59" },
                     { day: "Tuesday", start: "09:00", stop: "17:00" },                
                     { day: "Wednesday", start: "09:00", stop: "17:00" }, 
                     { day: "Thursday", start: "09:00", stop: "17:00" }, 
                     { day: "Friday", start: "09:00", stop: "17:00" },
                     { day: "Saturday", start: "09:00", stop: "17:00" },               
                     { day: "Sunday", start: "00:01", stop: "23:59" }                      
                     ]
                   }  
         },
         { upsert: true }
      )

       

      If they want to run overnight on weekdays from 10 PM to 6 AM, and all day on weekends, they will have to set multiple windows per day:

      db.settings.updateOne(
         { _id: "balancer" },
         { $set: {activeWindowDOW: [
                     {day: "Monday", start: "22:00", stop: "23:59" },
                     {day: "Tuesday", start: "00:00", stop: "06:00" },
                     {day: "Tuesday", start: "22:00", stop: "23:59" }, 
                     {day: "Wednesday", start: "00:00", stop: "06:00" },
                     {day: "Wednesday", start: "22:00", stop: "23:59" }, 
                     {day: "Thursday", start: "00:00", stop: "06:00" },
                     {day: "Thursday", start: "22:00", stop: "23:59" }, 
                     {day: "Friday", start: "00:00", stop: "06:00" },
                     {day: "Friday", start: "22:00", stop: "23:59" },  
                     { day: "Saturday", start: "00:01", stop: "23:59" },
                     { day: "Sunday", start: "00:01", stop: "23:59" }
                     ]
                   }  
         },
         { upsert: true }
      ) 

       
      They can also do the same thing by setting multiple balancing windows per day:

      db.settings.updateOne(
         { _id: "balancer" },
         { $set: {activeWindowDOW: [
                     { day: "Sunday", start: "00:01", stop: "23:59" },
                     { day: "Monday", start: "09:00", stop: "17:00" },                
                     { day: "Monday", start: "22:00", stop: "23:59" }, 
                     { day: "Wednesday", start: "09:00", stop: "17:00" }, 
                     { day: "Wednesday", start: "22:00", stop: "23:59" },
                     { day: "Friday", start: "09:00", stop: "17:00" },               
                     { day: "Saturday", start: "00:01", stop: "23:59" }                      
                     ]
                   }  
         },
         { upsert: true }
      ) 

      If the user does the existing way below, it will also continue to work and apply to every day of the week.

      db.settings.updateOne(
         { _id: "balancer" },
         { $set: { activeWindow : { start : "<start-time>", stop : "<stop-time>" } } },
         { upsert: true }
      ) 

            Assignee:
            Unassigned Unassigned
            Reporter:
            garaudy.etienne@mongodb.com Garaudy Etienne
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: