Skip to content

[rgw][lc][rgw_lifecycle_work_time] adjust timing if the configured end time is less than the start time - #54622

Merged
cbodley merged 5 commits into
ceph:mainfrom
BBoozmen:oozmen_lc_work_time
Dec 8, 2023
Merged

cbodley merged 5 commits into
ceph:mainfrom
BBoozmen:oozmen_lc_work_time

Conversation

@BBoozmen

@BBoozmen BBoozmen commented Nov 22, 2023 •

Copy link
Copy Markdown
Contributor

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

Unittesting

[----------] 8 tests from LCWorkTimeTests
[ RUN      ] LCWorkTimeTests.ShouldWorkDefaultWorkTime
[       OK ] LCWorkTimeTests.ShouldWorkDefaultWorkTime (3 ms)
[ RUN      ] LCWorkTimeTests.ShouldWorkCustomWorkTimeEndTimeInTheSameDay
[       OK ] LCWorkTimeTests.ShouldWorkCustomWorkTimeEndTimeInTheSameDay (2 ms)
[ RUN      ] LCWorkTimeTests.ShouldWorkCustomWorkTimeEndTimeInTheSameDay24Hours
[       OK ] LCWorkTimeTests.ShouldWorkCustomWorkTimeEndTimeInTheSameDay24Hours (3 ms)
[ RUN      ] LCWorkTimeTests.ShouldWorkCustomWorkTimeEndTimeInTheNextDay
[       OK ] LCWorkTimeTests.ShouldWorkCustomWorkTimeEndTimeInTheNextDay (3 ms)
[ RUN      ] LCWorkTimeTests.ShouldWorkCustomWorkTimeEndTimeInTheNextDay24Hours
[       OK ] LCWorkTimeTests.ShouldWorkCustomWorkTimeEndTimeInTheNextDay24Hours (2 ms)
[ RUN      ] LCWorkTimeTests.ShouldWorkCustomWorkTimeEndTimeInTheNextDayIrregularMins
[       OK ] LCWorkTimeTests.ShouldWorkCustomWorkTimeEndTimeInTheNextDayIrregularMins (3 ms)
[ RUN      ] LCWorkTimeTests.ShouldWorkCustomWorkTimeStartEndSameHour
[       OK ] LCWorkTimeTests.ShouldWorkCustomWorkTimeStartEndSameHour (2 ms)
[ RUN      ] LCWorkTimeTests.ScheduleNextStartTime
[       OK ] LCWorkTimeTests.ScheduleNextStartTime (2 ms)
[----------] 8 tests from LCWorkTimeTests (21 ms total)

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@BBoozmen
BBoozmen requested a review from a team as a code owner November 22, 2023 22:03
@BBoozmen
BBoozmen force-pushed the oozmen_lc_work_time branch 2 times, most recently from 00a9bd1 to f8a7d22 Compare November 22, 2023 22:22

@mattbenjamin mattbenjamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wow, great work--one comment requesting some annotations in the test vectors

Comment thread src/rgw/rgw_lc.cc Resolved
Comment thread src/test/rgw/test_rgw_lc.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think I've seen this; ASSERT* yield an outputstream?

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.

Ahh yes, this is a nice little feature gtest has: https://github.com/google/googletest/blob/main/docs/reference/assertions.md. Assertion macros support streaming custom messages into them.
The nice thing is the custom message is printed only when assertion fails. For example, just changed a testcase to fail to see the custom output:

[ RUN      ] LCWorkTimeTests.ShouldWorkCustomWorkTimeStartEndSameHour
[       OK ] LCWorkTimeTests.ShouldWorkCustomWorkTimeStartEndSameHour (3 ms)
[ RUN      ] LCWorkTimeTests.ScheduleNextStartTime
../src/test/rgw/test_rgw_lc.cc:148: Failure
Expected equality of these values:
  wait_secs_till_next_start
    Which is: 75713
  expected_value
    Which is: 75700
work_started_at: 2023-01-01T22:15:05.000000-0500 work_completed_at: 2023-01-01T01:13:07.000000-0500 expected: 75700 wait_secs_till_next_start: 75713 work-time-window: 22:15-03:33

[  FAILED  ] LCWorkTimeTests.ScheduleNextStartTime (3 ms)
[----------] 8 tests from LCWorkTimeTests (22 ms total)

[----------] Global test environment tear-down
[==========] 11 tests from 3 test suites ran. (23 ms total)
[  PASSED  ] 10 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] LCWorkTimeTests.ScheduleNextStartTime

 1 FAILED TEST

Here, work_started_at: 2023-01-01T22:15:05.000000-0500 work_completed_at: 2023-01-01T01:13:07.000000-0500 expected: 75700 wait_secs_till_next_start: 75713 work-time-window: 22:15-03:33 is the custom log line streamed into assertion. The cases that pass hide this extra data.

Comment thread src/test/rgw/test_rgw_lc.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmm, this is sneaky; if it works...

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.

Indeed :) It works nicely with unittesting. I believe it gets the default values for options from the common shared lib. There's a couple of other existing tests that use this trick.

Comment thread src/test/rgw/test_rgw_lc.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

in all of the following, it would help to annotate the cases that used to fail and now don't

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.

Good point. In the new evidence, I moved the commit 2446c01 that introduces the unittests before the time-adjusment commit. Ran the tests and annotated the ones that fail with should have been true, expected to fail due to tracker issue #63613. Then, amended the commit that adds the time-adjustment fix(48e189f) such that it re-annotates the failed cases with // used-to-fail.

Please have a look.

…e 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 <[email protected]>
@cbodley

cbodley commented Dec 8, 2023

Copy link
Copy Markdown
Contributor

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.

3 participants