Skip to content

Vtgateproxy rework register flags#686

Closed
demmer wants to merge 2 commits intovtgateproxy-v19from
vtgateproxy-rework-register-flags
Closed

Vtgateproxy rework register flags#686
demmer wants to merge 2 commits intovtgateproxy-v19from
vtgateproxy-rework-register-flags

Conversation

@demmer
Copy link

@demmer demmer commented Aug 15, 2025

Description

As part of reducing the touch points for vtgateproxy inside the main vitess codebase, change the way that the binary registers the various command line flags so that it explicitly calls the various register functions rather than relying on having the binary name in the internal list.

IMHO this would be a better way for all the vitess binaries to manage registering their flags, as I feel like the hard-coded list of strings feels somewhat odd, but that's a question for the maintainers upstream and doesn't really affect us here.

Testing

Confirmed that the output of vtgateproxy --help is the same before and after the change so this registers all the same flags

Benefits

With this patch in place, the proxy-specific diffs on this branch include:

[mdemmer-ltmzvnq] -> git diff --stat vtgateproxy-v19-base
 go.mod                                           |   8 +-
 go.sum                                           |   9 ++
 go/cmd/vtgateproxy/.gitignore                    |   1 +
 go/cmd/vtgateproxy/vtgateproxy                   | Bin 32493648 -> 0 bytes
 go/cmd/vtgateproxy/vtgateproxy.go                |  68 ++++++++++++++
 go/mysql/conn.go                                 |   5 ++
 go/mysql/constants.go                            |   4 +
 go/mysql/server.go                               |  46 +++++-----
 go/test/endtoend/vtgateproxy/failure_test.go     | 219 ++++++++++++++++++++++++++++++++++++++++++++
 go/test/endtoend/vtgateproxy/main_test.go        | 480 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 go/test/endtoend/vtgateproxy/rebalance_test.go   | 171 +++++++++++++++++++++++++++++++++++
 go/test/endtoend/vtgateproxy/scale_test.go       | 190 +++++++++++++++++++++++++++++++++++++++
 go/test/endtoend/vtgateproxy/vtgateproxy_test.go | 118 ++++++++++++++++++++++++
 go/vt/vtgate/grpcvtgateconn/conn.go              |  18 ++--
 go/vt/vtgate/vtgateconn/vtgateconn.go            |   7 +-
 go/vt/vtgateproxy/discovery.go                   | 519 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 go/vt/vtgateproxy/firstready_balancer.go         | 103 +++++++++++++++++++++
 go/vt/vtgateproxy/mysql_server.go                | 659 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 go/vt/vtgateproxy/sim/go.mod                     |   5 ++
 go/vt/vtgateproxy/sim/go.sum                     |   2 +
 go/vt/vtgateproxy/sim/vtgateproxysim.go          | 101 +++++++++++++++++++++
 go/vt/vtgateproxy/sticky_random_balancer.go      | 110 +++++++++++++++++++++++
 go/vt/vtgateproxy/vtgateproxy.go                 | 246 ++++++++++++++++++++++++++++++++++++++++++++++++++
 test/config.json                                 |   9 ++

With this diff in place, the only upstream changes are those in go/mysql and go/vt/vtgate for which I opened upstream PRs here:

vitessio#18548
vitessio#18551

So between those two changes and the patches in this branch, we should be better positioned to maintain the proxy outside of the main repo.

Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
@demmer demmer requested a review from a team as a code owner August 15, 2025 15:59
@github-actions github-actions bot added this to the v19.0.7 milestone Aug 15, 2025
Reduce the dependencies on the core of vitess for vtgateproxy by moving the way
in which we register command line flags out of the core codebase and explicitly
part of the vtgateproxy binary.

Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
@demmer demmer force-pushed the vtgateproxy-rework-register-flags branch from 7f1818e to 1c945b0 Compare August 15, 2025 16:03
}

func registerFlags(fs *pflag.FlagSet) {
func RegisterFlags(fs *pflag.FlagSet) {

Choose a reason for hiding this comment

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

does this need to be made public? I maybe misunderstand how this works

Choose a reason for hiding this comment

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

never mind - ignore me

Copy link
Author

Choose a reason for hiding this comment

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

Ya - This is part of the upstream PR vitessio#18551 and is consistent with a bunch of the other submodules.

That way the vtgateproxy binary can bind the flags in init like it does for the other dependencies it wants to pull in.

@github-actions
Copy link

github-actions bot commented Oct 6, 2025

This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:

  • Push additional commits to the associated branch.
  • Remove the stale label.
  • Add a comment indicating why it is not stale.

If no action is taken within 7 days, this PR will be closed.

@github-actions github-actions bot added the Stale label Oct 6, 2025
@github-actions
Copy link

This PR was closed because it has been stale for 7 days with no activity.

@github-actions github-actions bot closed this Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants