Repository navigation
implement time skipping for schedule v2 - #12197
feiyang3cat wants to merge 8 commits into
Conversation
502c84d to
2ce1494
Compare
4ff7f75 to
4af3bb1
Compare
35c5a98 to
5dd3dce
Compare
13e0234 to
484ad7d
Compare
4a85881 to
960c2f6
Compare
960c2f6 to
4ba3f46
Compare
| @@ -349,6 +351,34 @@ func (s *Scheduler) LifecycleState(ctx chasm.Context) chasm.LifecycleState { | |||
| return chasm.LifecycleStateRunning | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
for reviewers: to decide whether the current schedule is at state that allow time skipping, and this function is called at close transaction time
4ba3f46 to
e968ef7
Compare
| if !config.GetEnabled() { | ||
| return nil | ||
| } | ||
| if schedule.GetPolicies().GetOverlapPolicy() == enumspb.SCHEDULE_OVERLAP_POLICY_ALLOW_ALL { |
There was a problem hiding this comment.
for reviewers: newly added
a617e9f to
beac176
Compare
| ErrSentinel = serviceerror.NewNotFound("schedule is a sentinel") | ||
| ErrSentinelBlocked = serviceerror.NewUnavailable("schedule is a sentinel; please retry after sentinel expires") | ||
| ErrMigrationPending = serviceerror.NewUnavailable("schedule has a pending migration to workflow; please retry later") | ||
| ErrTimeSkippingMigration = serviceerror.NewFailedPrecondition("schedule with time skipping cannot migrate to workflow-backed scheduler") |
There was a problem hiding this comment.
for reviewers: could you help confirm if returning this error type is safe to block migration for this chedule
09ee31f to
a740006
Compare
| // validateTimeSkippingStatePropagation keeps propagation state internal-only while CHASM Schedules | ||
| // start Workflows through Frontend. | ||
| // TODO: Delete this function once they start Workflows directly from History. | ||
| func validateTimeSkippingStatePropagation( |
| return nil | ||
| } | ||
|
|
||
| func (wh *WorkflowHandler) validateAndPopulateWorkflowTimeSkippingConfig( |
There was a problem hiding this comment.
split previous validator to one for wf and one for schedule
a740006 to
8b7ec2b
Compare
8b7ec2b to
e6e8b8a
Compare
|
|
||
| // Record time taken from action eligible to workflow started. | ||
| if !start.Manual { | ||
| desiredTime := cmp.Or(start.DesiredTime, start.ActualTime) |
There was a problem hiding this comment.
check the todo comment in chasm/lib/scheduler/invoker.go
| idx := slices.IndexFunc(i.BufferedStarts, func(start *schedulespb.BufferedStart) bool { | ||
| return start.Attempt == 0 | ||
| }) | ||
| // TODO(time-skipping): The completed workflow and its schedule use independent virtual clocks, so |
There was a problem hiding this comment.
related to chasm/lib/scheduler/invoker_tasks.go L759
it seems we can choose to change this time to ctx.Now() but even if we don't change it will be a rare issue and only impacts metrics
and this is the only time schedule reads directly from workflows
What changed?
How did you test it?
need to merge the API first and change dependance to main temporalio/api#856