Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Wait for user data propagation in deployment workflow #6978

Merged
merged 11 commits into from
Dec 16, 2024

Conversation

dnr
Copy link
Member

@dnr dnr commented Dec 12, 2024

What changed?

The deployment workflow waits for user data to propagate to all task queue partitions before updating its state.

Why?

We should ensure that the desired dispatch semantics will be in effect on all task queue partitions.

How did you test it?

existing tests, new unit test

case <-ctx.Done():
return ctx.Err()
case err := <-complete:
return err
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we log the error? Also, I'm going to make task for adding metrics and alerts we need them for across the board for effective monitoring of user data processing and deployment WFs.

Copy link
Member Author

Choose a reason for hiding this comment

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

err can't be anything other than nil here. I just had it return it for future extensibility. this never returns an error that isn't a context error. it's a slightly different semantics from the other long poll stuff that can return "empty"/"nothing yet" as a success response. I can do that if desired but it seems like extra complication?

if the matchingClient call above fails, the client itself will log matching client encountered error, so we don't have to do it. well, it will not log DeadlineExceeded/Canceled, which I think is what we want.

it will log FailedPrecondition, which I want to ignore here. I think we can live with that.

@@ -302,11 +311,19 @@ func (d *DeploymentWorkflowRunner) handleSyncState(ctx workflow.Context, args *d
}
}
activityCtx := workflow.WithActivityOptions(ctx, defaultActivityOptions)
err = workflow.ExecuteActivity(activityCtx, d.a.SyncUserData, syncReq).Get(ctx, nil)
var syncRes deploymentspb.SyncUserDataResponse
err = workflow.ExecuteActivity(activityCtx, d.a.SyncUserData, syncReq).Get(ctx, &syncRes)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you think we'd need to limit the number of TQs we pass to each Activity call here? It seems 1000 TQs at one time can become very fragile.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, I can add batching in the next PR

if err != nil {
// TODO: if this fails, should we roll back anything?
return nil, err
}
// wait for propagation
err = workflow.ExecuteActivity(activityCtx, d.a.CheckUserDataPropagation, &deploymentspb.CheckUserDataPropagationRequest{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same for this call. In here the problem would be more sever because there is another level of fanout to all partitions.

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, batching sounds good

if err != nil {
// TODO: if this fails, should we roll back anything?
return nil, err
}
// wait for propagation
err = workflow.ExecuteActivity(activityCtx, d.a.CheckUserDataPropagation, &deploymentspb.CheckUserDataPropagationRequest{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need to path for this change, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

ugh, I was assuming we wouldn't start using this before these changes or could just reset everything...

how much do we have to be concerned with an in-progress deployment and an activity task from the new worker getting sent to an old worker that doesn't know about it?

actually, we can do both at once: only do this if syncRes.TaskQueueMaxVersions has data. replays and older activity handlers will both have no data there. that seems to work.

@dnr dnr marked this pull request as ready for review December 16, 2024 18:15
@dnr dnr requested a review from a team as a code owner December 16, 2024 18:15
@dnr dnr merged commit e44457b into temporalio:main Dec 16, 2024
49 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants