[Scheduler] Add a new flag to allow only migration of schedules without running workflows - #10505
Conversation
…ut running workflows
| if s.tweakables.EnableCHASMMigration { | ||
| s.State.PendingMigration = true | ||
| } | ||
| if s.State.PendingMigration { | ||
| if s.State.PendingMigration && | ||
| (s.tweakables.MigrateWithRunningWorkflows || len(s.Info.RunningWorkflows) == 0) && | ||
| // re-check that EnableCHASMMigration is still true for the namespace's config | ||
| s.tweakables.EnableCHASMMigration { |
There was a problem hiding this comment.
if !s.State.PendingMigration && s.tweakables.EnableCHASMMigration &&
(s.tweakables.MigrateWithRunningWorkflows || len(s.Info.RunningWorkflows) {
s.State.PendingMigration = true
}
if s.State.PendingMigration {
err := s.executeMigration()
...
}
what do you thin about this?
There was a problem hiding this comment.
What about plumbing all these conditionals into the activity, so that we don't have to worry about nondeterminitism?
There was a problem hiding this comment.
Changes to all of these variables are deterministic because we read them through MutableSideEffect (tweakables), or Signal into the workflow.
this suggested change is mostly to prevent changes in behavior given the same input and simplify it (at least in my head)
There was a problem hiding this comment.
it would also still support migrations via signal.
There was a problem hiding this comment.
My thought about doing the eval in the activity is that it allows for instantaneous update, rather than capturing a side-effect in history earlier, which then must be honoured, irrespective of dynamic config's current state. Ie, it'd allow for a faster response time if DC changed value.
But re the logic, I'm not sure I understand it, to Alex's point, I'm not sure why EnableCHASMMigration is being evaluated on line 337 and 331?
There was a problem hiding this comment.
why EnableCHASMMigration is being evaluated on line 337 and 331?
it would allow the migration flag going from true to false to to halt the migration of a schedule that is already in progress.
I'm happy with the changes @lina-temporal just pushed.
re using an activity: I'd rather read through a mutable side effect because it's an existing pattern in this workflow and we've test it quite extensively already.
Backports a series of scheduler changes onto `cloud/v1.32.0-157`. Cherry-picked in chronological order from `main` (applied cleanly as a stack; no conflicts when ordered correctly). ### Commits (oldest → newest) | Upstream PR | Description | |---|---| | #10348 | Add percentage-based dialup for creation and migration | | #10439 | Adds scheduleIdleCloseTime | | #10517 | Plumb Tweakables through Scheduler's CHASM context values, use in EventLog | | #10369 | Rework and instrument CHASM scheduler tasks, add coverage | | #10530 | Log decisions and task events via the EventLog | | #10505 | Add a flag to allow only migration of schedules without running workflows | | #10406 | Adding scanner for invariants for schedules v2 | | #10503 | Add scheduler observability metrics for missed actions | Note: #10390 (next-action-time) was already present on the target branch and is omitted. Builds clean (`go build` over affected packages). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Lina Jodoin <lina.jodoin@temporal.io> Co-authored-by: Alex Stanfield <13949480+chaptersix@users.noreply.github.com> Co-authored-by: Sean Kane <spkane31@gmail.com>
…ut running workflows (#10505) ## What changed? - Added a new dynamic config flag to control whether V1 schedules will migrate with running workflows. ## Why? - When V1 schedules migrate to V2 with running workflows, V2 attaches a completion callback to the running workflow (as V2 exclusively uses Nexus completion callbacks to monitor workflow status). Certain third-party SDKs are known to have issues with one of the events written to the history of the running workflow, which can cause them to panic (Coinbase SDK). This allows us to dial up migration for these customers without triggering that edge case. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [x] added new functional test(s) ## Potential risks - Slower migration cadence, potentially
…ut running workflows (temporalio#10505) ## What changed? - Added a new dynamic config flag to control whether V1 schedules will migrate with running workflows. ## Why? - When V1 schedules migrate to V2 with running workflows, V2 attaches a completion callback to the running workflow (as V2 exclusively uses Nexus completion callbacks to monitor workflow status). Certain third-party SDKs are known to have issues with one of the events written to the history of the running workflow, which can cause them to panic (Coinbase SDK). This allows us to dial up migration for these customers without triggering that edge case. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [x] added new functional test(s) ## Potential risks - Slower migration cadence, potentially
…ut running workflows (#10505) ## What changed? - Added a new dynamic config flag to control whether V1 schedules will migrate with running workflows. ## Why? - When V1 schedules migrate to V2 with running workflows, V2 attaches a completion callback to the running workflow (as V2 exclusively uses Nexus completion callbacks to monitor workflow status). Certain third-party SDKs are known to have issues with one of the events written to the history of the running workflow, which can cause them to panic (Coinbase SDK). This allows us to dial up migration for these customers without triggering that edge case. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [x] added new functional test(s) ## Potential risks - Slower migration cadence, potentially
What changed?
Why?
How did you test it?
Potential risks