From: Casey Bodley Date: Thu, 18 Sep 2025 18:00:05 +0000 (-0400) Subject: rgw/lc: enforce consistent rgw_lc_debug_interval start times X-Git-Tag: testing/wip-vshankar-testing-20251027.053005-debug~47^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e2b43be0f9f4aa2e2e1a14c73353cbee2cecf6ff;p=ceph-ci.git rgw/lc: enforce consistent rgw_lc_debug_interval start times when configured, rgw_lc_debug_interval causes lifecycle processing to run every interval. but different workers/radosgws could start these intervals at different times, making it difficult for already_run_today() to determine which buckets should be skipped in the current interval schedule_next_start_time() now chooses start times (in seconds since epoch) that are divisible by the rgw_lc_debug_interval to ensure that all workers use the same intervals already_run_today() uses this same logic to calculate the beginning of its current interval for comparison with the last time the bucket's processing started Fixes: https://tracker.ceph.com/issues/72943 Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 8981c26dc81..b335e4758f5 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -2250,11 +2250,11 @@ static inline bool already_run_today(CephContext* cct, time_t start_date) utime_t now = ceph_clock_now(); localtime_r(&start_date, &bdt); - if (cct->_conf->rgw_lc_debug_interval > 0) { - if (now - start_date < cct->_conf->rgw_lc_debug_interval) - return true; - else - return false; + if (const auto interval = cct->_conf->rgw_lc_debug_interval; interval > 0) { + // compare start_date against the beginning of the current interval + const auto remainder = now.sec() % interval; + const time_t interval_start = now.sec() - remainder; + return start_date >= interval_start; } bdt.tm_hour = 0; @@ -2642,8 +2642,10 @@ int RGWLC::LCWorker::schedule_next_start_time(utime_t &start, utime_t& now) { int secs; - if (cct->_conf->rgw_lc_debug_interval > 0) { - secs = start + cct->_conf->rgw_lc_debug_interval - now; + if (const auto interval = cct->_conf->rgw_lc_debug_interval; interval > 0) { + // schedule for the next interval + const auto remainder = now.sec() % interval; + secs = interval - remainder; if (secs < 0) secs = 0; return (secs);