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

Migrate vtctlclient InitShardMaster => vtctldclient InitShardPrimary #7220

Merged
merged 7 commits into from
Jan 14, 2021

Conversation

ajm188
Copy link
Contributor

@ajm188 ajm188 commented Dec 22, 2020

Description

This implements the InitShardMaster command in the VtctldServer, renamed as InitShardPrimary to take advantage of the easy opportunity to rename without backwards compatibility considerations.

Some other decisions made in this PR to call out:

  • I did no refactor or variable renames on the function, because I didn't want to add complications to the initial migration.
  • The old version had no tests, including endtoend tests, so I added a couple simple cases. Any further advice on testing is welcome.
  • Important - I included the well-known Duration type to handle the --wait-replicas-timeout flag, which requires inclusion of the standard proto definitions that ship with protoc. These usually (and by default I think) end up in /usr/local/include, so I've taken the (possibly naive!) simple step of updating make proto to add that include path. I'd like to talk about ideas about how to ensure this doesn't break existing developer's workflows, and whether this is portable enough. Like, we could, for example, call this good enough and add a note to the proto readme to ensure you have these files in the right path, or we could make the tooling more dynamic.

Related Issue(s)

Checklist

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

Deployment Notes

None

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving
  • VReplication
  • Cluster Management
  • Build

// WARNING: This could cause data loss on an already replicating shard.
// PlannedReparentShard or EmergencyReparentShard should be used in those
// cases instead.
rpc InitShardPrimary(vtctldata.InitShardPrimaryRequest) returns (vtctldata.InitShardPrimaryResponse) {};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm genuinely unsure what the right API here is. Is all we want the stream of updates? Maybe this is a case where we actually want just a stream logutil.Event response 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I don't know either :) What you have is fine for now and we can fix forward if we decide otherwise.

Copy link
Contributor

@doeg doeg left a comment

Choose a reason for hiding this comment

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

The golang parts look good to me! Thank you for doing the rename (and adding tests too, so nice!)

You'll fur sure want Planetscale signoff on the rest, of course. 🎉

@deepthi
Copy link
Member

deepthi commented Jan 6, 2021

I included the well-known Duration type to handle the --wait-replicas-timeout flag, which requires inclusion of the standard proto definitions that ship with protoc. These usually (and by default I think) end up in /usr/local/include, so I've taken the (possibly naive!) simple step of updating make proto to add that include path. I'd like to talk about ideas about how to ensure this doesn't break existing developer's workflows, and whether this is portable enough. Like, we could, for example, call this good enough and add a note to the proto readme to ensure you have these files in the right path, or we could make the tooling more dynamic.

In my local environment, the standard protos are under vitess.io/vitess/dist/vt-protoc-3.6.1/include. That is where bootstrap installs them.

@ajm188
Copy link
Contributor Author

ajm188 commented Jan 6, 2021

Working updated make proto:

❯ make proto
Tue Jan 5 19:44:17 EST 2021: Installing minimal dependencies
skipping protoc install. remove /Users/amason/work/vitess/dist/vt-protoc-3.6.1 to force re-install.
/usr/local/bin/etcd
etcd already installed
skipping k3s install. remove /Users/amason/work/vitess/dist/k3s to force re-install.

bootstrap finished - run 'make build' to compile
Tue Jan 5 19:44:57 EST 2021: Compiling proto definitions

Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

LGTM

…mples

There are no functional changes in this commit, just a pure port with
the most minor changes to ensure identical behavior (like the callback
logger).

I also updated our `proto` target to assume a standard protoc
installation (which installs a stdlib of well-known types into
/usr/local/include). We can decide if this is okay to make a
requirement, or if we should try to make this more portable in PR
review.

I also updated the local example to use the vtctldclient port, and went
through the full example with no issues.

Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
… in dist

Signed-off-by: Andrew Mason <amason@slack-corp.com>
@@ -12,7 +12,6 @@ import (
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it looks like the new goimports style conflicts with how protoc-gen-go generates files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixes for this in 602dd69 (git hook) and 67ae893 (linter config)

Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
@rohit-nayak-ps
Copy link
Contributor

@ajm188, I reran a flaky test that had failed and now all tests are passing. Is this ready to be merged?

@ajm188
Copy link
Contributor Author

ajm188 commented Jan 14, 2021

Yep should be good to go!

@rohit-nayak-ps rohit-nayak-ps merged commit d0e4fff into vitessio:master Jan 14, 2021
@ajm188 ajm188 deleted the am_init_shard_primary branch January 14, 2021 15:39
@askdba askdba added this to the v9.0 milestone Jan 19, 2021
@ajm188 ajm188 added this to In progress in Vtctld Service via automation May 23, 2021
@ajm188 ajm188 moved this from In progress to Done in Vtctld Service May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants