Skip to content

Conversation

@wxing1292
Copy link
Contributor

What changed?

  • Make workflow mutation check more reliable

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

}

func (ms *MutableStateImpl) canReplicateEvents() bool {
return ms.namespaceEntry.ReplicationPolicy() == namespace.ReplicationPolicyMultiCluster
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this assumption is broken

Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what is the difference?

Copy link
Contributor

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() {
Copy link
Contributor Author

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

@wxing1292 wxing1292 marked this pull request as ready for review March 22, 2023 00:29
@wxing1292 wxing1292 requested a review from a team as a code owner March 22, 2023 00:29
}

return ms.taskGenerator.GenerateUserTimerTasks()
func (ms *MutableStateImpl) generateReplicationTask() bool {
Copy link
Contributor

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))
Copy link
Contributor

Choose a reason for hiding this comment

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

return an internal error?

Copy link
Contributor Author

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
Copy link
Contributor

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

@wxing1292 wxing1292 enabled auto-merge (squash) March 22, 2023 18:41
@wxing1292 wxing1292 merged commit 22522bf into temporalio:master Mar 22, 2023
@wxing1292 wxing1292 deleted the reliable-version-check branch March 22, 2023 19:14
hehaifengcn pushed a commit that referenced this pull request Mar 22, 2023
* 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
wxing1292 added a commit that referenced this pull request Mar 22, 2023
* 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
yycptt pushed a commit that referenced this pull request Mar 24, 2023
* 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
wxing1292 added a commit that referenced this pull request Apr 14, 2023
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants