-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fail QueryWorkflow if last workflow task failed #4099
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
Fail QueryWorkflow if last workflow task failed #4099
Conversation
4e9acc3 to
61c0227
Compare
| }) | ||
|
|
||
| if err != nil { | ||
| s.Logger.Fatal("SetQueryHandler failed: " + err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Fatel may exit the process or fail the test?
| if mutableState.GetExecutionInfo().WorkflowTaskAttempt > 1 { | ||
| // while workflow task is failing, the query to that workflow will also fail. Failing fast here to prevent wasting | ||
| // resources to load history for a query that will fail. | ||
| return nil, serviceerror.NewFailedPrecondition("Query has failed due to a failing workflow task") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot query workflow due to Workflow Task in failed state.
| s.True(workflowRun.GetRunID() != "") | ||
|
|
||
| // wait for workflow to fail | ||
| time.Sleep(time.Second * 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: do we have to wait for 5 sec? seems a bit long. I think workflow task attempt will be larger than 1 as soon as the first workflow task is failed.
yycptt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need this fix for 1.20.1 patch release.
* Fail QueryWorkflow if last WorkflowTask failed * fix linter issues * pr comments --------- Co-authored-by: Saman Barghi <[email protected]> Co-authored-by: Yichao Yang <[email protected]>
* Fail QueryWorkflow if last WorkflowTask failed * fix linter issues * pr comments --------- Co-authored-by: Saman Barghi <[email protected]> Co-authored-by: Yichao Yang <[email protected]>
What changed?
Fail fast for query if the last workflow task has failed.
Why?
While workflow task is in failing state (due to non-deterministic error etc), the query to those workflow will fail anyway, and deliver query to the workflow will only waste resources to load history.
We should fail fast for query if we know the workflow task would fail.
How did you test it?
New functional test.
Potential risks
No risks.
Is hotfix candidate?
No.