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

ResetReapplyExcludeType (preparation for Update reapply) #348

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

dandavison
Copy link
Contributor

@dandavison dandavison commented Jan 23, 2024

These are proposed proto changes in preparation for Update reapply, based on a design by @yycptt.

  • Currently, the Reset request allows a user to send RESET_REAPPLY_TYPE_SIGNAL or RESET_REAPPLY_TYPE_NONE. The server defaults to RESET_REAPPLY_TYPE_SIGNAL.

  • We are about to start reapplying Updates and, in the future, we may reapply other events such as Nexus-related events.

  • We do not want to expand the ResetReapplyType enum to encode arbitrary subsets of event types to be reapplied.

  • Instead, this PR adds to the Reset request the ability to send a list of event types to be excluded from reapply.

  • I have also added one final value to the legacy enum: RESET_REAPPLY_TYPE_ALL_ELIGIBLE. I propose to make this the new default for ResetReapplyType. In practice, today, that has the same consequences (i.e. "reapply signals"), just under a different name.

  • Other than that final addition, ResetReapplyType now becomes deprecated.

Thus what I'm proposing is that, in the future, the server's implementation will be to:

  1. Take the set of events to reapply implied by the value of ResetReapplyType
  2. Remove from this set all ResetReapplyExcludeType events

The result is the set of event types that will be reapplied during Reset.

@dandavison dandavison requested review from a team as code owners January 23, 2024 02:19
@dandavison dandavison requested a review from yycptt January 23, 2024 02:23
@dandavison dandavison force-pushed the oss-2147-reapply-types-prep branch 3 times, most recently from 93058b2 to 324292f Compare January 23, 2024 02:33
Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

Why use exclusion in the api instead of inclusion with a default to apply all?

temporal.api.enums.v1.ResetReapplyType reset_reapply_type = 6;
// Event types not to be reapplied
repeated temporal.api.enums.v1.ResetReapplyExcludeType reset_reapply_exclude_types = 7;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
repeated temporal.api.enums.v1.ResetReapplyExcludeType reset_reapply_exclude_types = 7;
repeated temporal.api.enums.v1.ResetReapplyType reset_reapply_types = 7;

One wonders if this makes more sense, and it can be validated as mutually exclusive with the singular one. I fear we're going to later regret not letting you choose the types to reapply.

@dandavison
Copy link
Contributor Author

One wonders if this makes more sense, and it can be validated as mutually exclusive with the singular one. I fear we're going to later regret not letting you choose the types to reapply.

Why use exclusion in the api instead of inclusion with a default to apply all?

I agree that a pure inclusion-based API would be preferable. I'll push a second commit along those lines shortly.

Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

After discussion, due to apply-all being default, exclusion list makes more sense.

@dandavison
Copy link
Contributor Author

I agree that a pure inclusion-based API would be preferable. I'll push a second commit along those lines shortly.

We discussed this offline and concluded that exclusion semantics were best seeing as the default needs to be "all". I've included a commit implementing an inclusion variant, but reverted it.

@dandavison dandavison merged commit 3db0659 into temporalio:master Jan 23, 2024
2 checks passed
@dandavison dandavison deleted the oss-2147-reapply-types-prep branch January 23, 2024 23:58
dandavison added a commit to temporalio/temporal that referenced this pull request Mar 13, 2024
…5360)

## What changed?
- Start honoring the new `reset_reapply_exclude_types` request field
added in temporalio/api#348
- Change all reapply codepaths to specify excluded event types rather
than included
- Pass the set of excluded types further down the stack
- Delete a pointless helper function


## Why?
- We must honor the new request field because it is in the API and it is
how we are going to control update reapply when we implement that
- The previous code was not future-proof: there were various codepaths
passing `enumspb.RESET_REAPPLY_TYPE_SIGNAL` to mean "reapply
everything". This PR changes those codepaths to pass an empty set of
exclusions, which is robust to future additions of new reappliable event
types.
- The actual work is done by `reapplyEvents`, and the excluded types had
to be pushed all the way down the stack to this function. The previous
code was pretty fragile: it checked that the caller had requested
reapplication of signals and then let the downstream code reapply
everything.

## How did you test it?
- Unit tests

## Potential risks
- It could break replication, and reset

## Is hotfix candidate?
- No
stephanos pushed a commit to stephanos/temporal that referenced this pull request Mar 21, 2024
…emporalio#5360)

## What changed?
- Start honoring the new `reset_reapply_exclude_types` request field
added in temporalio/api#348
- Change all reapply codepaths to specify excluded event types rather
than included
- Pass the set of excluded types further down the stack
- Delete a pointless helper function


## Why?
- We must honor the new request field because it is in the API and it is
how we are going to control update reapply when we implement that
- The previous code was not future-proof: there were various codepaths
passing `enumspb.RESET_REAPPLY_TYPE_SIGNAL` to mean "reapply
everything". This PR changes those codepaths to pass an empty set of
exclusions, which is robust to future additions of new reappliable event
types.
- The actual work is done by `reapplyEvents`, and the excluded types had
to be pushed all the way down the stack to this function. The previous
code was pretty fragile: it checked that the caller had requested
reapplication of signals and then let the downstream code reapply
everything.

## How did you test it?
- Unit tests

## Potential risks
- It could break replication, and reset

## Is hotfix candidate?
- No
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