Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add speculative workflow task #3768

Merged
merged 2 commits into from
Jan 6, 2023

Conversation

alexshtin
Copy link
Member

@alexshtin alexshtin commented Dec 30, 2022

What changed?
Add speculative workflow task.

Why?
Speculative workflow task is similar to transient but it can be created even for the first attempt. Speculative workflow task is designed to be not persisted in database. It doesn't have timeouts and retries. It will be used to transport workflow updates to the worker.

How did you test it?
Manually for now. Automated tests will be added with workflow update feature.

Potential risks
No risks.

Is hotfix candidate?
No.

@alexshtin alexshtin requested a review from a team as a code owner December 30, 2022 02:12
google.protobuf.Timestamp workflow_task_original_scheduled_time = 30 [(gogoproto.stdtime) = true];
string workflow_task_request_id = 31;
bool workflow_task_speculative = 68;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we be better served with an enum here? We could include normal and transient WFT types as well as others in the future?

Disable speculative WT restoration
@@ -465,7 +477,7 @@ func (m *workflowTaskStateMachine) AddWorkflowTaskCompletedEvent(

// Capture if WorkflowTaskScheduled and WorkflowTaskStarted events were created
// before calling m.beforeAddWorkflowTaskCompletedEvent() because it will delete workflow task info from mutable state.
workflowTaskScheduledStartedEventsCreated := !m.ms.IsTransientWorkflowTask()
workflowTaskScheduledStartedEventsCreated := !m.ms.IsTransientWorkflowTask() && workflowTask.Type != enumsspb.WORKFLOW_TASK_TYPE_SPECULATIVE
Copy link
Contributor

Choose a reason for hiding this comment

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

Not necessary for this PR but this might be a good thing to encapsulate into executionInfo

@alexshtin alexshtin merged commit e91760f into temporalio:master Jan 6, 2023
@alexshtin alexshtin deleted the feature/speculative-wt branch January 6, 2023 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants