Skip to content

Migrate vtctlclient InitShardMaster => vtctldclient InitShardPrimary#7220

Merged
rohit-nayak-ps merged 7 commits intovitessio:masterfrom
tinyspeck:am_init_shard_primary
Jan 14, 2021
Merged

Migrate vtctlclient InitShardMaster => vtctldclient InitShardPrimary#7220
rohit-nayak-ps merged 7 commits intovitessio:masterfrom
tinyspeck:am_init_shard_primary

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

@ajm188 ajm188 requested review from doeg and sougou as code owners December 22, 2020 21:52
@ajm188 ajm188 force-pushed the am_init_shard_primary branch from 40b0f19 to 3e6942d Compare December 23, 2020 01:00
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
Collaborator

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
Collaborator

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 ajm188 force-pushed the am_init_shard_primary branch from 3e6942d to 283db12 Compare January 6, 2021 00:18
@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
Collaborator

@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

Andrew Mason added 4 commits January 13, 2021 21:10
…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>
@ajm188 ajm188 force-pushed the am_init_shard_primary branch from f1343d4 to 99b507c Compare January 14, 2021 02:11
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)

Andrew Mason added 3 commits January 13, 2021 21:16
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
Member

@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
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.

5 participants