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

Add support for receiving mysql_server_bind_host on vttestserver #17250

Closed
wants to merge 4 commits into from

Conversation

gmpify
Copy link
Contributor

@gmpify gmpify commented Nov 18, 2024

Description

When --mysql-server-bind-host is supplied to vttestserver, it is now forwarded up to mysqlctl and mysqlctld, and then finally added to my.cnf file. MySQL then respects the expected IP we want it to bind on.

Related Issue(s)

Part of #16798

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

Copy link
Contributor

vitess-bot bot commented Nov 18, 2024

Review Checklist

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

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Nov 18, 2024
@github-actions github-actions bot added this to the v22.0.0 milestone Nov 18, 2024
Signed-off-by: Gabriel Parreiras <gabriel.parreiras@shopify.com>
@gmpify gmpify force-pushed the gmpify/mysql_bind_host branch from 40cdf79 to da34985 Compare November 18, 2024 10:52
@gmpify gmpify marked this pull request as ready for review November 18, 2024 10:53
@gmpify gmpify changed the title Add support for receiving mysql_server_bind_host on vttestserver Add support for receiving mysql_server_bind_host on vttestserver Nov 18, 2024
@@ -63,6 +64,7 @@ const (
func RegisterFlags() {
servenv.OnParse(func(fs *pflag.FlagSet) {
fs.IntVar(&flagServerID, "mycnf_server_id", flagServerID, "mysql server id of the server (if specified, mycnf-file will be ignored)")
fs.StringVar(&flagMysqlBindAddress, "mycnf_mysql_bin_address", flagMysqlBindAddress, "address mysql binds on")
Copy link
Member

Choose a reason for hiding this comment

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

All the new flags we add, we use hyphens as separators instead of underscores. So the name should be mycnf-mysql-bin-address

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've made all new flags use hyphens (see 7adb0a6)

connParams.UnixSocket = ""
connParams.Host = "127.0.0.1"
connParams.Host = host
Copy link
Member

Choose a reason for hiding this comment

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

Prior to the new flags it seems we used 127.0.0.1 as the hostname. Shoudln't that be the default for the flags then instead of 0.0.0.0

Copy link
Contributor Author

@gmpify gmpify Nov 19, 2024

Choose a reason for hiding this comment

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

I think mysql is binding to 0.0.0.0 by default (at least it is when run out of vttestserver).

Confirmed with this test:

$ /opt/vitess-19/bin/vttestserver --alsologtostderr --persistent_mode --mysql_bind_host=127.231.106.94 --grpc_bind_address=127.231.106.94 --vschema_ddl_authorized_users=% --enable_system_settings=false --mysql_server_version=8.0.34 --planner-version=gen4 --data_dir=/tmp/foobar/data --log_dir=/tmp/foobar/logs --port=15991 --tablet_hostname=127.231.106.94 --tablet_refresh_interval=10s --vtcombo-bind-host=127.231.106.94 --num_shards=1,1 --keyspaces=core_general_1_dev,core_general_1_test

// notice command with port 15991, and mysql listening on 15993 binds to 0.0.0.0

$ netstat -an | grep 1599 | grep LISTEN
tcp4       0      0  127.231.106.94.15991   *.*                    LISTEN
tcp46      0      0  *.15992                *.*                    LISTEN
tcp4       0      0  127.231.106.94.15994   *.*                    LISTEN
tcp46      0      0  *.15993                *.*                    LISTEN

$ lsof -i :15991-15994
COMMAND   PID             USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
mysqld  30509 gabrielparreiras   20u  IPv6 0x843d5de06a4e62a0      0t0  TCP *:15993 (LISTEN)
vtcombo 30513 gabrielparreiras   34u  IPv4 0x83b4c31e34aa900c      0t0  TCP localhost:15994 (LISTEN)
vtcombo 30513 gabrielparreiras   36u  IPv6 0x38b3535bf6c700cf      0t0  TCP *:15992 (LISTEN)
vtcombo 30513 gabrielparreiras   37u  IPv4 0x93e314ab7e1f052a      0t0  TCP localhost:15991 (LISTEN)

gmpify and others added 3 commits November 19, 2024 13:16
Signed-off-by: Gabriel Parreiras <gabriel.parreiras@shopify.com>
Signed-off-by: Gabriel Parreiras <gab.parreiras@gmail.com>
Signed-off-by: Gabriel Parreiras <gabriel.parreiras@shopify.com>
@GuptaManan100
Copy link
Member

There are quite a few test failures. Would you mind looking at them and fixing the PR accordingly?

@deepthi deepthi added Component: vttestserver Type: Enhancement Logical improvement (somewhere between a bug and feature) and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Dec 8, 2024
Copy link
Contributor

github-actions bot commented Jan 8, 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 Marks PRs as stale after a period of inactivity, which are then closed after a grace period. label Jan 8, 2025
Copy link
Contributor

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

@github-actions github-actions bot closed this Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: vttestserver Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants