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

[topo/helpers] Make CopyShardReplications idempotent #9849

Merged
merged 2 commits into from
Mar 10, 2022

Conversation

ajm188
Copy link
Contributor

@ajm188 ajm188 commented Mar 9, 2022

Description

This updates helpers.CopyShardReplications to build a set of tablet aliases in the fromTS topo so that repeated copies are idempotent.

Related Issue(s)

Fixes #9844

Checklist

  • Should this PR be backported? no
  • Tests were added or are not required
  • Documentation was added or is not required n/a

Deployment Notes

Signed-off-by: Andrew Mason <andrew@planetscale.com>
@@ -168,8 +170,27 @@ func CopyShardReplications(ctx context.Context, fromTS, toTS *topo.Server) {
continue
}

sriNodes := sets.NewString()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This k8s.io/apimachinery dependency seems a bit out of place. We don't usually depend on these helpers in Vitess. Since all you need is a simple String Set, you can make one with a map[string]struct{} that would be just as readable/ergonomic.

Signed-off-by: Andrew Mason <andrew@planetscale.com>
Copy link
Collaborator

@vmg vmg left a comment

Choose a reason for hiding this comment

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

Lookin gucci. Thanks!

@vmg vmg merged commit fd36aed into vitessio:main Mar 10, 2022
@vmg vmg deleted the andrew/shardrepl-idempotent-copy branch March 10, 2022 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

topo2topo copy of shard replication is not idempotent
2 participants