[Scheduler] CountSchedules implementation for V1 and V2#9046
[Scheduler] CountSchedules implementation for V1 and V2#9046lina-temporal merged 8 commits intomainfrom
Conversation
| func (wh *WorkflowHandler) CountSchedules( | ||
| ctx context.Context, | ||
| request *workflowservice.CountSchedulesRequest, | ||
| ) (_ *workflowservice.CountSchedulesResponse, retError error) { |
There was a problem hiding this comment.
What is the purpose of including the underscore here?
There was a problem hiding this comment.
It's because you need to name both arguments if you name one of them, and yet I never assign to the first return argument, so instead it is bound to "unused"/_.
service/frontend/workflow_handler.go
Outdated
| if wh.chasmSchedulerEnabled(ctx, namespaceName.String()) { | ||
| return wh.countSchedulesChasm(ctx, namespaceID, namespaceName, query) | ||
| } | ||
| return wh.countSchedulesWorkflow(ctx, namespaceID, namespaceName, query) |
There was a problem hiding this comment.
We are doing a pretty gradual rollout so there might be a significant amount of time where there is schedulers leftover on v1 stack. Once the flag is flipped for the namespace the count drops to 0 and increases as new schedules are created. Some time later, it increases as schedules wake up....
There was a problem hiding this comment.
The query itself we select with handles this case - VisibilityListQueryChasm will return results from both V1 and V2 scheduler, that'll apply to Count, as well.
I'll update the ListV1andV2 functional test to show this.
**What changed?** - Added a new CountSchedules API, symmetric to the other Count* operations. **Why?** - Although it isn't documented as public API, the temporal UI makes use of `ListWorkflowExecutions` to display the total count of schedules. This operation will not return data for CHASM-based schedules. Therefore, I'm introducing a public CountSchedules operation that the UI (and customers) can make use of. **Breaking changes** - The technique of using `ListWorkflowExecutions` to query schedules was always unsupported, so we aren't interested in supporting it for CHASM schedules. - `CountSchedules` will be implemented for both V1 and V2 schedules. **Server**: - [Server implementation PR](temporalio/temporal#9046)
**What changed?** - Added a new CountSchedules API, symmetric to the other Count* operations. **Why?** - Although it isn't documented as public API, the temporal UI makes use of `ListWorkflowExecutions` to display the total count of schedules. This operation will not return data for CHASM-based schedules. Therefore, I'm introducing a public CountSchedules operation that the UI (and customers) can make use of. **Breaking changes** - The technique of using `ListWorkflowExecutions` to query schedules was always unsupported, so we aren't interested in supporting it for CHASM schedules. - `CountSchedules` will be implemented for both V1 and V2 schedules. **Server**: - [Server implementation PR](temporalio/temporal#9046)
The CountSchedules API was added to the workflowservice but was missing from the API metadata map and related test fixtures, causing unit test failures.
Add Eventually helpers around query-filtered CountSchedules assertions to handle potential visibility indexing latency on Cassandra+ES backends.
What changed?
CountSchedulesAPI for both CHASM and V1 scheduler.Why?
ListWorkflowExecutionscall to get a total count of schedules. This will allow us to move it to a public API in advance of CHASM release, which will continue to work for both V1 and V2.How did you test it?
Potential risks