Skip to content

rgw/lc: enforce consistent rgw_lc_debug_interval start times - #65585

Merged
cbodley merged 2 commits into
ceph:mainfrom
cbodley:wip-rgw-lc-bucket-already-run-today
Oct 17, 2025
Merged

cbodley merged 2 commits into
ceph:mainfrom
cbodley:wip-rgw-lc-bucket-already-run-today

Conversation

@cbodley

@cbodley cbodley commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

first draft of a fix for https://tracker.ceph.com/issues/72943 to start discussion

already_run_today() is problematic when rgw_lc_debug_interval is configured:

    if (now - start_date < cct->_conf->rgw_lc_debug_interval)
      return true;

lifecycle should process every bucket once per interval. but if a bucket is processed late in one interval and early in the next interval, the bucket will be skipped because the distance between now - start_date is less than the interval

t=0              t=10
|----interval----|----interval----|
         [bucket] [bucket]
         |--diff--|

this should instead compare start_date against the beginning of the current interval

with rgw_lc_debug_interval configured, each LCWorker is calling RGWLC::process() once every debug interval, but different workers (especially across radosgw instances) may be starting each interval at arbitrary times

so "the beginning of the current interval" is not defined across workers, but we could attempt to make it so with changes to LCWorker::should_work() and schedule_next_start_time(). Dan's suggestion was to fix an interval at midnight and make other start times relative to that

already_run_today() is confusing in the non-debug case too, but i'm scared to touch that without test coverage

Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

we're not checking the return value of sscanf(), which says how many of
the expected values it successfully parsed. given an invalid
rgw_lifecycle_work_time string, any unparsed values would remain
uninitialized - so preinitialize them with reasonable defaults

Signed-off-by: Casey Bodley <[email protected]>
@github-actions github-actions Bot added the rgw label Sep 18, 2025
@dang

dang commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

So, my thought is that we can make the debug lifecycle testing somewhat more similar to the real lifecycle runs by defining intervals w.r.t. midnight. Since the normal runs start at midnight, and have an interval of 24 hours, we can define test runs as starting at midnight, and running for a debug interval, and then starting a new cycle immediately. This allows us to define cycles only with math, and not not with timestamps, and to be able to tell if a given timestamp is within the current interval. Hopefully, this allows us to be consistent across workers, and to be closer to the real lifecycle, and possibly to test runs that last across more than one cycle. We can also do the same math in the test scripts, and hopefully be more precise than "wait several intervals".

@cbodley
cbodley force-pushed the wip-rgw-lc-bucket-already-run-today branch from 105eefd to fa0d86b Compare September 18, 2025 18:06
@cbodley

cbodley commented Sep 18, 2025

Copy link
Copy Markdown
Contributor Author

Since the normal runs start at midnight, and have an interval of 24 hours, we can define test runs as starting at midnight, and running for a debug interval, and then starting a new cycle immediately.

while this makes sense, i found it simpler to make the intervals relative to the 1970 epoch for seconds % interval

@cbodley
cbodley force-pushed the wip-rgw-lc-bucket-already-run-today branch from fa0d86b to a30fb4c Compare September 18, 2025 18:30
@cbodley cbodley changed the title rgw/lc: replace already_run_today() with comparison against start of RGWLC::process() rgw/lc: enforce consistent rgw_lc_debug_interval start times Sep 18, 2025
@cbodley
cbodley marked this pull request as ready for review September 18, 2025 18:33
@cbodley
cbodley requested a review from a team as a code owner September 18, 2025 18:33
@cbodley

cbodley commented Sep 19, 2025

Copy link
Copy Markdown
Contributor Author

in testing with -m lifecycle_expiration, all but one of the tests are passing:

FAILED s3tests_boto3/functional/test_s3.py::test_lifecycle_deletemarker_expiration_with_days_tag - assert 0 == 1

@dang

dang commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

while this makes sense, i found it simpler to make the intervals relative to the 1970 epoch for seconds % interval

This makes sense, and works just as well (since the epoch is midnight anyway).

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 <[email protected]>
@cbodley
cbodley force-pushed the wip-rgw-lc-bucket-already-run-today branch from 2fe1ed9 to e2b43be Compare September 24, 2025 19:02
Comment thread src/rgw/rgw_lc.cc
Comment on lines +2647 to +2648
const auto remainder = now.sec() % interval;
secs = interval - remainder;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my first attempt was closer to the existing logic:

-	secs = start + cct->_conf->rgw_lc_debug_interval - now;
+	const auto remainder = start.sec() % interval;
+	secs = start - remainder + interval - now;

but returned secs = 0 for the vast majority of calls, sending LCWorker into a tight loop with no sleeps

it now ignores start, instead returning seconds until the next interval after now

@cbodley

cbodley commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@cbodley

cbodley commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

1 similar comment
@cbodley

cbodley commented Oct 16, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@cbodley

cbodley commented Oct 16, 2025

Copy link
Copy Markdown
Contributor Author

the last few arm64 checks took over 4 hours, and got all the way to 318/319 before failing without a reason:

316/319 Test #293: unittest-fltree-onode-manager .............   Passed  3504.01 sec
317/319 Test #280: unittest-transaction-manager ..............   Passed  4925.59 sec
318/319 Test #166: readable.sh ...............................   Passed  6909.33 sec
Build step 'Execute shell' marked build as failure
[Cobertura] Skipping Cobertura coverage report as build was not SUCCESS or better ...

[PostBuildScript] - [INFO] Executing post build scripts.
[PostBuildScript] - [INFO] Build does not have any of the results [ABORTED]. Did not execute build step #0.
INFO: Processing CTest-Version 3.x (default)
INFO: [CTest-Version 3.x (default)] - No test report file(s) were found with the pattern 'build/Testing/**/Test.xml' relative to '/home/jenkins-build/build/workspace/ceph-pull-requests-arm64' for the testing framework 'CTest-Version 3.x (default)'.
Did you enter a pattern relative to (and within) the workspace directory?
Did you generate the result report(s) for 'CTest-Version 3.x (default)'?"
WARNING: All test reports are empty.
INFO: Check 'Failed Tests' threshold.
[Checks API] No suitable checks publisher found.
INFO: Setting the build status to SUCCESS
[Checks API] No suitable checks publisher found.
Setting status of e2b43be0f9f4aa2e2e1a14c73353cbee2cecf6ff to FAILURE with url https://jenkins.ceph.com/job/ceph-pull-requests-arm64/82285/ and message: 'make check failed
 '
Using context: make check (arm64)
Finished: FAILURE

from https://jenkins.ceph.com/job/ceph-pull-requests-arm64/82285/console

@cbodley

cbodley commented Oct 16, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@cbodley

cbodley commented Oct 16, 2025

Copy link
Copy Markdown
Contributor Author

The following tests FAILED:
250 - unittest_rgw_amqp (Failed)

@cbodley

cbodley commented Oct 16, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

1 similar comment
@cbodley

cbodley commented Oct 17, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@cbodley
cbodley merged commit 821cbd8 into ceph:main Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants