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 build-id-based reset #333

Merged
merged 4 commits into from
Nov 29, 2023
Merged

Add build-id-based reset #333

merged 4 commits into from
Nov 29, 2023

Conversation

dnr
Copy link
Member

@dnr dnr commented Nov 28, 2023

What changed?

  • Add ResetOptions to encapsulate options for resetting one or more workflows
  • The target for ResetOptions uses a oneof to allow a reset type to have an argument.
  • BatchOperationReset uses ResetOptions
  • ResetPointInfo contains a build_id in addition to binary_checksum (which is now marked deprecated).

Why?
Help recover from a bad deployment situation

Breaking changes
no, the old reset options will continue to be supported

@dnr dnr requested review from a team as code owners November 28, 2023 03:13
@dnr dnr mentioned this pull request Nov 28, 2023
// Deprecated (use `options`):
// Reset type.
temporal.api.enums.v1.ResetType reset_type = 1;
// History event reapply options.
Copy link
Member

Choose a reason for hiding this comment

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

I assume this is also deprecated?

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, it's included in options. I guess I should comment each individually

Comment on lines 96 to 102
// Describes what to reset to and how (exclusive with `reset_type` and `reset_reapply_type`)
temporal.api.common.v1.ResetOptions options = 4;

// Reset type (deprecated, use `options`).
temporal.api.enums.v1.ResetType reset_type = 1;
// History event reapply options (deprecated, use `options`).
temporal.api.enums.v1.ResetReapplyType reset_reapply_type = 2;
Copy link
Member

Choose a reason for hiding this comment

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

Why not use a oneof if these are exclusive?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think oneof helps here. I'm moving those fields into options and deprecating them. Callers should just migrate to options, but I don't want to break existing code yet.

Maybe I should write "if this is set, the other fields are ignored" on options instead?

Copy link
Member

Choose a reason for hiding this comment

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

I just totally spaced that they said deprecated.

I do like that change in docstring though 👍

Comment on lines +161 to +162
// The id of a specific `WORKFLOW_TASK_COMPLETED`,`WORKFLOW_TASK_TIMED_OUT`, `WORKFLOW_TASK_FAILED`, or
// `WORKFLOW_TASK_STARTED` event to reset to.
Copy link
Member

Choose a reason for hiding this comment

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

I always got confused by this. Why not simply reset to the workflow task scheduled event?

Copy link
Member Author

Choose a reason for hiding this comment

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

As far as I understand it, it always does effectively do that. It just branches history at the workflow task started event and adds a workflow task failed, so nothing from that workflow task takes effect. It's just that you can specify any of those types since they are always contiguous in history.

It does seem like it would be cleaner to branch before the workflow task scheduled event and then create a new one, but I guess there was/is probably a good reason to do it this way. I'm not proposing to change this here, I just copied the comment from ResetWorkflowExecutionRequest

google.protobuf.Empty last_workflow_task = 2;
// The id of a specific `WORKFLOW_TASK_COMPLETED`,`WORKFLOW_TASK_TIMED_OUT`, `WORKFLOW_TASK_FAILED`, or
// `WORKFLOW_TASK_STARTED` event to reset to.
int64 workflow_task_id = 3;
Copy link
Member

Choose a reason for hiding this comment

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

How are user suppose to use this in batch reset case?

Copy link
Member Author

Choose a reason for hiding this comment

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

They're not, this is so we can use the same message for single-workflow reset in the future. I'll add a comment

@dnr dnr merged commit 2e47a76 into temporalio:master Nov 29, 2023
4 checks passed
@dnr dnr deleted the bb2 branch November 29, 2023 16:54

// If true, limit the reset to only within the current run. (Applies to build_id targets and
// possibly others in the future.)
bool current_run_only = 11;
Copy link
Member

Choose a reason for hiding this comment

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

I'm super late to this review but if this doesn't apply to all targets, maybe it would have been better to make build_id a message and put this in the message.
This would also make build_id extensible in the future.

message BuildId {
  string build_id = 1;
  bool current_run_only = 2;
}

...

BuildId build_id = 4;

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.

None yet

6 participants