-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use more reliable workflow mutation check #4076
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
Use more reliable workflow mutation check #4076
Conversation
| } | ||
|
|
||
| func (ms *MutableStateImpl) canReplicateEvents() bool { | ||
| return ms.namespaceEntry.ReplicationPolicy() == namespace.ReplicationPolicyMultiCluster |
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 assumption is broken
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.
Can we just reuse this one
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.
what is the difference?
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 the name canReplicateEvents make sense as it return a boolean. But it is up to you.
| ) error { | ||
|
|
||
| if transactionPolicy == TransactionPolicyPassive || | ||
| !ms.canReplicateEvents() { |
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 line is the real change
| } | ||
|
|
||
| return ms.taskGenerator.GenerateUserTimerTasks() | ||
| func (ms *MutableStateImpl) generateReplicationTask() bool { |
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 is the same as canReplicateEvents method.
| case TransactionPolicyPassive: | ||
| return nil | ||
| default: | ||
| panic(fmt.Sprintf("unknown transaction policy: %v", transactionPolicy)) |
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.
return an internal 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.
it is better to fail fast here, e.g. panic
i would consider return error when
- input validation fails
- modifying a complicated component & do not want to break production
there are only 2 policies here, no safety concern
| } | ||
|
|
||
| func (ms *MutableStateImpl) canReplicateEvents() bool { | ||
| return ms.namespaceEntry.ReplicationPolicy() == namespace.ReplicationPolicyMultiCluster |
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.
Can we just reuse this one
* Make workflow mutation check more reliable Namespace migration breaks one of the assumption of XDC XDC assumes there will be no case which a namespace has only one cluster & the cluster is not itself, apparently namespace migration can break this assumption
* Make workflow mutation check more reliable Namespace migration breaks one of the assumption of XDC XDC assumes there will be no case which a namespace has only one cluster & the cluster is not itself, apparently namespace migration can break this assumption
* Make workflow mutation check more reliable Namespace migration breaks one of the assumption of XDC XDC assumes there will be no case which a namespace has only one cluster & the cluster is not itself, apparently namespace migration can break this assumption
* Make workflow mutation check more reliable Namespace migration breaks one of the assumption of XDC XDC assumes there will be no case which a namespace has only one cluster & the cluster is not itself, apparently namespace migration can break this assumption
What changed?
Why?
Namespace migration breaks one of the assumption of XDC
XDC assumes there will be no case which a namespace has only one cluster & the cluster is not itself, apparently namespace migration can break this assumption
How did you test it?
N/A
Potential risks
N/A
Is hotfix candidate?
N/A