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 api at mutable state to track potential reapply events #7001

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

Conversation

xwduan
Copy link
Contributor

@xwduan xwduan commented Dec 17, 2024

What changed?

Why?

How did you test it?

Potential risks

Documentation

Is hotfix candidate?

Comment on lines 697 to 699
for _, event := range newRunHistory {
newRunMutableState.AddReapplyCandidateEvent(event)
}
Copy link
Member

Choose a reason for hiding this comment

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

This new run (continue as new) is created by applying events so the history builder in newRunMutableState does contain those events I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

make sense. removed.

newWorkflowEventsSeq,
); err != nil {
return err
if len(updateWorkflowEventsSeq) != 0 || len(newWorkflowEventsSeq) != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

As commented above, I think newWorkflowEventsSeq is non-empty here.
We need to check both xxxWorkflowEventsSeq and xxxEventReapplyCandidate and pick the non-empty one if existing for the reapply.

Copy link
Contributor

Choose a reason for hiding this comment

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

updated.

service/history/ndc/workflow_state_replicator.go Outdated Show resolved Hide resolved
if err := c.updateWorkflowExecutionEventReapply(
ctx,
shardContext,
updateMode,
updateWorkflowEventsSeq,
eventsToReapply,
newWorkflowEventsSeq,
Copy link
Member

Choose a reason for hiding this comment

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

nit: add a comment re. why newWorkflowEventsSeq can be used directly.

Copy link
Contributor

Choose a reason for hiding this comment

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

added

// current workflow events will not participate in the events reapplication
); err != nil {
return err
if len(resetWorkflowEventsSeq) != 0 || len(newWorkflowEventsSeq) != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

we should use similar logic as UpdateWorkflowExecutionWithNew?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes! updated as UpdateWorkflowExecutionWithNew

if err != nil {
return common.EmptyEventTaskID, nil, err
}
eventsToReapply = append(eventsToReapply, events...)
Copy link
Member

Choose a reason for hiding this comment

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

nit: is it possible to add those events directly to ms here instead of buffering entire history in memory, return and then filter?

Copy link
Contributor

Choose a reason for hiding this comment

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

restructure the functions to add events directly to ms

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.

4 participants