Skip to content

mgr/snap_schedule: do not assume wall clock does not tick - #69918

Merged
tchaikov merged 2 commits into
ceph:mainfrom
tchaikov:wip-panta-rhei
Aug 27, 2026
Merged

tchaikov merged 2 commits into
ceph:mainfrom
tchaikov:wip-panta-rhei

Conversation

@tchaikov

@tchaikov tchaikov commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

previously, we assumed that the test ran so fast, that wall clock did not tick between when we noted down a time and compare the timestamp. but this does not hold, as wall clock does tick, and we are not always that lucky.

in this series we stop comparing two independently-read timestamps field by field, since a clock boundary crossing between the two reads breaks the comparison even though both readings are correct.

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

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

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

@github-actions github-actions Bot added the pybind label Jul 2, 2026
@tchaikov
tchaikov requested a review from a team July 2, 2026 13:39
@tchaikov tchaikov added the tests label Jul 2, 2026
@tchaikov

tchaikov commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@tchaikov

Copy link
Copy Markdown
Contributor Author

@ceph/cephfs hello maintainers, could you help review this change?

@vshankar vshankar added the cephfs Ceph File System label Aug 10, 2026

@vshankar vshankar 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.

Minor nit, otherwise LGTM.

@vshankar

Copy link
Copy Markdown
Contributor

@tchaikov - also looks a change that should be backported (need tracker).

test_created_now takes two independent datetime.now() readings, one
inside Schedule.__init__ when the simple_schedule fixture is built, one
in the test body, then compares minute/hour/day/month/year across them.
Any clock boundary crossing between the two reads makes them legitimately
differ:

    >       assert simple_schedule.created.minute == now.minute
    E       assert 13 == 14
    E        +  where 13 = datetime.datetime(2026, 7, 2, 11, 13, 59, 998283).minute
    E        +    where datetime.datetime(2026, 7, 2, 11, 14, 0, 15569).minute

Compare a time delta instead: the test only cares whether created is
approximately now, not whether two nearby clock reads happen to agree
field by field. tzinfo stays a plain equality check, it doesn't drift
between two nearby reads.

Signed-off-by: Kefu Chai <[email protected]>
Same root cause as the previous commit's test_created_now fix: start and
created come from two separate datetime.now() calls in
Schedule.__init__ (schedule.py:111 and :119), and the test compared
start's day/month/year against a third, freshly read now() in the test
body. A UTC midnight rollover between any of those reads legitimately
breaks the comparison. Rarer than test_created_now's minute-boundary
race and hasn't actually been reported, but the same bug.

Compare against created's date instead: created and start are set
microseconds apart in the same __init__ call, about as tight a window as
we can get without giving Schedule an injectable clock.

Fixes: https://tracker.ceph.com/issues/79957
Signed-off-by: Kefu Chai <[email protected]>
@tchaikov

Copy link
Copy Markdown
Contributor Author

@tchaikov - also looks a change that should be backported (need tracker).

created https://tracker.ceph.com/issues/79957 .

@tchaikov
tchaikov merged commit 80fe425 into ceph:main Aug 27, 2026
9 checks passed
@tchaikov
tchaikov deleted the wip-panta-rhei branch August 27, 2026 07:46
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