-
Notifications
You must be signed in to change notification settings - Fork 801
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
Create TTL in the UpdateWorkflowExecution cycles. #5243
Conversation
|
||
time.Sleep(65) | ||
|
||
_, err = s.GetWorkflowExecutionInfo(ctx, domainID, workflowExecution) |
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 a not-found
error should be expected.
d7484c8
to
8291df6
Compare
//default TTL Value. 0 TTL means no ttl is set, hence your records will persist forever unless explicitly deleted. | ||
ttlInSeconds := 0 | ||
//Only fires when the workflow is closing. | ||
if execution.CloseStatus == 1 { |
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.
this condition doesn't cover all closed workflows https://github.com/uber/cadence/blob/714aec48796b62af163e9d324462a1cc2afb4981/common/persistence/dataManagerInterfaces.go#L129C5-L129C5
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 you should check state == WorkflowStateCompleted
instead
WorkflowStateCompleted |
This reverts commit bc8bebe.
What changed?
Adding TTL to the CreateWorkflowRequest is not enough because it gets overwritten by the 'UpdateWorkflowRequest' and the final value of the TTL is persisted.
So we reimplemented the code and added TTL into the UpdateworkflowRequest instead.
Supporting document:
https://docs.google.com/document/d/14Bn3W32DdJEP9dVi2MDTyGD0joUG8K_i4wCFEfFZJns/edit?usp=sharing
Why?
Calculate the TTL in the Update Workflow context and update the subsequent queries down the persistence layer. Adding TTL to the CreateWorkflowRequest is not enough because it gets overwritten by the 'UpdateWorkflowRequest' and the TTL is removed. Cassandra does not allow persistence of the TTL on its tables. If you perform an update without TTL then the TTL will be lost. In other words, we had to insert the TTL during the Workflow state update.
Moved the TTL to Workflow mutation
How did you test it?
Tested locally and unit tests.
Potential risks
We might experience data loss if the TTL value is not appropriate or if the TTL accidentally cause data deletion.
Release notes
NA
Documentation Changes
NA