[SERVER-82487] Balancing Window Per Day of the week Created: 27/Oct/23  Updated: 14/Dec/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Garaudy Etienne Assignee: Backlog - Catalog and Routing
Resolution: Unresolved Votes: 0
Labels: balancer, car-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-82486 Balancing Window Per Day of the week Closed
Assigned Teams:
Catalog and Routing
Participants:
Story Points: 3

 Description   

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 }
) 



 Comments   
Comment by Tommaso Tocci [ 01/Dec/23 ]

Setting back this ticket for triage so that someone can take over garaudy.etienne@mongodb.com POC.

Generated at Thu Feb 08 06:49:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.