From fcf902555361c0711a9e5fb8c108af388a04eb64 Mon Sep 17 00:00:00 2001 From: Dirkjan Bussink Date: Mon, 29 May 2023 15:25:29 +0200 Subject: [PATCH 01/12] serenv: Allow for explicit bind address In environments where there's potentially multiple address available, it can be useful to only bind on a specific address. This avoids making the process available on any other interfaces for a better security model. We also make use of this in the CI tests to bind to the local network address to avoid exposing any CI processes to any external address that might be available. Signed-off-by: Dirkjan Bussink --- docker/vttestserver/run.sh | 1 + go/cmd/vttestserver/vttestserver_test.go | 1 + go/flags/endtoend/mysqlctld.txt | 2 ++ go/flags/endtoend/vtbackup.txt | 1 + go/flags/endtoend/vtctld.txt | 2 ++ go/flags/endtoend/vtgate.txt | 2 ++ go/flags/endtoend/vtorc.txt | 1 + go/flags/endtoend/vttablet.txt | 2 ++ go/flags/endtoend/vttestserver.txt | 1 + go/test/endtoend/cluster/cluster_process.go | 2 +- go/test/endtoend/cluster/vtctld_process.go | 2 ++ go/test/endtoend/cluster/vtgate_process.go | 2 ++ go/test/endtoend/cluster/vtorc_process.go | 1 + go/test/endtoend/cluster/vttablet_process.go | 2 ++ go/test/endtoend/keyspace/keyspace_test.go | 10 +++++----- go/vt/servenv/grpc_server.go | 6 +++++- go/vt/servenv/run.go | 4 ++-- go/vt/servenv/servenv.go | 6 ++++-- go/vt/vttest/vtprocess.go | 1 + go/vt/wrangler/fake_tablet_test.go | 4 ++-- go/vt/wrangler/testlib/fake_tablet.go | 4 ++-- 21 files changed, 42 insertions(+), 15 deletions(-) diff --git a/docker/vttestserver/run.sh b/docker/vttestserver/run.sh index 1ff79153af5..3963e8b3624 100755 --- a/docker/vttestserver/run.sh +++ b/docker/vttestserver/run.sh @@ -32,6 +32,7 @@ rm -vf "$VTDATAROOT"/"$tablet_dir"/{mysql.sock,mysql.sock.lock} # Run the vttestserver binary /vt/bin/vttestserver \ --port "$PORT" \ + --bind_address "${MYSQL_BIND_HOST:-127.0.0.1}" \ --keyspaces "$KEYSPACES" \ --num_shards "$NUM_SHARDS" \ --mysql_bind_host "${MYSQL_BIND_HOST:-127.0.0.1}" \ diff --git a/go/cmd/vttestserver/vttestserver_test.go b/go/cmd/vttestserver/vttestserver_test.go index 0665d5f9c46..7554e7a6793 100644 --- a/go/cmd/vttestserver/vttestserver_test.go +++ b/go/cmd/vttestserver/vttestserver_test.go @@ -299,6 +299,7 @@ func startPersistentCluster(dir string, flags ...string) (vttest.LocalCluster, e "--persistent_mode", // FIXME: if port is not provided, data_dir is not respected fmt.Sprintf("--port=%d", randomPort()), + "--bind_address=127.0.0.1", fmt.Sprintf("--data_dir=%s", dir), }...) return startCluster(flags...) diff --git a/go/flags/endtoend/mysqlctld.txt b/go/flags/endtoend/mysqlctld.txt index 8b0ca101cb4..88d4f7544cd 100644 --- a/go/flags/endtoend/mysqlctld.txt +++ b/go/flags/endtoend/mysqlctld.txt @@ -2,6 +2,7 @@ Usage of mysqlctld: --alsologtostderr log to standard error as well as files --app_idle_timeout duration Idle timeout for app connections (default 1m0s) --app_pool_size int Size of the connection pool for app connections (default 40) + --bind_address string bind address for the server --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --config-file string Full path of the config file (with extension) to use. If set, --config-path, --config-type, and --config-name are ignored. --config-file-not-found-handling ConfigFileNotFoundHandling Behavior when a config file is not found. (Options: error, exit, ignore, warn) (default warn) @@ -44,6 +45,7 @@ Usage of mysqlctld: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vtbackup.txt b/go/flags/endtoend/vtbackup.txt index f825e764e6c..9f6bc92d8b7 100644 --- a/go/flags/endtoend/vtbackup.txt +++ b/go/flags/endtoend/vtbackup.txt @@ -11,6 +11,7 @@ Usage of vtbackup: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) + --bind_address string bind address for the server --builtinbackup-file-read-buffer-size uint read files using an IO buffer of this many bytes. Golang defaults are used when set to 0. --builtinbackup-file-write-buffer-size uint write files using an IO buffer of this many bytes. Golang defaults are used when set to 0. (default 2097152) --builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s) diff --git a/go/flags/endtoend/vtctld.txt b/go/flags/endtoend/vtctld.txt index 7bc57f53630..8283a75f3be 100644 --- a/go/flags/endtoend/vtctld.txt +++ b/go/flags/endtoend/vtctld.txt @@ -11,6 +11,7 @@ Usage of vtctld: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) + --bind_address string bind address for the server --builtinbackup-file-read-buffer-size uint read files using an IO buffer of this many bytes. Golang defaults are used when set to 0. --builtinbackup-file-write-buffer-size uint write files using an IO buffer of this many bytes. Golang defaults are used when set to 0. (default 2097152) --builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s) @@ -36,6 +37,7 @@ Usage of vtctld: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vtgate.txt b/go/flags/endtoend/vtgate.txt index bb576961c29..a3f698fd1f2 100644 --- a/go/flags/endtoend/vtgate.txt +++ b/go/flags/endtoend/vtgate.txt @@ -1,6 +1,7 @@ Usage of vtgate: --allowed_tablet_types strings Specifies the tablet types this vtgate is allowed to route queries to. Should be provided as a comma-separated set of tablet types. --alsologtostderr log to standard error as well as files + --bind_address string bind address for the server --buffer_drain_concurrency int Maximum number of requests retried simultaneously. More concurrency will increase the load on the PRIMARY vttablet when draining the buffer. (default 1) --buffer_implementation string Allowed values: healthcheck (legacy implementation), keyspace_events (default) (default "keyspace_events") --buffer_keyspace_shards string If not empty, limit buffering to these entries (comma separated). Entry format: keyspace or keyspace/shard. Requires --enable_buffer=true. @@ -45,6 +46,7 @@ Usage of vtgate: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vtorc.txt b/go/flags/endtoend/vtorc.txt index b38cca7374b..434d9093003 100644 --- a/go/flags/endtoend/vtorc.txt +++ b/go/flags/endtoend/vtorc.txt @@ -4,6 +4,7 @@ Usage of vtorc: --audit-purge-duration duration Duration for which audit logs are held before being purged. Should be in multiples of days (default 168h0m0s) --audit-to-backend Whether to store the audit log in the VTOrc database --audit-to-syslog Whether to store the audit log in the syslog + --bind_address string bind address for the server --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --clusters_to_watch strings Comma-separated list of keyspaces or keyspace/shards that this instance will monitor and repair. Defaults to all clusters in the topology. Example: "ks1,ks2/-80" --config string config file name diff --git a/go/flags/endtoend/vttablet.txt b/go/flags/endtoend/vttablet.txt index bdb55724d0b..02d5be5995d 100644 --- a/go/flags/endtoend/vttablet.txt +++ b/go/flags/endtoend/vttablet.txt @@ -12,6 +12,7 @@ Usage of vttablet: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) + --bind_address string bind address for the server --binlog_host string PITR restore parameter: hostname/IP of binlog server. --binlog_password string PITR restore parameter: password of binlog server. --binlog_player_grpc_ca string the server ca to use to validate servers when connecting @@ -128,6 +129,7 @@ Usage of vttablet: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vttestserver.txt b/go/flags/endtoend/vttestserver.txt index 4254f58c398..79d96cdbebe 100644 --- a/go/flags/endtoend/vttestserver.txt +++ b/go/flags/endtoend/vttestserver.txt @@ -42,6 +42,7 @@ Usage of vttestserver: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/test/endtoend/cluster/cluster_process.go b/go/test/endtoend/cluster/cluster_process.go index 16362bd24ce..282a0ee94aa 100644 --- a/go/test/endtoend/cluster/cluster_process.go +++ b/go/test/endtoend/cluster/cluster_process.go @@ -1085,7 +1085,7 @@ func (cluster *LocalProcessCluster) GetAndReservePort() int { for { cluster.nextPortForProcess = cluster.nextPortForProcess + 1 log.Infof("Attempting to reserve port: %v", cluster.nextPortForProcess) - ln, err := net.Listen("tcp", fmt.Sprintf(":%v", cluster.nextPortForProcess)) + ln, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%v", cluster.nextPortForProcess)) if err != nil { log.Errorf("Can't listen on port %v: %s, trying next port", cluster.nextPortForProcess, err) diff --git a/go/test/endtoend/cluster/vtctld_process.go b/go/test/endtoend/cluster/vtctld_process.go index 5e85f172ce1..ad9ae0044f6 100644 --- a/go/test/endtoend/cluster/vtctld_process.go +++ b/go/test/endtoend/cluster/vtctld_process.go @@ -63,7 +63,9 @@ func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error) "--file_backup_storage_root", vtctld.FileBackupStorageRoot, "--log_dir", vtctld.LogDir, "--port", fmt.Sprintf("%d", vtctld.Port), + "--bind_address", "127.0.0.1", "--grpc_port", fmt.Sprintf("%d", vtctld.GrpcPort), + "--grpc_bind_address", "127.0.0.1", ) if *isCoverage { vtctld.proc.Args = append(vtctld.proc.Args, "--test.coverprofile="+getCoveragePath("vtctld.out")) diff --git a/go/test/endtoend/cluster/vtgate_process.go b/go/test/endtoend/cluster/vtgate_process.go index f037f53a055..f5ac9386fb7 100644 --- a/go/test/endtoend/cluster/vtgate_process.go +++ b/go/test/endtoend/cluster/vtgate_process.go @@ -76,7 +76,9 @@ func (vtgate *VtgateProcess) Setup() (err error) { "--log_dir", vtgate.LogDir, "--log_queries_to_file", vtgate.FileToLogQueries, "--port", fmt.Sprintf("%d", vtgate.Port), + "--bind_address", "127.0.0.1", "--grpc_port", fmt.Sprintf("%d", vtgate.GrpcPort), + "--grpc_bind_address", "127.0.0.1", "--mysql_server_port", fmt.Sprintf("%d", vtgate.MySQLServerPort), "--mysql_server_socket_path", vtgate.MySQLServerSocketPath, "--cell", vtgate.Cell, diff --git a/go/test/endtoend/cluster/vtorc_process.go b/go/test/endtoend/cluster/vtorc_process.go index 34c4f3295ab..d430bb464bf 100644 --- a/go/test/endtoend/cluster/vtorc_process.go +++ b/go/test/endtoend/cluster/vtorc_process.go @@ -112,6 +112,7 @@ func (orc *VTOrcProcess) Setup() (err error) { "--topo_global_root", orc.TopoGlobalRoot, "--config", orc.ConfigPath, "--port", fmt.Sprintf("%d", orc.Port), + "--bind_address", "127.0.0.1", // This parameter is overriden from the config file, added here to just verify that we indeed use the config file paramter over the flag "--recovery-period-block-duration", "10h", "--instance-poll-time", "1s", diff --git a/go/test/endtoend/cluster/vttablet_process.go b/go/test/endtoend/cluster/vttablet_process.go index d323d10f2ee..1818e5b956e 100644 --- a/go/test/endtoend/cluster/vttablet_process.go +++ b/go/test/endtoend/cluster/vttablet_process.go @@ -94,7 +94,9 @@ func (vttablet *VttabletProcess) Setup() (err error) { "--log_queries_to_file", vttablet.FileToLogQueries, "--tablet-path", vttablet.TabletPath, "--port", fmt.Sprintf("%d", vttablet.Port), + "--bind_address", "127.0.0.1", "--grpc_port", fmt.Sprintf("%d", vttablet.GrpcPort), + "--grpc_bind_address", "127.0.0.1", "--init_shard", vttablet.Shard, "--log_dir", vttablet.LogDir, "--tablet_hostname", vttablet.TabletHostname, diff --git a/go/test/endtoend/keyspace/keyspace_test.go b/go/test/endtoend/keyspace/keyspace_test.go index c8ff519910f..2c631bd30a8 100644 --- a/go/test/endtoend/keyspace/keyspace_test.go +++ b/go/test/endtoend/keyspace/keyspace_test.go @@ -248,7 +248,7 @@ func TestDeleteKeyspace(t *testing.T) { // Start over and this time use recursive DeleteKeyspace to do everything. _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateKeyspace", "test_delete_keyspace") _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateShard", "test_delete_keyspace/0") - _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--", "--port=1234", "--keyspace=test_delete_keyspace", "--shard=0", "zone1-0000000100", "primary") + _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--", "--port=1234", "--bind_address=127.0.0.1", "--keyspace=test_delete_keyspace", "--shard=0", "zone1-0000000100", "primary") // Create the serving/replication entries and check that they exist, // so we can later check they're deleted. @@ -279,10 +279,10 @@ func TestDeleteKeyspace(t *testing.T) { _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateKeyspace", "test_delete_keyspace_removekscell") _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateShard", "test_delete_keyspace_removekscell/0") _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateShard", "test_delete_keyspace_removekscell/1") - _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "-keyspace=test_delete_keyspace_removekscell", "--shard=0", "zone1-0000000100", "primary") - _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "-keyspace=test_delete_keyspace_removekscell", "--shard=1", "zone1-0000000101", "primary") - _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "-keyspace=test_delete_keyspace_removekscell", "--shard=0", "zone2-0000000100", "replica") - _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "-keyspace=test_delete_keyspace_removekscell", "--shard=1", "zone2-0000000101", "replica") + _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind_address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=0", "zone1-0000000100", "primary") + _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind_address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=1", "zone1-0000000101", "primary") + _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind_address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=0", "zone2-0000000100", "replica") + _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind_address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=1", "zone2-0000000101", "replica") // Create the serving/replication entries and check that they exist, so we can later check they're deleted. _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("RebuildKeyspaceGraph", "test_delete_keyspace_removekscell") diff --git a/go/vt/servenv/grpc_server.go b/go/vt/servenv/grpc_server.go index bd79aed8108..c15559f1288 100644 --- a/go/vt/servenv/grpc_server.go +++ b/go/vt/servenv/grpc_server.go @@ -72,6 +72,9 @@ var ( // gRPCPort is the port to listen on for gRPC. If zero, don't listen. gRPCPort int + // gRPCBindAddress is the address to bind to for gRPC. If empty, bind to all addresses. + gRPCBindAddress string + // gRPCMaxConnectionAge is the maximum age of a client connection, before GoAway is sent. // This is useful for L4 loadbalancing to ensure rebalancing after scaling. gRPCMaxConnectionAge = time.Duration(math.MaxInt64) @@ -124,6 +127,7 @@ var ( func RegisterGRPCServerFlags() { OnParse(func(fs *pflag.FlagSet) { fs.IntVar(&gRPCPort, "grpc_port", gRPCPort, "Port to listen on for gRPC calls. If zero, do not listen.") + fs.StringVar(&gRPCBindAddress, "grpc_bind_address", gRPCBindAddress, "Bind address for gRPC calls. If empty, listen on all addresses.") fs.DurationVar(&gRPCMaxConnectionAge, "grpc_max_connection_age", gRPCMaxConnectionAge, "Maximum age of a client connection before GoAway is sent.") fs.DurationVar(&gRPCMaxConnectionAgeGrace, "grpc_max_connection_age_grace", gRPCMaxConnectionAgeGrace, "Additional grace period after grpc_max_connection_age, after which connections are forcibly closed.") fs.IntVar(&gRPCInitialConnWindowSize, "grpc_server_initial_conn_window_size", gRPCInitialConnWindowSize, "gRPC server initial connection window size") @@ -284,7 +288,7 @@ func serveGRPC() { // listen on the port log.Infof("Listening for gRPC calls on port %v", gRPCPort) - listener, err := net.Listen("tcp", fmt.Sprintf(":%d", gRPCPort)) + listener, err := net.Listen("tcp", fmt.Sprintf("%s:%d", gRPCBindAddress, gRPCPort)) if err != nil { log.Exitf("Cannot listen on port %v for gRPC: %v", gRPCPort, err) } diff --git a/go/vt/servenv/run.go b/go/vt/servenv/run.go index 5b585184331..6e551816bcd 100644 --- a/go/vt/servenv/run.go +++ b/go/vt/servenv/run.go @@ -37,14 +37,14 @@ var ( // Run starts listening for RPC and HTTP requests, // and blocks until it the process gets a signal. -func Run(port int) { +func Run(bindAddress string, port int) { populateListeningURL(int32(port)) createGRPCServer() onRunHooks.Fire() serveGRPC() serveSocketFile() - l, err := net.Listen("tcp", fmt.Sprintf(":%v", port)) + l, err := net.Listen("tcp", fmt.Sprintf("%s:%v", bindAddress, port)) if err != nil { log.Exit(err) } diff --git a/go/vt/servenv/servenv.go b/go/vt/servenv/servenv.go index 662e4da5207..268042a62c9 100644 --- a/go/vt/servenv/servenv.go +++ b/go/vt/servenv/servenv.go @@ -57,7 +57,8 @@ import ( var ( // port is part of the flags used when calling RegisterDefaultFlags. - port int + port int + bindAddress string // mutex used to protect the Init function mu sync.Mutex @@ -263,6 +264,7 @@ func FireRunHooks() { func RegisterDefaultFlags() { OnParse(func(fs *pflag.FlagSet) { fs.IntVar(&port, "port", port, "port for the server") + fs.StringVar(&bindAddress, "bind_address", bindAddress, "bind address for the server") }) } @@ -273,7 +275,7 @@ func Port() int { // RunDefault calls Run() with the parameters from the flags. func RunDefault() { - Run(port) + Run(bindAddress, port) } var ( diff --git a/go/vt/vttest/vtprocess.go b/go/vt/vttest/vtprocess.go index 37582542c02..864799d8d71 100644 --- a/go/vt/vttest/vtprocess.go +++ b/go/vt/vttest/vtprocess.go @@ -126,6 +126,7 @@ func (vtp *VtProcess) WaitStart() (err error) { vtp.proc = exec.Command( vtp.Binary, "--port", fmt.Sprintf("%d", vtp.Port), + "--bind_address", "127.0.0.1", "--log_dir", vtp.LogDirectory, "--alsologtostderr", ) diff --git a/go/vt/wrangler/fake_tablet_test.go b/go/vt/wrangler/fake_tablet_test.go index 8ffae2d7328..ff7fd47fd38 100644 --- a/go/vt/wrangler/fake_tablet_test.go +++ b/go/vt/wrangler/fake_tablet_test.go @@ -153,7 +153,7 @@ func (ft *fakeTablet) StartActionLoop(t *testing.T, wr *Wrangler) { // Listen on a random port for gRPC. var err error - ft.Listener, err = net.Listen("tcp", ":0") + ft.Listener, err = net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatalf("Cannot listen: %v", err) } @@ -162,7 +162,7 @@ func (ft *fakeTablet) StartActionLoop(t *testing.T, wr *Wrangler) { // If needed, listen on a random port for HTTP. vtPort := ft.Tablet.PortMap["vt"] if ft.StartHTTPServer { - ft.HTTPListener, err = net.Listen("tcp", ":0") + ft.HTTPListener, err = net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatalf("Cannot listen on http port: %v", err) } diff --git a/go/vt/wrangler/testlib/fake_tablet.go b/go/vt/wrangler/testlib/fake_tablet.go index 0e4d38f59fc..c5cbdf5714a 100644 --- a/go/vt/wrangler/testlib/fake_tablet.go +++ b/go/vt/wrangler/testlib/fake_tablet.go @@ -180,7 +180,7 @@ func (ft *FakeTablet) StartActionLoop(t *testing.T, wr *wrangler.Wrangler) { // Listen on a random port for gRPC. var err error - ft.Listener, err = net.Listen("tcp", ":0") + ft.Listener, err = net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatalf("Cannot listen: %v", err) } @@ -189,7 +189,7 @@ func (ft *FakeTablet) StartActionLoop(t *testing.T, wr *wrangler.Wrangler) { // If needed, listen on a random port for HTTP. vtPort := ft.Tablet.PortMap["vt"] if ft.StartHTTPServer { - ft.HTTPListener, err = net.Listen("tcp", ":0") + ft.HTTPListener, err = net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatalf("Cannot listen on http port: %v", err) } From 5a518d1de5d4d99dddf302f1f94e06373176e9fe Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 25 Sep 2023 11:37:08 -0400 Subject: [PATCH 02/12] revert test ip address Signed-off-by: Florent Poinsard --- go/vt/wrangler/fake_tablet_test.go | 4 ++-- go/vt/wrangler/testlib/fake_tablet.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go/vt/wrangler/fake_tablet_test.go b/go/vt/wrangler/fake_tablet_test.go index ff7fd47fd38..8ffae2d7328 100644 --- a/go/vt/wrangler/fake_tablet_test.go +++ b/go/vt/wrangler/fake_tablet_test.go @@ -153,7 +153,7 @@ func (ft *fakeTablet) StartActionLoop(t *testing.T, wr *Wrangler) { // Listen on a random port for gRPC. var err error - ft.Listener, err = net.Listen("tcp", "127.0.0.1:0") + ft.Listener, err = net.Listen("tcp", ":0") if err != nil { t.Fatalf("Cannot listen: %v", err) } @@ -162,7 +162,7 @@ func (ft *fakeTablet) StartActionLoop(t *testing.T, wr *Wrangler) { // If needed, listen on a random port for HTTP. vtPort := ft.Tablet.PortMap["vt"] if ft.StartHTTPServer { - ft.HTTPListener, err = net.Listen("tcp", "127.0.0.1:0") + ft.HTTPListener, err = net.Listen("tcp", ":0") if err != nil { t.Fatalf("Cannot listen on http port: %v", err) } diff --git a/go/vt/wrangler/testlib/fake_tablet.go b/go/vt/wrangler/testlib/fake_tablet.go index c5cbdf5714a..0e4d38f59fc 100644 --- a/go/vt/wrangler/testlib/fake_tablet.go +++ b/go/vt/wrangler/testlib/fake_tablet.go @@ -180,7 +180,7 @@ func (ft *FakeTablet) StartActionLoop(t *testing.T, wr *wrangler.Wrangler) { // Listen on a random port for gRPC. var err error - ft.Listener, err = net.Listen("tcp", "127.0.0.1:0") + ft.Listener, err = net.Listen("tcp", ":0") if err != nil { t.Fatalf("Cannot listen: %v", err) } @@ -189,7 +189,7 @@ func (ft *FakeTablet) StartActionLoop(t *testing.T, wr *wrangler.Wrangler) { // If needed, listen on a random port for HTTP. vtPort := ft.Tablet.PortMap["vt"] if ft.StartHTTPServer { - ft.HTTPListener, err = net.Listen("tcp", "127.0.0.1:0") + ft.HTTPListener, err = net.Listen("tcp", ":0") if err != nil { t.Fatalf("Cannot listen on http port: %v", err) } From 8a0c72408ef2c40ce9f0953f62e79a7e524a2795 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 25 Sep 2023 11:58:39 -0400 Subject: [PATCH 03/12] use upper case for flag output Signed-off-by: Florent Poinsard --- go/flags/endtoend/mysqlctld.txt | 2 +- go/flags/endtoend/vtbackup.txt | 2 +- go/flags/endtoend/vtctld.txt | 2 +- go/flags/endtoend/vtgate.txt | 2 +- go/flags/endtoend/vtorc.txt | 2 +- go/flags/endtoend/vttablet.txt | 2 +- go/vt/servenv/servenv.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go/flags/endtoend/mysqlctld.txt b/go/flags/endtoend/mysqlctld.txt index 5b1bfe55f5c..03a7eb0c8e1 100644 --- a/go/flags/endtoend/mysqlctld.txt +++ b/go/flags/endtoend/mysqlctld.txt @@ -22,7 +22,7 @@ Flags: --alsologtostderr log to standard error as well as files --app_idle_timeout duration Idle timeout for app connections (default 1m0s) --app_pool_size int Size of the connection pool for app connections (default 40) - --bind_address string bind address for the server + --bind_address string Bind address for the server --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --config-file string Full path of the config file (with extension) to use. If set, --config-path, --config-type, and --config-name are ignored. --config-file-not-found-handling ConfigFileNotFoundHandling Behavior when a config file is not found. (Options: error, exit, ignore, warn) (default warn) diff --git a/go/flags/endtoend/vtbackup.txt b/go/flags/endtoend/vtbackup.txt index 46a7f2379f2..53ab608f873 100644 --- a/go/flags/endtoend/vtbackup.txt +++ b/go/flags/endtoend/vtbackup.txt @@ -55,7 +55,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind_address string bind address for the server + --bind_address string Bind address for the server --builtinbackup-file-read-buffer-size uint read files using an IO buffer of this many bytes. Golang defaults are used when set to 0. --builtinbackup-file-write-buffer-size uint write files using an IO buffer of this many bytes. Golang defaults are used when set to 0. (default 2097152) --builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s) diff --git a/go/flags/endtoend/vtctld.txt b/go/flags/endtoend/vtctld.txt index f54fffdf516..f23c4ece1cd 100644 --- a/go/flags/endtoend/vtctld.txt +++ b/go/flags/endtoend/vtctld.txt @@ -34,7 +34,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind_address string bind address for the server + --bind_address string Bind address for the server --builtinbackup-file-read-buffer-size uint read files using an IO buffer of this many bytes. Golang defaults are used when set to 0. --builtinbackup-file-write-buffer-size uint write files using an IO buffer of this many bytes. Golang defaults are used when set to 0. (default 2097152) --builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s) diff --git a/go/flags/endtoend/vtgate.txt b/go/flags/endtoend/vtgate.txt index 26ebb3cd4fb..517654ec05e 100644 --- a/go/flags/endtoend/vtgate.txt +++ b/go/flags/endtoend/vtgate.txt @@ -28,7 +28,7 @@ Flags: --allow-kill-statement Allows the execution of kill statement --allowed_tablet_types strings Specifies the tablet types this vtgate is allowed to route queries to. Should be provided as a comma-separated set of tablet types. --alsologtostderr log to standard error as well as files - --bind_address string bind address for the server + --bind_address string Bind address for the server --buffer_drain_concurrency int Maximum number of requests retried simultaneously. More concurrency will increase the load on the PRIMARY vttablet when draining the buffer. (default 1) --buffer_keyspace_shards string If not empty, limit buffering to these entries (comma separated). Entry format: keyspace or keyspace/shard. Requires --enable_buffer=true. --buffer_max_failover_duration duration Stop buffering completely if a failover takes longer than this duration. (default 20s) diff --git a/go/flags/endtoend/vtorc.txt b/go/flags/endtoend/vtorc.txt index cb2c8992c68..d1b396e52ee 100644 --- a/go/flags/endtoend/vtorc.txt +++ b/go/flags/endtoend/vtorc.txt @@ -22,7 +22,7 @@ Flags: --audit-purge-duration duration Duration for which audit logs are held before being purged. Should be in multiples of days (default 168h0m0s) --audit-to-backend Whether to store the audit log in the VTOrc database --audit-to-syslog Whether to store the audit log in the syslog - --bind_address string bind address for the server + --bind_address string Bind address for the server --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --change-tablets-with-errant-gtid-to-drained Whether VTOrc should be changing the type of tablets with errant GTIDs to DRAINED --clusters_to_watch strings Comma-separated list of keyspaces or keyspace/shards that this instance will monitor and repair. Defaults to all clusters in the topology. Example: "ks1,ks2/-80" diff --git a/go/flags/endtoend/vttablet.txt b/go/flags/endtoend/vttablet.txt index 10df0a1472e..5db23546f1b 100644 --- a/go/flags/endtoend/vttablet.txt +++ b/go/flags/endtoend/vttablet.txt @@ -56,7 +56,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind_address string bind address for the server + --bind_address string Bind address for the server --binlog_host string PITR restore parameter: hostname/IP of binlog server. --binlog_password string PITR restore parameter: password of binlog server. --binlog_player_grpc_ca string the server ca to use to validate servers when connecting diff --git a/go/vt/servenv/servenv.go b/go/vt/servenv/servenv.go index 1efb2553fd2..b5ad0e32312 100644 --- a/go/vt/servenv/servenv.go +++ b/go/vt/servenv/servenv.go @@ -267,7 +267,7 @@ func FireRunHooks() { func RegisterDefaultFlags() { OnParse(func(fs *pflag.FlagSet) { fs.IntVar(&port, "port", port, "port for the server") - fs.StringVar(&bindAddress, "bind_address", bindAddress, "bind address for the server") + fs.StringVar(&bindAddress, "bind_address", bindAddress, "Bind address for the server") }) } From 404aa6aeecce403bd725d679f25629be2fc9f64e Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 25 Sep 2023 16:52:00 -0400 Subject: [PATCH 04/12] use proper hostname in fake tablets Signed-off-by: Florent Poinsard --- docker/vttestserver/run.sh | 1 - go/vt/wrangler/fake_tablet_test.go | 5 +++-- go/vt/wrangler/testlib/fake_tablet.go | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docker/vttestserver/run.sh b/docker/vttestserver/run.sh index 3963e8b3624..1ff79153af5 100755 --- a/docker/vttestserver/run.sh +++ b/docker/vttestserver/run.sh @@ -32,7 +32,6 @@ rm -vf "$VTDATAROOT"/"$tablet_dir"/{mysql.sock,mysql.sock.lock} # Run the vttestserver binary /vt/bin/vttestserver \ --port "$PORT" \ - --bind_address "${MYSQL_BIND_HOST:-127.0.0.1}" \ --keyspaces "$KEYSPACES" \ --num_shards "$NUM_SHARDS" \ --mysql_bind_host "${MYSQL_BIND_HOST:-127.0.0.1}" \ diff --git a/go/vt/wrangler/fake_tablet_test.go b/go/vt/wrangler/fake_tablet_test.go index d81443777f7..0fc9487eeca 100644 --- a/go/vt/wrangler/fake_tablet_test.go +++ b/go/vt/wrangler/fake_tablet_test.go @@ -164,7 +164,7 @@ func (ft *fakeTablet) StartActionLoop(t *testing.T, wr *Wrangler) { // Listen on a random port for gRPC. var err error - ft.Listener, err = net.Listen("tcp", ":0") + ft.Listener, err = net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatalf("Cannot listen: %v", err) } @@ -173,7 +173,7 @@ func (ft *fakeTablet) StartActionLoop(t *testing.T, wr *Wrangler) { // If needed, listen on a random port for HTTP. vtPort := ft.Tablet.PortMap["vt"] if ft.StartHTTPServer { - ft.HTTPListener, err = net.Listen("tcp", ":0") + ft.HTTPListener, err = net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatalf("Cannot listen on http port: %v", err) } @@ -186,6 +186,7 @@ func (ft *fakeTablet) StartActionLoop(t *testing.T, wr *Wrangler) { } ft.Tablet.PortMap["vt"] = vtPort ft.Tablet.PortMap["grpc"] = gRPCPort + ft.Tablet.Hostname = "127.0.0.1" // Create a test tm on that port, and re-read the record // (it has new ports and IP). diff --git a/go/vt/wrangler/testlib/fake_tablet.go b/go/vt/wrangler/testlib/fake_tablet.go index 7d840e13c16..6fc68c6c6a5 100644 --- a/go/vt/wrangler/testlib/fake_tablet.go +++ b/go/vt/wrangler/testlib/fake_tablet.go @@ -180,7 +180,7 @@ func (ft *FakeTablet) StartActionLoop(t *testing.T, wr *wrangler.Wrangler) { // Listen on a random port for gRPC. var err error - ft.Listener, err = net.Listen("tcp", ":0") + ft.Listener, err = net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatalf("Cannot listen: %v", err) } @@ -189,7 +189,7 @@ func (ft *FakeTablet) StartActionLoop(t *testing.T, wr *wrangler.Wrangler) { // If needed, listen on a random port for HTTP. vtPort := ft.Tablet.PortMap["vt"] if ft.StartHTTPServer { - ft.HTTPListener, err = net.Listen("tcp", ":0") + ft.HTTPListener, err = net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatalf("Cannot listen on http port: %v", err) } @@ -202,6 +202,7 @@ func (ft *FakeTablet) StartActionLoop(t *testing.T, wr *wrangler.Wrangler) { } ft.Tablet.PortMap["vt"] = vtPort ft.Tablet.PortMap["grpc"] = gRPCPort + ft.Tablet.Hostname = "127.0.0.1" // Create a test tm on that port, and re-read the record // (it has new ports and IP). From 076fdad4069cf5029f912359c19d5fc3e7d4136b Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 25 Sep 2023 17:02:06 -0400 Subject: [PATCH 05/12] apply review suggestions Signed-off-by: Florent Poinsard --- go/test/endtoend/cluster/cluster_process.go | 2 +- go/vt/servenv/grpc_server.go | 4 ++-- go/vt/servenv/run.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go/test/endtoend/cluster/cluster_process.go b/go/test/endtoend/cluster/cluster_process.go index 8452b86f2f5..f74a031f4d8 100644 --- a/go/test/endtoend/cluster/cluster_process.go +++ b/go/test/endtoend/cluster/cluster_process.go @@ -1127,7 +1127,7 @@ func (cluster *LocalProcessCluster) GetAndReservePort() int { for { cluster.nextPortForProcess = cluster.nextPortForProcess + 1 log.Infof("Attempting to reserve port: %v", cluster.nextPortForProcess) - ln, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%v", cluster.nextPortForProcess)) + ln, err := net.Listen("tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(cluster.nextPortForProcess))) if err != nil { log.Errorf("Can't listen on port %v: %s, trying next port", cluster.nextPortForProcess, err) diff --git a/go/vt/servenv/grpc_server.go b/go/vt/servenv/grpc_server.go index c15559f1288..7a41cca389a 100644 --- a/go/vt/servenv/grpc_server.go +++ b/go/vt/servenv/grpc_server.go @@ -19,9 +19,9 @@ package servenv import ( "context" "crypto/tls" - "fmt" "math" "net" + "strconv" "time" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" @@ -288,7 +288,7 @@ func serveGRPC() { // listen on the port log.Infof("Listening for gRPC calls on port %v", gRPCPort) - listener, err := net.Listen("tcp", fmt.Sprintf("%s:%d", gRPCBindAddress, gRPCPort)) + listener, err := net.Listen("tcp", net.JoinHostPort(gRPCBindAddress, strconv.Itoa(gRPCPort))) if err != nil { log.Exitf("Cannot listen on port %v for gRPC: %v", gRPCPort, err) } diff --git a/go/vt/servenv/run.go b/go/vt/servenv/run.go index 6e551816bcd..ec0d8971e56 100644 --- a/go/vt/servenv/run.go +++ b/go/vt/servenv/run.go @@ -17,11 +17,11 @@ limitations under the License. package servenv import ( - "fmt" "net" "net/url" "os" "os/signal" + "strconv" "syscall" "time" @@ -44,7 +44,7 @@ func Run(bindAddress string, port int) { serveGRPC() serveSocketFile() - l, err := net.Listen("tcp", fmt.Sprintf("%s:%v", bindAddress, port)) + l, err := net.Listen("tcp", net.JoinHostPort(bindAddress, strconv.Itoa(port))) if err != nil { log.Exit(err) } From 048d539fcc35aba56c7c1dbfa80b33a69af7b6f8 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 25 Sep 2023 17:07:19 -0400 Subject: [PATCH 06/12] fix help text output Signed-off-by: Florent Poinsard --- go/flags/endtoend/mysqlctld.txt | 2 +- go/flags/endtoend/vtbackup.txt | 2 +- go/flags/endtoend/vtctld.txt | 2 +- go/flags/endtoend/vtgate.txt | 2 +- go/flags/endtoend/vtorc.txt | 2 +- go/flags/endtoend/vttablet.txt | 2 +- go/vt/servenv/servenv.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go/flags/endtoend/mysqlctld.txt b/go/flags/endtoend/mysqlctld.txt index 03a7eb0c8e1..49a34ae75b0 100644 --- a/go/flags/endtoend/mysqlctld.txt +++ b/go/flags/endtoend/mysqlctld.txt @@ -22,7 +22,7 @@ Flags: --alsologtostderr log to standard error as well as files --app_idle_timeout duration Idle timeout for app connections (default 1m0s) --app_pool_size int Size of the connection pool for app connections (default 40) - --bind_address string Bind address for the server + --bind_address string Bind address for the server. --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --config-file string Full path of the config file (with extension) to use. If set, --config-path, --config-type, and --config-name are ignored. --config-file-not-found-handling ConfigFileNotFoundHandling Behavior when a config file is not found. (Options: error, exit, ignore, warn) (default warn) diff --git a/go/flags/endtoend/vtbackup.txt b/go/flags/endtoend/vtbackup.txt index 53ab608f873..414c5915750 100644 --- a/go/flags/endtoend/vtbackup.txt +++ b/go/flags/endtoend/vtbackup.txt @@ -55,7 +55,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind_address string Bind address for the server + --bind_address string Bind address for the server. --builtinbackup-file-read-buffer-size uint read files using an IO buffer of this many bytes. Golang defaults are used when set to 0. --builtinbackup-file-write-buffer-size uint write files using an IO buffer of this many bytes. Golang defaults are used when set to 0. (default 2097152) --builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s) diff --git a/go/flags/endtoend/vtctld.txt b/go/flags/endtoend/vtctld.txt index f23c4ece1cd..67f933b6bf2 100644 --- a/go/flags/endtoend/vtctld.txt +++ b/go/flags/endtoend/vtctld.txt @@ -34,7 +34,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind_address string Bind address for the server + --bind_address string Bind address for the server. --builtinbackup-file-read-buffer-size uint read files using an IO buffer of this many bytes. Golang defaults are used when set to 0. --builtinbackup-file-write-buffer-size uint write files using an IO buffer of this many bytes. Golang defaults are used when set to 0. (default 2097152) --builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s) diff --git a/go/flags/endtoend/vtgate.txt b/go/flags/endtoend/vtgate.txt index 517654ec05e..d7f8d86edba 100644 --- a/go/flags/endtoend/vtgate.txt +++ b/go/flags/endtoend/vtgate.txt @@ -28,7 +28,7 @@ Flags: --allow-kill-statement Allows the execution of kill statement --allowed_tablet_types strings Specifies the tablet types this vtgate is allowed to route queries to. Should be provided as a comma-separated set of tablet types. --alsologtostderr log to standard error as well as files - --bind_address string Bind address for the server + --bind_address string Bind address for the server. --buffer_drain_concurrency int Maximum number of requests retried simultaneously. More concurrency will increase the load on the PRIMARY vttablet when draining the buffer. (default 1) --buffer_keyspace_shards string If not empty, limit buffering to these entries (comma separated). Entry format: keyspace or keyspace/shard. Requires --enable_buffer=true. --buffer_max_failover_duration duration Stop buffering completely if a failover takes longer than this duration. (default 20s) diff --git a/go/flags/endtoend/vtorc.txt b/go/flags/endtoend/vtorc.txt index d1b396e52ee..2b7c4c46fd2 100644 --- a/go/flags/endtoend/vtorc.txt +++ b/go/flags/endtoend/vtorc.txt @@ -22,7 +22,7 @@ Flags: --audit-purge-duration duration Duration for which audit logs are held before being purged. Should be in multiples of days (default 168h0m0s) --audit-to-backend Whether to store the audit log in the VTOrc database --audit-to-syslog Whether to store the audit log in the syslog - --bind_address string Bind address for the server + --bind_address string Bind address for the server. --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --change-tablets-with-errant-gtid-to-drained Whether VTOrc should be changing the type of tablets with errant GTIDs to DRAINED --clusters_to_watch strings Comma-separated list of keyspaces or keyspace/shards that this instance will monitor and repair. Defaults to all clusters in the topology. Example: "ks1,ks2/-80" diff --git a/go/flags/endtoend/vttablet.txt b/go/flags/endtoend/vttablet.txt index 5db23546f1b..72e91f1f3f0 100644 --- a/go/flags/endtoend/vttablet.txt +++ b/go/flags/endtoend/vttablet.txt @@ -56,7 +56,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind_address string Bind address for the server + --bind_address string Bind address for the server. --binlog_host string PITR restore parameter: hostname/IP of binlog server. --binlog_password string PITR restore parameter: password of binlog server. --binlog_player_grpc_ca string the server ca to use to validate servers when connecting diff --git a/go/vt/servenv/servenv.go b/go/vt/servenv/servenv.go index b5ad0e32312..ce69ad70d33 100644 --- a/go/vt/servenv/servenv.go +++ b/go/vt/servenv/servenv.go @@ -267,7 +267,7 @@ func FireRunHooks() { func RegisterDefaultFlags() { OnParse(func(fs *pflag.FlagSet) { fs.IntVar(&port, "port", port, "port for the server") - fs.StringVar(&bindAddress, "bind_address", bindAddress, "Bind address for the server") + fs.StringVar(&bindAddress, "bind_address", bindAddress, "Bind address for the server.") }) } From d473fbeebcd6b8db8122f9b2ffe11a08b3f6460e Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 25 Sep 2023 17:16:24 -0400 Subject: [PATCH 07/12] remove bind_address Signed-off-by: Florent Poinsard --- go/cmd/vttestserver/vttestserver_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/go/cmd/vttestserver/vttestserver_test.go b/go/cmd/vttestserver/vttestserver_test.go index a8622ac94a8..226d66305be 100644 --- a/go/cmd/vttestserver/vttestserver_test.go +++ b/go/cmd/vttestserver/vttestserver_test.go @@ -312,7 +312,6 @@ func startPersistentCluster(dir string, flags ...string) (vttest.LocalCluster, e "--persistent_mode", // FIXME: if port is not provided, data_dir is not respected fmt.Sprintf("--port=%d", randomPort()), - "--bind_address=127.0.0.1", fmt.Sprintf("--data_dir=%s", dir), }...) return startCluster(flags...) From 2ee356bb8ce3a6f15d79387e550a98fb7273b08a Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 25 Sep 2023 17:37:52 -0400 Subject: [PATCH 08/12] use localhost in fake tablet Signed-off-by: Florent Poinsard --- go/vt/wrangler/testlib/fake_tablet.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/go/vt/wrangler/testlib/fake_tablet.go b/go/vt/wrangler/testlib/fake_tablet.go index 6fc68c6c6a5..a1b30813f53 100644 --- a/go/vt/wrangler/testlib/fake_tablet.go +++ b/go/vt/wrangler/testlib/fake_tablet.go @@ -27,11 +27,9 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" "google.golang.org/grpc" "vitess.io/vitess/go/mysql/fakesqldb" - "vitess.io/vitess/go/netutil" "vitess.io/vitess/go/vt/binlog/binlogplayer" "vitess.io/vitess/go/vt/dbconfigs" "vitess.io/vitess/go/vt/mysqlctl" @@ -132,12 +130,10 @@ func NewFakeTablet(t *testing.T, wr *wrangler.Wrangler, cell string, uid uint32, t.Fatalf("uid has to be between 0 and 99: %v", uid) } mysqlPort := int32(3300 + uid) - hostname, err := netutil.FullyQualifiedHostname() - require.NoError(t, err) tablet := &topodatapb.Tablet{ Alias: &topodatapb.TabletAlias{Cell: cell, Uid: uid}, - Hostname: hostname, - MysqlHostname: hostname, + Hostname: "127.0.0.1", + MysqlHostname: "127.0.0.1", PortMap: map[string]int32{ "vt": int32(8100 + uid), "grpc": int32(8200 + uid), From c466daa75c214704870902b3ea45de0cc84cd11d Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 25 Sep 2023 19:42:56 -0400 Subject: [PATCH 09/12] compatible downgrade tests Signed-off-by: Florent Poinsard --- go/test/endtoend/cluster/vtctld_process.go | 10 ++++++++-- go/test/endtoend/cluster/vtgate_process.go | 8 ++++++-- go/test/endtoend/cluster/vtorc_process.go | 8 +++++++- go/test/endtoend/cluster/vttablet_process.go | 9 +++++++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/go/test/endtoend/cluster/vtctld_process.go b/go/test/endtoend/cluster/vtctld_process.go index e429754a478..c337c008a7b 100644 --- a/go/test/endtoend/cluster/vtctld_process.go +++ b/go/test/endtoend/cluster/vtctld_process.go @@ -64,10 +64,16 @@ func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error) "--file_backup_storage_root", vtctld.FileBackupStorageRoot, "--log_dir", vtctld.LogDir, "--port", fmt.Sprintf("%d", vtctld.Port), - "--bind_address", "127.0.0.1", "--grpc_port", fmt.Sprintf("%d", vtctld.GrpcPort), - "--grpc_bind_address", "127.0.0.1", ) + + if v, err := GetMajorVersion("vtctld"); err != nil { + return err + } else if v >= 18 { + vtctld.proc.Args = append(vtctld.proc.Args, "--bind_address", "127.0.0.1") + vtctld.proc.Args = append(vtctld.proc.Args, "--grpc_bind_address", "127.0.0.1") + } + if *isCoverage { vtctld.proc.Args = append(vtctld.proc.Args, "--test.coverprofile="+getCoveragePath("vtctld.out")) } diff --git a/go/test/endtoend/cluster/vtgate_process.go b/go/test/endtoend/cluster/vtgate_process.go index c44fbde7803..16972217cd0 100644 --- a/go/test/endtoend/cluster/vtgate_process.go +++ b/go/test/endtoend/cluster/vtgate_process.go @@ -77,9 +77,7 @@ func (vtgate *VtgateProcess) Setup() (err error) { "--log_dir", vtgate.LogDir, "--log_queries_to_file", vtgate.FileToLogQueries, "--port", fmt.Sprintf("%d", vtgate.Port), - "--bind_address", "127.0.0.1", "--grpc_port", fmt.Sprintf("%d", vtgate.GrpcPort), - "--grpc_bind_address", "127.0.0.1", "--mysql_server_port", fmt.Sprintf("%d", vtgate.MySQLServerPort), "--mysql_server_socket_path", vtgate.MySQLServerSocketPath, "--cell", vtgate.Cell, @@ -88,6 +86,12 @@ func (vtgate *VtgateProcess) Setup() (err error) { "--service_map", vtgate.ServiceMap, "--mysql_auth_server_impl", vtgate.MySQLAuthServerImpl, } + if v, err := GetMajorVersion("vtgate"); err != nil { + return err + } else if v >= 18 { + args = append(args, "--bind_address", "127.0.0.1") + args = append(args, "--grpc_bind_address", "127.0.0.1") + } // If no explicit mysql_server_version has been specified then we autodetect // the MySQL version that will be used for the test and base the vtgate's // mysql server version on that. diff --git a/go/test/endtoend/cluster/vtorc_process.go b/go/test/endtoend/cluster/vtorc_process.go index 35f8ddf9586..5e35c3dac63 100644 --- a/go/test/endtoend/cluster/vtorc_process.go +++ b/go/test/endtoend/cluster/vtorc_process.go @@ -112,7 +112,6 @@ func (orc *VTOrcProcess) Setup() (err error) { "--topo_global_root", orc.TopoGlobalRoot, "--config", orc.ConfigPath, "--port", fmt.Sprintf("%d", orc.Port), - "--bind_address", "127.0.0.1", // This parameter is overriden from the config file, added here to just verify that we indeed use the config file paramter over the flag "--recovery-period-block-duration", "10h", "--instance-poll-time", "1s", @@ -120,6 +119,13 @@ func (orc *VTOrcProcess) Setup() (err error) { "--topo-information-refresh-duration", "3s", "--orc_web_dir", path.Join(os.Getenv("VTROOT"), "web", "vtorc"), ) + + if v, err := GetMajorVersion("vtorc"); err != nil { + return err + } else if v >= 18 { + orc.proc.Args = append(orc.proc.Args, "--bind_address", "127.0.0.1") + } + if *isCoverage { orc.proc.Args = append(orc.proc.Args, "--test.coverprofile="+getCoveragePath("orc.out")) } diff --git a/go/test/endtoend/cluster/vttablet_process.go b/go/test/endtoend/cluster/vttablet_process.go index cc1cb9e7d73..bcc1be21866 100644 --- a/go/test/endtoend/cluster/vttablet_process.go +++ b/go/test/endtoend/cluster/vttablet_process.go @@ -98,9 +98,7 @@ func (vttablet *VttabletProcess) Setup() (err error) { "--log_queries_to_file", vttablet.FileToLogQueries, "--tablet-path", vttablet.TabletPath, "--port", fmt.Sprintf("%d", vttablet.Port), - "--bind_address", "127.0.0.1", "--grpc_port", fmt.Sprintf("%d", vttablet.GrpcPort), - "--grpc_bind_address", "127.0.0.1", "--init_shard", vttablet.Shard, "--log_dir", vttablet.LogDir, "--tablet_hostname", vttablet.TabletHostname, @@ -116,6 +114,13 @@ func (vttablet *VttabletProcess) Setup() (err error) { "--vreplication_tablet_type", vttablet.VreplicationTabletType, "--db_charset", vttablet.Charset, ) + if v, err := GetMajorVersion("vttablet"); err != nil { + return err + } else if v >= 18 { + vttablet.proc.Args = append(vttablet.proc.Args, "--bind_address", "127.0.0.1") + vttablet.proc.Args = append(vttablet.proc.Args, "--grpc_bind_address", "127.0.0.1") + } + if *isCoverage { vttablet.proc.Args = append(vttablet.proc.Args, "--test.coverprofile="+getCoveragePath("vttablet.out")) } From 4fd296bc2b361f7ca7be598cbe27208c640c937f Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Wed, 27 Sep 2023 15:46:07 -0600 Subject: [PATCH 10/12] use dash instead of underscore Signed-off-by: Florent Poinsard --- go/flags/endtoend/mysqlctld.txt | 4 ++-- go/flags/endtoend/vtbackup.txt | 2 +- go/flags/endtoend/vtctld.txt | 4 ++-- go/flags/endtoend/vtgate.txt | 4 ++-- go/flags/endtoend/vtorc.txt | 2 +- go/flags/endtoend/vttablet.txt | 4 ++-- go/flags/endtoend/vttestserver.txt | 2 +- go/test/endtoend/cluster/vtctld_process.go | 4 ++-- go/test/endtoend/cluster/vtgate_process.go | 4 ++-- go/test/endtoend/cluster/vtorc_process.go | 2 +- go/test/endtoend/cluster/vttablet_process.go | 4 ++-- go/test/endtoend/keyspace/keyspace_test.go | 10 +++++----- go/vt/servenv/grpc_server.go | 2 +- go/vt/servenv/servenv.go | 2 +- go/vt/vttest/vtprocess.go | 2 +- 15 files changed, 26 insertions(+), 26 deletions(-) diff --git a/go/flags/endtoend/mysqlctld.txt b/go/flags/endtoend/mysqlctld.txt index 49a34ae75b0..892257e77b0 100644 --- a/go/flags/endtoend/mysqlctld.txt +++ b/go/flags/endtoend/mysqlctld.txt @@ -22,7 +22,7 @@ Flags: --alsologtostderr log to standard error as well as files --app_idle_timeout duration Idle timeout for app connections (default 1m0s) --app_pool_size int Size of the connection pool for app connections (default 40) - --bind_address string Bind address for the server. + --bind-address string Bind address for the server. --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --config-file string Full path of the config file (with extension) to use. If set, --config-path, --config-type, and --config-name are ignored. --config-file-not-found-handling ConfigFileNotFoundHandling Behavior when a config file is not found. (Options: error, exit, ignore, warn) (default warn) @@ -65,7 +65,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vtbackup.txt b/go/flags/endtoend/vtbackup.txt index 414c5915750..791b6c5cf45 100644 --- a/go/flags/endtoend/vtbackup.txt +++ b/go/flags/endtoend/vtbackup.txt @@ -55,7 +55,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind_address string Bind address for the server. + --bind-address string Bind address for the server. --builtinbackup-file-read-buffer-size uint read files using an IO buffer of this many bytes. Golang defaults are used when set to 0. --builtinbackup-file-write-buffer-size uint write files using an IO buffer of this many bytes. Golang defaults are used when set to 0. (default 2097152) --builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s) diff --git a/go/flags/endtoend/vtctld.txt b/go/flags/endtoend/vtctld.txt index 67f933b6bf2..7c5c9edec6f 100644 --- a/go/flags/endtoend/vtctld.txt +++ b/go/flags/endtoend/vtctld.txt @@ -34,7 +34,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind_address string Bind address for the server. + --bind-address string Bind address for the server. --builtinbackup-file-read-buffer-size uint read files using an IO buffer of this many bytes. Golang defaults are used when set to 0. --builtinbackup-file-write-buffer-size uint write files using an IO buffer of this many bytes. Golang defaults are used when set to 0. (default 2097152) --builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s) @@ -60,7 +60,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vtgate.txt b/go/flags/endtoend/vtgate.txt index d7f8d86edba..c985b43d402 100644 --- a/go/flags/endtoend/vtgate.txt +++ b/go/flags/endtoend/vtgate.txt @@ -28,7 +28,7 @@ Flags: --allow-kill-statement Allows the execution of kill statement --allowed_tablet_types strings Specifies the tablet types this vtgate is allowed to route queries to. Should be provided as a comma-separated set of tablet types. --alsologtostderr log to standard error as well as files - --bind_address string Bind address for the server. + --bind-address string Bind address for the server. --buffer_drain_concurrency int Maximum number of requests retried simultaneously. More concurrency will increase the load on the PRIMARY vttablet when draining the buffer. (default 1) --buffer_keyspace_shards string If not empty, limit buffering to these entries (comma separated). Entry format: keyspace or keyspace/shard. Requires --enable_buffer=true. --buffer_max_failover_duration duration Stop buffering completely if a failover takes longer than this duration. (default 20s) @@ -71,7 +71,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vtorc.txt b/go/flags/endtoend/vtorc.txt index 2b7c4c46fd2..fc2437f318f 100644 --- a/go/flags/endtoend/vtorc.txt +++ b/go/flags/endtoend/vtorc.txt @@ -22,7 +22,7 @@ Flags: --audit-purge-duration duration Duration for which audit logs are held before being purged. Should be in multiples of days (default 168h0m0s) --audit-to-backend Whether to store the audit log in the VTOrc database --audit-to-syslog Whether to store the audit log in the syslog - --bind_address string Bind address for the server. + --bind-address string Bind address for the server. --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --change-tablets-with-errant-gtid-to-drained Whether VTOrc should be changing the type of tablets with errant GTIDs to DRAINED --clusters_to_watch strings Comma-separated list of keyspaces or keyspace/shards that this instance will monitor and repair. Defaults to all clusters in the topology. Example: "ks1,ks2/-80" diff --git a/go/flags/endtoend/vttablet.txt b/go/flags/endtoend/vttablet.txt index 72e91f1f3f0..126bef0337b 100644 --- a/go/flags/endtoend/vttablet.txt +++ b/go/flags/endtoend/vttablet.txt @@ -56,7 +56,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind_address string Bind address for the server. + --bind-address string Bind address for the server. --binlog_host string PITR restore parameter: hostname/IP of binlog server. --binlog_password string PITR restore parameter: password of binlog server. --binlog_player_grpc_ca string the server ca to use to validate servers when connecting @@ -171,7 +171,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vttestserver.txt b/go/flags/endtoend/vttestserver.txt index cb23f4aba34..0af164fed6a 100644 --- a/go/flags/endtoend/vttestserver.txt +++ b/go/flags/endtoend/vttestserver.txt @@ -42,7 +42,7 @@ Usage of vttestserver: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/test/endtoend/cluster/vtctld_process.go b/go/test/endtoend/cluster/vtctld_process.go index c337c008a7b..7890bfe909f 100644 --- a/go/test/endtoend/cluster/vtctld_process.go +++ b/go/test/endtoend/cluster/vtctld_process.go @@ -70,8 +70,8 @@ func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error) if v, err := GetMajorVersion("vtctld"); err != nil { return err } else if v >= 18 { - vtctld.proc.Args = append(vtctld.proc.Args, "--bind_address", "127.0.0.1") - vtctld.proc.Args = append(vtctld.proc.Args, "--grpc_bind_address", "127.0.0.1") + vtctld.proc.Args = append(vtctld.proc.Args, "--bind-address", "127.0.0.1") + vtctld.proc.Args = append(vtctld.proc.Args, "--grpc_bind-address", "127.0.0.1") } if *isCoverage { diff --git a/go/test/endtoend/cluster/vtgate_process.go b/go/test/endtoend/cluster/vtgate_process.go index 16972217cd0..28804028c8f 100644 --- a/go/test/endtoend/cluster/vtgate_process.go +++ b/go/test/endtoend/cluster/vtgate_process.go @@ -89,8 +89,8 @@ func (vtgate *VtgateProcess) Setup() (err error) { if v, err := GetMajorVersion("vtgate"); err != nil { return err } else if v >= 18 { - args = append(args, "--bind_address", "127.0.0.1") - args = append(args, "--grpc_bind_address", "127.0.0.1") + args = append(args, "--bind-address", "127.0.0.1") + args = append(args, "--grpc_bind-address", "127.0.0.1") } // If no explicit mysql_server_version has been specified then we autodetect // the MySQL version that will be used for the test and base the vtgate's diff --git a/go/test/endtoend/cluster/vtorc_process.go b/go/test/endtoend/cluster/vtorc_process.go index 5e35c3dac63..377604a6662 100644 --- a/go/test/endtoend/cluster/vtorc_process.go +++ b/go/test/endtoend/cluster/vtorc_process.go @@ -123,7 +123,7 @@ func (orc *VTOrcProcess) Setup() (err error) { if v, err := GetMajorVersion("vtorc"); err != nil { return err } else if v >= 18 { - orc.proc.Args = append(orc.proc.Args, "--bind_address", "127.0.0.1") + orc.proc.Args = append(orc.proc.Args, "--bind-address", "127.0.0.1") } if *isCoverage { diff --git a/go/test/endtoend/cluster/vttablet_process.go b/go/test/endtoend/cluster/vttablet_process.go index bcc1be21866..8e198028514 100644 --- a/go/test/endtoend/cluster/vttablet_process.go +++ b/go/test/endtoend/cluster/vttablet_process.go @@ -117,8 +117,8 @@ func (vttablet *VttabletProcess) Setup() (err error) { if v, err := GetMajorVersion("vttablet"); err != nil { return err } else if v >= 18 { - vttablet.proc.Args = append(vttablet.proc.Args, "--bind_address", "127.0.0.1") - vttablet.proc.Args = append(vttablet.proc.Args, "--grpc_bind_address", "127.0.0.1") + vttablet.proc.Args = append(vttablet.proc.Args, "--bind-address", "127.0.0.1") + vttablet.proc.Args = append(vttablet.proc.Args, "--grpc_bind-address", "127.0.0.1") } if *isCoverage { diff --git a/go/test/endtoend/keyspace/keyspace_test.go b/go/test/endtoend/keyspace/keyspace_test.go index 2c631bd30a8..338ad5c8cd2 100644 --- a/go/test/endtoend/keyspace/keyspace_test.go +++ b/go/test/endtoend/keyspace/keyspace_test.go @@ -248,7 +248,7 @@ func TestDeleteKeyspace(t *testing.T) { // Start over and this time use recursive DeleteKeyspace to do everything. _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateKeyspace", "test_delete_keyspace") _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateShard", "test_delete_keyspace/0") - _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--", "--port=1234", "--bind_address=127.0.0.1", "--keyspace=test_delete_keyspace", "--shard=0", "zone1-0000000100", "primary") + _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--", "--port=1234", "--bind-address=127.0.0.1", "--keyspace=test_delete_keyspace", "--shard=0", "zone1-0000000100", "primary") // Create the serving/replication entries and check that they exist, // so we can later check they're deleted. @@ -279,10 +279,10 @@ func TestDeleteKeyspace(t *testing.T) { _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateKeyspace", "test_delete_keyspace_removekscell") _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateShard", "test_delete_keyspace_removekscell/0") _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("CreateShard", "test_delete_keyspace_removekscell/1") - _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind_address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=0", "zone1-0000000100", "primary") - _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind_address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=1", "zone1-0000000101", "primary") - _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind_address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=0", "zone2-0000000100", "replica") - _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind_address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=1", "zone2-0000000101", "replica") + _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind-address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=0", "zone1-0000000100", "primary") + _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind-address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=1", "zone1-0000000101", "primary") + _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind-address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=0", "zone2-0000000100", "replica") + _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("InitTablet", "--port=1234", "--bind-address=127.0.0.1", "-keyspace=test_delete_keyspace_removekscell", "--shard=1", "zone2-0000000101", "replica") // Create the serving/replication entries and check that they exist, so we can later check they're deleted. _ = clusterForKSTest.VtctlclientProcess.ExecuteCommand("RebuildKeyspaceGraph", "test_delete_keyspace_removekscell") diff --git a/go/vt/servenv/grpc_server.go b/go/vt/servenv/grpc_server.go index 7a41cca389a..78f1517bf72 100644 --- a/go/vt/servenv/grpc_server.go +++ b/go/vt/servenv/grpc_server.go @@ -127,7 +127,7 @@ var ( func RegisterGRPCServerFlags() { OnParse(func(fs *pflag.FlagSet) { fs.IntVar(&gRPCPort, "grpc_port", gRPCPort, "Port to listen on for gRPC calls. If zero, do not listen.") - fs.StringVar(&gRPCBindAddress, "grpc_bind_address", gRPCBindAddress, "Bind address for gRPC calls. If empty, listen on all addresses.") + fs.StringVar(&gRPCBindAddress, "grpc_bind-address", gRPCBindAddress, "Bind address for gRPC calls. If empty, listen on all addresses.") fs.DurationVar(&gRPCMaxConnectionAge, "grpc_max_connection_age", gRPCMaxConnectionAge, "Maximum age of a client connection before GoAway is sent.") fs.DurationVar(&gRPCMaxConnectionAgeGrace, "grpc_max_connection_age_grace", gRPCMaxConnectionAgeGrace, "Additional grace period after grpc_max_connection_age, after which connections are forcibly closed.") fs.IntVar(&gRPCInitialConnWindowSize, "grpc_server_initial_conn_window_size", gRPCInitialConnWindowSize, "gRPC server initial connection window size") diff --git a/go/vt/servenv/servenv.go b/go/vt/servenv/servenv.go index ce69ad70d33..19705f14e27 100644 --- a/go/vt/servenv/servenv.go +++ b/go/vt/servenv/servenv.go @@ -267,7 +267,7 @@ func FireRunHooks() { func RegisterDefaultFlags() { OnParse(func(fs *pflag.FlagSet) { fs.IntVar(&port, "port", port, "port for the server") - fs.StringVar(&bindAddress, "bind_address", bindAddress, "Bind address for the server.") + fs.StringVar(&bindAddress, "bind-address", bindAddress, "Bind address for the server.") }) } diff --git a/go/vt/vttest/vtprocess.go b/go/vt/vttest/vtprocess.go index eb6b3f7e6bd..ec26acf41b8 100644 --- a/go/vt/vttest/vtprocess.go +++ b/go/vt/vttest/vtprocess.go @@ -127,7 +127,7 @@ func (vtp *VtProcess) WaitStart() (err error) { vtp.proc = exec.Command( vtp.Binary, "--port", fmt.Sprintf("%d", vtp.Port), - "--bind_address", "127.0.0.1", + "--bind-address", "127.0.0.1", "--log_dir", vtp.LogDirectory, "--alsologtostderr", ) From 86e96fbf2d022fc1a94b5e6eb0f84996f88c168b Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 28 Sep 2023 18:19:57 -0600 Subject: [PATCH 11/12] fix TestHelpOutput Signed-off-by: Florent Poinsard --- go/flags/endtoend/vtcombo.txt | 2 ++ go/flags/endtoend/vtgateclienttest.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/go/flags/endtoend/vtcombo.txt b/go/flags/endtoend/vtcombo.txt index 0357932f070..164d5c0b5c4 100644 --- a/go/flags/endtoend/vtcombo.txt +++ b/go/flags/endtoend/vtcombo.txt @@ -20,6 +20,7 @@ Flags: --backup_storage_block_size int if backup_storage_compress is true, backup_storage_block_size sets the byte size for each block while compressing (default is 250000). (default 250000) --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) + --bind-address string Bind address for the server. --binlog_host string PITR restore parameter: hostname/IP of binlog server. --binlog_password string PITR restore parameter: password of binlog server. --binlog_player_protocol string the protocol to download binlogs from a vttablet (default "grpc") @@ -145,6 +146,7 @@ Flags: --grpc_auth_mode string Which auth plugin implementation to use (eg: static) --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_password_file string JSON File to read the users/passwords from. + --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_crl string path to a certificate revocation list in PEM format, client certificates will be further verified against this file during TLS handshake diff --git a/go/flags/endtoend/vtgateclienttest.txt b/go/flags/endtoend/vtgateclienttest.txt index 778dbfc8243..3a387815755 100644 --- a/go/flags/endtoend/vtgateclienttest.txt +++ b/go/flags/endtoend/vtgateclienttest.txt @@ -5,6 +5,7 @@ Usage: Flags: --alsologtostderr log to standard error as well as files + --bind-address string Bind address for the server. --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --config-file string Full path of the config file (with extension) to use. If set, --config-path, --config-type, and --config-name are ignored. --config-file-not-found-handling ConfigFileNotFoundHandling Behavior when a config file is not found. (Options: error, exit, ignore, warn) (default warn) @@ -17,6 +18,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. + --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy From f9c7774b1c028e4e109b27cce8f03968c231ba90 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 28 Sep 2023 18:25:44 -0600 Subject: [PATCH 12/12] add default message for bind-address and don't mix _ with - for grpc flag Signed-off-by: Florent Poinsard --- go/flags/endtoend/mysqlctld.txt | 4 ++-- go/flags/endtoend/vtbackup.txt | 2 +- go/flags/endtoend/vtcombo.txt | 4 ++-- go/flags/endtoend/vtctld.txt | 4 ++-- go/flags/endtoend/vtgate.txt | 4 ++-- go/flags/endtoend/vtgateclienttest.txt | 4 ++-- go/flags/endtoend/vtorc.txt | 2 +- go/flags/endtoend/vttablet.txt | 4 ++-- go/flags/endtoend/vttestserver.txt | 2 +- go/test/endtoend/cluster/vtctld_process.go | 2 +- go/test/endtoend/cluster/vtgate_process.go | 2 +- go/test/endtoend/cluster/vttablet_process.go | 2 +- go/vt/servenv/grpc_server.go | 2 +- go/vt/servenv/servenv.go | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/go/flags/endtoend/mysqlctld.txt b/go/flags/endtoend/mysqlctld.txt index 892257e77b0..06b48347bf6 100644 --- a/go/flags/endtoend/mysqlctld.txt +++ b/go/flags/endtoend/mysqlctld.txt @@ -22,7 +22,7 @@ Flags: --alsologtostderr log to standard error as well as files --app_idle_timeout duration Idle timeout for app connections (default 1m0s) --app_pool_size int Size of the connection pool for app connections (default 40) - --bind-address string Bind address for the server. + --bind-address string Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system. --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --config-file string Full path of the config file (with extension) to use. If set, --config-path, --config-type, and --config-name are ignored. --config-file-not-found-handling ConfigFileNotFoundHandling Behavior when a config file is not found. (Options: error, exit, ignore, warn) (default warn) @@ -65,7 +65,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vtbackup.txt b/go/flags/endtoend/vtbackup.txt index 791b6c5cf45..2dd6bf3ef28 100644 --- a/go/flags/endtoend/vtbackup.txt +++ b/go/flags/endtoend/vtbackup.txt @@ -55,7 +55,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind-address string Bind address for the server. + --bind-address string Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system. --builtinbackup-file-read-buffer-size uint read files using an IO buffer of this many bytes. Golang defaults are used when set to 0. --builtinbackup-file-write-buffer-size uint write files using an IO buffer of this many bytes. Golang defaults are used when set to 0. (default 2097152) --builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s) diff --git a/go/flags/endtoend/vtcombo.txt b/go/flags/endtoend/vtcombo.txt index 164d5c0b5c4..a2273cbd25d 100644 --- a/go/flags/endtoend/vtcombo.txt +++ b/go/flags/endtoend/vtcombo.txt @@ -20,7 +20,7 @@ Flags: --backup_storage_block_size int if backup_storage_compress is true, backup_storage_block_size sets the byte size for each block while compressing (default is 250000). (default 250000) --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind-address string Bind address for the server. + --bind-address string Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system. --binlog_host string PITR restore parameter: hostname/IP of binlog server. --binlog_password string PITR restore parameter: password of binlog server. --binlog_player_protocol string the protocol to download binlogs from a vttablet (default "grpc") @@ -146,7 +146,7 @@ Flags: --grpc_auth_mode string Which auth plugin implementation to use (eg: static) --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_crl string path to a certificate revocation list in PEM format, client certificates will be further verified against this file during TLS handshake diff --git a/go/flags/endtoend/vtctld.txt b/go/flags/endtoend/vtctld.txt index 7c5c9edec6f..a9a5cebb0f3 100644 --- a/go/flags/endtoend/vtctld.txt +++ b/go/flags/endtoend/vtctld.txt @@ -34,7 +34,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind-address string Bind address for the server. + --bind-address string Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system. --builtinbackup-file-read-buffer-size uint read files using an IO buffer of this many bytes. Golang defaults are used when set to 0. --builtinbackup-file-write-buffer-size uint write files using an IO buffer of this many bytes. Golang defaults are used when set to 0. (default 2097152) --builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s) @@ -60,7 +60,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vtgate.txt b/go/flags/endtoend/vtgate.txt index c985b43d402..6da515d91f3 100644 --- a/go/flags/endtoend/vtgate.txt +++ b/go/flags/endtoend/vtgate.txt @@ -28,7 +28,7 @@ Flags: --allow-kill-statement Allows the execution of kill statement --allowed_tablet_types strings Specifies the tablet types this vtgate is allowed to route queries to. Should be provided as a comma-separated set of tablet types. --alsologtostderr log to standard error as well as files - --bind-address string Bind address for the server. + --bind-address string Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system. --buffer_drain_concurrency int Maximum number of requests retried simultaneously. More concurrency will increase the load on the PRIMARY vttablet when draining the buffer. (default 1) --buffer_keyspace_shards string If not empty, limit buffering to these entries (comma separated). Entry format: keyspace or keyspace/shard. Requires --enable_buffer=true. --buffer_max_failover_duration duration Stop buffering completely if a failover takes longer than this duration. (default 20s) @@ -71,7 +71,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vtgateclienttest.txt b/go/flags/endtoend/vtgateclienttest.txt index 3a387815755..4580d4d6ce7 100644 --- a/go/flags/endtoend/vtgateclienttest.txt +++ b/go/flags/endtoend/vtgateclienttest.txt @@ -5,7 +5,7 @@ Usage: Flags: --alsologtostderr log to standard error as well as files - --bind-address string Bind address for the server. + --bind-address string Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system. --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --config-file string Full path of the config file (with extension) to use. If set, --config-path, --config-type, and --config-name are ignored. --config-file-not-found-handling ConfigFileNotFoundHandling Behavior when a config file is not found. (Options: error, exit, ignore, warn) (default warn) @@ -18,7 +18,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vtorc.txt b/go/flags/endtoend/vtorc.txt index fc2437f318f..b13756e793c 100644 --- a/go/flags/endtoend/vtorc.txt +++ b/go/flags/endtoend/vtorc.txt @@ -22,7 +22,7 @@ Flags: --audit-purge-duration duration Duration for which audit logs are held before being purged. Should be in multiples of days (default 168h0m0s) --audit-to-backend Whether to store the audit log in the VTOrc database --audit-to-syslog Whether to store the audit log in the syslog - --bind-address string Bind address for the server. + --bind-address string Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system. --catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified --change-tablets-with-errant-gtid-to-drained Whether VTOrc should be changing the type of tablets with errant GTIDs to DRAINED --clusters_to_watch strings Comma-separated list of keyspaces or keyspace/shards that this instance will monitor and repair. Defaults to all clusters in the topology. Example: "ks1,ks2/-80" diff --git a/go/flags/endtoend/vttablet.txt b/go/flags/endtoend/vttablet.txt index fd57a551abe..3b3f5142c97 100644 --- a/go/flags/endtoend/vttablet.txt +++ b/go/flags/endtoend/vttablet.txt @@ -56,7 +56,7 @@ Flags: --backup_storage_compress if set, the backup files will be compressed. (default true) --backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups. --backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, in parallel, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2) - --bind-address string Bind address for the server. + --bind-address string Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system. --binlog_host string PITR restore parameter: hostname/IP of binlog server. --binlog_password string PITR restore parameter: password of binlog server. --binlog_player_grpc_ca string the server ca to use to validate servers when connecting @@ -171,7 +171,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/flags/endtoend/vttestserver.txt b/go/flags/endtoend/vttestserver.txt index 93722fee761..fb9c42d932a 100644 --- a/go/flags/endtoend/vttestserver.txt +++ b/go/flags/endtoend/vttestserver.txt @@ -47,7 +47,7 @@ Flags: --grpc_auth_mtls_allowed_substrings string List of substrings of at least one of the client certificate names (separated by colon). --grpc_auth_static_client_creds string When using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server. --grpc_auth_static_password_file string JSON File to read the users/passwords from. - --grpc_bind-address string Bind address for gRPC calls. If empty, listen on all addresses. + --grpc_bind_address string Bind address for gRPC calls. If empty, listen on all addresses. --grpc_ca string server CA to use for gRPC connections, requires TLS, and enforces client certificate check --grpc_cert string server certificate to use for gRPC connections, requires grpc_key, enables TLS --grpc_compression string Which protocol to use for compressing gRPC. Default: nothing. Supported: snappy diff --git a/go/test/endtoend/cluster/vtctld_process.go b/go/test/endtoend/cluster/vtctld_process.go index 7890bfe909f..d0b2e5ab93e 100644 --- a/go/test/endtoend/cluster/vtctld_process.go +++ b/go/test/endtoend/cluster/vtctld_process.go @@ -71,7 +71,7 @@ func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error) return err } else if v >= 18 { vtctld.proc.Args = append(vtctld.proc.Args, "--bind-address", "127.0.0.1") - vtctld.proc.Args = append(vtctld.proc.Args, "--grpc_bind-address", "127.0.0.1") + vtctld.proc.Args = append(vtctld.proc.Args, "--grpc_bind_address", "127.0.0.1") } if *isCoverage { diff --git a/go/test/endtoend/cluster/vtgate_process.go b/go/test/endtoend/cluster/vtgate_process.go index 28804028c8f..ab82a32f651 100644 --- a/go/test/endtoend/cluster/vtgate_process.go +++ b/go/test/endtoend/cluster/vtgate_process.go @@ -90,7 +90,7 @@ func (vtgate *VtgateProcess) Setup() (err error) { return err } else if v >= 18 { args = append(args, "--bind-address", "127.0.0.1") - args = append(args, "--grpc_bind-address", "127.0.0.1") + args = append(args, "--grpc_bind_address", "127.0.0.1") } // If no explicit mysql_server_version has been specified then we autodetect // the MySQL version that will be used for the test and base the vtgate's diff --git a/go/test/endtoend/cluster/vttablet_process.go b/go/test/endtoend/cluster/vttablet_process.go index 939a706dfbb..517f4bf3874 100644 --- a/go/test/endtoend/cluster/vttablet_process.go +++ b/go/test/endtoend/cluster/vttablet_process.go @@ -116,7 +116,7 @@ func (vttablet *VttabletProcess) Setup() (err error) { return err } else if v >= 18 { vttablet.proc.Args = append(vttablet.proc.Args, "--bind-address", "127.0.0.1") - vttablet.proc.Args = append(vttablet.proc.Args, "--grpc_bind-address", "127.0.0.1") + vttablet.proc.Args = append(vttablet.proc.Args, "--grpc_bind_address", "127.0.0.1") } if *isCoverage { diff --git a/go/vt/servenv/grpc_server.go b/go/vt/servenv/grpc_server.go index 78f1517bf72..7a41cca389a 100644 --- a/go/vt/servenv/grpc_server.go +++ b/go/vt/servenv/grpc_server.go @@ -127,7 +127,7 @@ var ( func RegisterGRPCServerFlags() { OnParse(func(fs *pflag.FlagSet) { fs.IntVar(&gRPCPort, "grpc_port", gRPCPort, "Port to listen on for gRPC calls. If zero, do not listen.") - fs.StringVar(&gRPCBindAddress, "grpc_bind-address", gRPCBindAddress, "Bind address for gRPC calls. If empty, listen on all addresses.") + fs.StringVar(&gRPCBindAddress, "grpc_bind_address", gRPCBindAddress, "Bind address for gRPC calls. If empty, listen on all addresses.") fs.DurationVar(&gRPCMaxConnectionAge, "grpc_max_connection_age", gRPCMaxConnectionAge, "Maximum age of a client connection before GoAway is sent.") fs.DurationVar(&gRPCMaxConnectionAgeGrace, "grpc_max_connection_age_grace", gRPCMaxConnectionAgeGrace, "Additional grace period after grpc_max_connection_age, after which connections are forcibly closed.") fs.IntVar(&gRPCInitialConnWindowSize, "grpc_server_initial_conn_window_size", gRPCInitialConnWindowSize, "gRPC server initial connection window size") diff --git a/go/vt/servenv/servenv.go b/go/vt/servenv/servenv.go index 19705f14e27..e7c28855997 100644 --- a/go/vt/servenv/servenv.go +++ b/go/vt/servenv/servenv.go @@ -267,7 +267,7 @@ func FireRunHooks() { func RegisterDefaultFlags() { OnParse(func(fs *pflag.FlagSet) { fs.IntVar(&port, "port", port, "port for the server") - fs.StringVar(&bindAddress, "bind-address", bindAddress, "Bind address for the server.") + fs.StringVar(&bindAddress, "bind-address", bindAddress, "Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system.") }) }