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 tdbg dlq merge for v2 #5025

Merged
merged 1 commit into from Oct 26, 2023
Merged

Add tdbg dlq merge for v2 #5025

merged 1 commit into from Oct 26, 2023

Conversation

MichaelSnowden
Copy link
Contributor

@MichaelSnowden MichaelSnowden commented Oct 24, 2023

What changed?
This PR adds support for --dlq-version v2 to the tdbg dlq merge command.

Why?
Admins need this to be able to re-enqueue tasks.

How did you test it?
I added an end-to-end test with a real workflow which does this:

  1. Start a workflow whose WFT get DLQ'd
  2. Merge that WFT back
  3. Verify the workflow now succeeds.

I also added various unit tests for parameter validation and control flow to get 100% test coverage.

Note that this won't work for cross-cluster tasks yet. I will add that and update the history replication DLQ integration test as well in a follow-up.

Potential risks

Is hotfix candidate?

response, err := adminClient.MergeDLQTasks(ctx, &adminservice.MergeDLQTasksRequest{
DlqKey: ac.getDLQKey(),
InclusiveMaxTaskMetadata: &commonspb.HistoryDLQTaskMetadata{
MessageId: lastMessageID,
Copy link
Member

Choose a reason for hiding this comment

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

just to confirm I can specify MaxInt64 here if I want all tasks merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea. I added that as the default behavior behind a confirmation flag. I also extracted the prompter logic into an object and added unit tests for it. Lastly, I added documentation for the behavior of the last-message-id flag.

return fmt.Sprintf("manage-dlq-tasks-%s", key.GetQueueName())
}

func (adh *AdminHandler) parseKey(key *commonspb.HistoryDLQKey) (*persistence.QueueKey, error) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: parseDLQKey ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that makes more sense.

return err
}
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
Copy link
Member

Choose a reason for hiding this comment

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

shall we add a retry policy for those activities?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, please let me know if you think this retry policy is reasonable.

@MichaelSnowden MichaelSnowden force-pushed the snowden/dlq-merge branch 3 times, most recently from 132d45b to 9867700 Compare October 25, 2023 23:02
Base automatically changed from snowden/dlq-purge to main October 26, 2023 00:24
@MichaelSnowden MichaelSnowden force-pushed the snowden/dlq-merge branch 5 times, most recently from ba51661 to d546ba9 Compare October 26, 2023 05:12
@MichaelSnowden MichaelSnowden enabled auto-merge (squash) October 26, 2023 05:13
@MichaelSnowden MichaelSnowden merged commit a14d0ef into main Oct 26, 2023
10 checks passed
@MichaelSnowden MichaelSnowden deleted the snowden/dlq-merge branch October 26, 2023 05:45
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

2 participants