Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Scheduler Bugfix: getFutureActionTimes should ignore actions prior to update time, respect RemainingActions counter #6122

Merged

Conversation

lina-temporal
Copy link
Contributor

What changed/why?

In #6028/#5381, our scheduler's run loop accounted for update requests that occur between nominal and actual/jittered times. The run loop will correctly skip over action times who are scheduled prior to the schedule's update time (such as when a schedule is recalculated to a new spec). This PR updates getFutureActionTimes (used as part of the scheduler's describe and list operations) to account for action times preceding the update time, as well as to properly reflect the number of remaining actions in a schedule.

How did you test it?

  • Updated unit tests for both limited actions (TestLimitedActions) as well as filtered update times (TestUpdateNotRetroactive). TestUpdateNotRetroactive is the test that goes red when the parallel condition in the scheduler is commented out, so it seemed the appropriate place to also test getFutureActionTimes lines up with the fix in the run loop.
  • Verified both updated tests only pass when new version (AccurateFutureActionTimes) is set; verified no other tests break (make test-unit)

Potential risks

  • We break a use case that relied on speculative future action times/a constant number of action times returned

Documentation

N/A

Is hotfix candidate?

No

…prior to update time, respects RemainingActions counter
@lina-temporal lina-temporal requested a review from a team as a code owner June 12, 2024 23:32
Copy link
Member

@dnr dnr left a comment

Choose a reason for hiding this comment

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

Could you add a couple describe calls in TestUpdateBetweenNominalAndJitter also, since that's the most tricky case?

Copy link
Member

@dnr dnr left a comment

Choose a reason for hiding this comment

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

Could you add a couple describe calls in TestUpdateBetweenNominalAndJitter also, since that's the most tricky case?

Nevermind, I see that's doing a different thing

@lina-temporal lina-temporal merged commit f24f031 into temporalio:main Jun 14, 2024
42 checks passed
@lina-temporal lina-temporal deleted the sched_future_actions_accuracy branch June 14, 2024 17:48
stephanos pushed a commit that referenced this pull request Jun 14, 2024
… update time, respect RemainingActions counter (#6122)

## What changed/why?
In #6028/#5381, our scheduler's run loop accounted for update requests
that occur between nominal and actual/jittered times. The run loop will
correctly skip over action times who are scheduled prior to the
schedule's update time (such as when a schedule is recalculated to a new
spec). This PR updates `getFutureActionTimes` (used as part of the
scheduler's describe and list operations) to account for action times
preceding the update time, as well as to properly reflect the number of
remaining actions in a schedule.

## How did you test it?
- Updated unit tests for both limited actions (`TestLimitedActions`) as
well as filtered update times (`TestUpdateNotRetroactive`).
`TestUpdateNotRetroactive` is the test that goes red when the [parallel
condition in the
scheduler](https://github.com/temporalio/temporal/blob/44a6fe777e1dc950dd278cb1b7f6ffc8b3ba4328/service/worker/scheduler/workflow.go#L655-L660)
is commented out, so it seemed the appropriate place to also test
`getFutureActionTimes` lines up with the fix in the run loop.
- Verified both updated tests only pass when new version
(`AccurateFutureActionTimes`) is set; verified no other tests break
(`make test-unit`)

## Potential risks
- We break a use case that relied on speculative future action times/a
constant number of action times returned

## Documentation
N/A

## Is hotfix candidate?
No
ychebotarev pushed a commit that referenced this pull request Jun 25, 2024
… update time, respect RemainingActions counter (#6122)

## What changed/why?
In #6028/#5381, our scheduler's run loop accounted for update requests
that occur between nominal and actual/jittered times. The run loop will
correctly skip over action times who are scheduled prior to the
schedule's update time (such as when a schedule is recalculated to a new
spec). This PR updates `getFutureActionTimes` (used as part of the
scheduler's describe and list operations) to account for action times
preceding the update time, as well as to properly reflect the number of
remaining actions in a schedule.

## How did you test it?
- Updated unit tests for both limited actions (`TestLimitedActions`) as
well as filtered update times (`TestUpdateNotRetroactive`).
`TestUpdateNotRetroactive` is the test that goes red when the [parallel
condition in the
scheduler](https://github.com/temporalio/temporal/blob/44a6fe777e1dc950dd278cb1b7f6ffc8b3ba4328/service/worker/scheduler/workflow.go#L655-L660)
is commented out, so it seemed the appropriate place to also test
`getFutureActionTimes` lines up with the fix in the run loop.
- Verified both updated tests only pass when new version
(`AccurateFutureActionTimes`) is set; verified no other tests break
(`make test-unit`)

## Potential risks
- We break a use case that relied on speculative future action times/a
constant number of action times returned

## Documentation
N/A

## Is hotfix candidate?
No
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants