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

[cli] [servenv] migrate --service_map and pprof flags to pflag #11179

Merged

Conversation

ajm188
Copy link
Contributor

@ajm188 ajm188 commented Sep 7, 2022

Description

I unexported CheckServiceMap because no one called it except servenv.GRPCCheckServiceMap. We can re-export it later if anyone ends up needing it, but this is not a breaking change or anything.
Part of this involved auditing all the paths that can call GRPCCheckServiceMap, which I detail ...

here!
➜  vitess $ go list -f '{{ .ImportPath }}| {{ join .Deps " " }} ' ./go/cmd/... ./go/vt/servenv | awk -F"|" '$2 ~ " vitess.io/vitess/go/vt/binlog/grpcbinlogstreamer " {print $1}'
vitess.io/vitess/go/cmd/vttablet
➜  vitess $ go list -f '{{ .ImportPath }}| {{ join .Deps " " }} ' ./go/cmd/... ./go/vt/servenv | awk -F"|" '$2 ~ " vitess.io/vitess/go/vt/vttablet/grpctmserver " {print $1}'
vitess.io/vitess/go/cmd/vttablet
➜  vitess $ go list -f '{{ .ImportPath }}| {{ join .Deps " " }} ' ./go/cmd/... ./go/vt/servenv | awk -F"|" '$2 ~ " vitess.io/vitess/go/vt/vtgate/grpcvtgateservice " {print $1}'
vitess.io/vitess/go/cmd/vtcombo
vitess.io/vitess/go/cmd/vtgate
vitess.io/vitess/go/cmd/vtgateclienttest
➜  vitess $ go list -f '{{ .ImportPath }}| {{ join .Deps " " }} ' ./go/cmd/... ./go/vt/servenv | awk -F"|" '$2 ~ " vitess.io/vitess/go/vt/throttler/grpcthrottlerserver " {print $1}'
vitess.io/vitess/go/cmd/vttablet

We also get to switch away from manually splitting CSVs to using pflag.StringSliceVar, which is nice.

Related Issue(s)

Checklist

  • "Backport me!" label has been added if this change should be backported
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Andrew Mason added 3 commits September 7, 2022 09:10
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Relates to vitessio#11144.

Also converts the flag from our custom `StringListValue` to pflag-native
`StringSlice`.

Signed-off-by: Andrew Mason <andrew@planetscale.com>
Relates to vitessio#11144.

Signed-off-by: Andrew Mason <andrew@planetscale.com>
@ajm188 ajm188 added Type: Internal Cleanup Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: General Changes throughout the code base Component: CLI labels Sep 7, 2022
@ajm188 ajm188 requested a review from deepthi as a code owner September 7, 2022 13:16
@vitess-bot
Copy link
Contributor

vitess-bot bot commented Sep 7, 2022

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • If this is a change that users need to know about, please apply the release notes (needs details) label so that merging is blocked unless the summary release notes document is included.
  • If a new flag is being introduced, review whether it is really needed. The flag names should be clear and intuitive (as far as possible), and the flag's help should be descriptive. Additionally, flag names should use dashes (-) as word separators rather than underscores (_).
  • If a workflow is added or modified, each items in Jobs should be named in order to mark it as required. If the workflow should be required, the GitHub Admin should be notified.

Bug fixes

  • There should be at least one unit or end-to-end test.
  • The Pull Request description should either include a link to an issue that describes the bug OR an actual description of the bug and how to reproduce, along with a description of the fix.

Non-trivial changes

  • There should be some code comments as to why things are implemented the way they are.

New/Existing features

  • Should be documented, either by modifying the existing documentation or creating new documentation.
  • New features should have a link to a feature request issue or an RFC that documents the use cases, corner cases and test cases.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • vtctl command output order should be stable and awk-able.

@@ -45,7 +45,7 @@ func TestParseProfileFlag(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.arg, func(t *testing.T) {
got, err := parseProfileFlag(tt.arg)
got, err := parseProfileFlag(strings.Split(tt.arg, ","))
Copy link
Contributor

Choose a reason for hiding this comment

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

TestParseProfileFlag fails for the subtest with "" as profile now because len(strings.Split("", ",")) is 1 and not 0 ...

Signed-off-by: Andrew Mason <andrew@planetscale.com>
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.

💯

@@ -205,6 +205,7 @@ func (t *topoFlags) buildTopology() (*vttestpb.VTTestTopology, error) {
// Annoying, but in unit tests, parseFlags gets called multiple times per process
// (anytime startCluster is called), so we need to guard against the second test
// to run failing with, for example:
//
Copy link
Member

Choose a reason for hiding this comment

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

nit: why the new newline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's something in the updated linter/golang stack that's saying there should be a line break here. this came up in #10946 as well 🤷

@ajm188 ajm188 merged commit e33275c into vitessio:main Sep 7, 2022
@ajm188 ajm188 deleted the andrew/pflag/servenv-servicemap-pprof branch September 7, 2022 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: CLI Component: General Changes throughout the code base Type: Enhancement Logical improvement (somewhere between a bug and feature) Type: Internal Cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants