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 ApplyMutation and ApplySnapshot methods for mutable state #6517

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hai719
Copy link
Contributor

@hai719 hai719 commented Sep 13, 2024

What changed?

Why?

How did you test it?

Potential risks

Documentation

Is hotfix candidate?

service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
service/history/workflow/mutable_state_impl.go Outdated Show resolved Hide resolved
Comment on lines +6489 to +6490
val := reflect.ValueOf(key)
if val.Kind() == reflect.String {
Copy link
Member

Choose a reason for hiding this comment

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

nit: just do a type switch?


ms.ClearStickyTaskQueue()

if ms.executionInfo.WorkflowTaskType == enumsspb.WORKFLOW_TASK_TYPE_SPECULATIVE {
Copy link
Member

Choose a reason for hiding this comment

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

should be checking incoming WorkflowTaskType.

Copy link
Member

Choose a reason for hiding this comment

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

nit: actually we can sync all WorkflowTask* fields and invoke deleteWorkflowTask() if the workflowTaskType is Speculative after sync?

return err
}

return currentNode.Sync(incomingNode)
Copy link
Member

Choose a reason for hiding this comment

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

This internally performs a task refresh for the synced node. If we go with this approach (which I am fine with), caller needs to clear all generated tasks (can be done with ms.PopTasks()) before doing a task refresh. cc @xwduan

&current.TaskGenerationShardClockTimestamp,
&current.UpdateInfos,
}
err := common.MergeProtoExcludingFields(current, incoming, doNotSyncFields...)
Copy link
Member

Choose a reason for hiding this comment

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

nit: I am a little bit concerned with the reflection usage here TBH since this will be a quite hot code path that got invoked for every replication task. When you have time can you do a benchtest on this util function to see if it will become a bottleneck? Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

Plz add more tests before landing.

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