]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
rgw/lc: adjust timing if the configured end work-time is less than the start-time
authorOguzhan Ozmen <oozmen@bloomberg.net>
Wed, 22 Nov 2023 20:37:00 +0000 (15:37 -0500)
committerMykola Golub <mgolub@suse.com>
Mon, 11 Dec 2023 16:59:12 +0000 (18:59 +0200)
commit0dda6d05df5f631cd2cdbb78363afa7b010d7779
treeb4b634c4e30e30ec800bbe6341e1b7841bfcd338
parent46d0b431ed45818ba96543cb84c998ab66c6f450
rgw/lc: adjust timing if the configured end work-time is less than the start-time

LC work time is given in the form of "HH:MM-HH:MM"; the first part
represents the "start_time" and the next "end_time". "should_work"
function decides, given the current time, whether the LC worker can resume.
It essentially checks whether the current time is within start and end times.

Since there's no "date" (month/day/year) notion taken into account, a work time
whose end_time (i.e., hour field) is less than start_time is not properly
handled by "should_work". For example, "14:00-13:59" would normally mean to
start LC processing at 2PM local time and allowing it to run for 24 hours. So,
given such a work time range, "should_work" must return true for any given
current_time. However, without this adjustment, it always returns false.

The fix simply adds a "next day" adjustment if the end_time is
configured to be less than the configured start_time.

Fixes https://tracker.ceph.com/issues/63613

Signed-off-by: Oguzhan Ozmen <oozmen@bloomberg.net>
(cherry picked from commit 48e189fe0ec6c0ace23ddaed09ef3f936e8c2a6f)
src/rgw/rgw_lc.cc
src/test/rgw/test_rgw_lc.cc