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

Move update registry from mutable state to workflow context #4032

Merged
merged 3 commits into from
Mar 10, 2023

Conversation

alexshtin
Copy link
Member

What changed?
Move update registry from mutable state to workflow context.

Why?
When workflow task is failed, mutable state is cleared and refreshed. This also clears update registry which might have updates not related to failed workflow task.
This PR moves updated registry one level above -- to workflow context. This allows mutable state to be cleared w/o clearing update registry.

How did you test it?
Modified integration test.

Potential risks
No risks.

Is hotfix candidate?
No.

@alexshtin alexshtin requested a review from a team as a code owner March 9, 2023 00:55
@@ -144,6 +145,8 @@ type (
ctx context.Context,
now time.Time,
) error
// TODO (alex-update): move this from workflow context.
Copy link
Member Author

Choose a reason for hiding this comment

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

This is because long term goal is to to store registry out of workflow cache.

@@ -193,17 +181,6 @@ func (r *RegistryImpl) getAcceptedUpdateNoLock(protocolInstanceID string) *Updat
return nil
}

func (r *RegistryImpl) clearFailure() *failurepb.Failure {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not needed anymore.

@alexshtin alexshtin requested a review from mmcshane March 9, 2023 00:59
Copy link
Contributor

@mmcshane mmcshane left a comment

Choose a reason for hiding this comment

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

One nit that doesn't block

@@ -754,6 +755,7 @@ func (handler *workflowTaskHandlerCallbacksImpl) verifyFirstWorkflowTaskSchedule

func (handler *workflowTaskHandlerCallbacksImpl) createRecordWorkflowTaskStartedResponse(
ms workflow.MutableState,
updateRegistry update.Registry,
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor and not blocking - this seems out of place here. Maybe better to pass the full workflow context and then extract the MS and registry within the function body?

@alexshtin alexshtin merged commit 7f848d1 into temporalio:master Mar 10, 2023
@alexshtin alexshtin deleted the feature/move-update-registry branch March 10, 2023 00:06
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