diff --git a/go/cmd/vtctld/cli/schema.go b/go/cmd/vtctld/cli/schema.go index a330a23abe2..725bccd5f6e 100644 --- a/go/cmd/vtctld/cli/schema.go +++ b/go/cmd/vtctld/cli/schema.go @@ -25,6 +25,7 @@ import ( "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/schemamanager" "vitess.io/vitess/go/vt/servenv" + "vitess.io/vitess/go/vt/utils" "vitess.io/vitess/go/vt/vtctl/grpcvtctldserver" "vitess.io/vitess/go/vt/vttablet/tmclient" "vitess.io/vitess/go/vt/wrangler" @@ -39,12 +40,12 @@ var ( ) func init() { - Main.Flags().StringVar(&schemaChangeDir, "schema_change_dir", schemaChangeDir, "Directory containing schema changes for all keyspaces. Each keyspace has its own directory, and schema changes are expected to live in '$KEYSPACE/input' dir. (e.g. 'test_keyspace/input/*sql'). Each sql file represents a schema change.") - Main.Flags().StringVar(&schemaChangeController, "schema_change_controller", schemaChangeController, "Schema change controller is responsible for finding schema changes and responding to schema change events.") - Main.Flags().StringVar(&schemaChangeUser, "schema_change_user", schemaChangeUser, "The user who schema changes are submitted on behalf of.") + utils.SetFlagStringVar(Main.Flags(), &schemaChangeDir, "schema-change-dir", schemaChangeDir, "Directory containing schema changes for all keyspaces. Each keyspace has its own directory, and schema changes are expected to live in '$KEYSPACE/input' dir. (e.g. 'test_keyspace/input/*sql'). Each sql file represents a schema change.") + utils.SetFlagStringVar(Main.Flags(), &schemaChangeController, "schema-change-controller", schemaChangeController, "Schema change controller is responsible for finding schema changes and responding to schema change events.") + utils.SetFlagStringVar(Main.Flags(), &schemaChangeUser, "schema-change-user", schemaChangeUser, "The user who schema changes are submitted on behalf of.") - Main.Flags().DurationVar(&schemaChangeCheckInterval, "schema_change_check_interval", schemaChangeCheckInterval, "How often the schema change dir is checked for schema changes. This value must be positive; if zero or lower, the default of 1m is used.") - Main.Flags().DurationVar(&schemaChangeReplicasTimeout, "schema_change_replicas_timeout", schemaChangeReplicasTimeout, "How long to wait for replicas to receive a schema change.") + utils.SetFlagDurationVar(Main.Flags(), &schemaChangeCheckInterval, "schema-change-check-interval", schemaChangeCheckInterval, "How often the schema change dir is checked for schema changes. This value must be positive; if zero or lower, the default of 1m is used.") + utils.SetFlagDurationVar(Main.Flags(), &schemaChangeReplicasTimeout, "schema-change-replicas-timeout", schemaChangeReplicasTimeout, "How long to wait for replicas to receive a schema change.") } func initSchema(ctx context.Context) { diff --git a/go/cmd/vttablet/cli/cli.go b/go/cmd/vttablet/cli/cli.go index a61cd394d99..315900abecf 100644 --- a/go/cmd/vttablet/cli/cli.go +++ b/go/cmd/vttablet/cli/cli.go @@ -65,7 +65,7 @@ var ( * Managed MySQL (most common) * External MySQL -In addition to these deployment types, a partially managed VTTablet is also possible by setting ` + "`--disable_active_reparents`." + ` +In addition to these deployment types, a partially managed VTTablet is also possible by setting ` + "`--disable-active-reparents`." + ` ### Managed MySQL diff --git a/go/flags/endtoend/vtbackup.txt b/go/flags/endtoend/vtbackup.txt index c2b0181d822..e49a9e9fbed 100644 --- a/go/flags/endtoend/vtbackup.txt +++ b/go/flags/endtoend/vtbackup.txt @@ -193,7 +193,7 @@ Flags: --mysql-shutdown-timeout duration how long to wait for mysqld shutdown (default 5m0s) --mysql-socket string Path to the mysqld socket file --mysql_timeout duration how long to wait for mysqld startup (default 5m0s) - --opentsdb_uri string URI of opentsdb /api/put method + --opentsdb-uri string URI of opentsdb /api/put method --port int port for the server --pprof strings enable profiling --pprof-http enable pprof http endpoints diff --git a/go/flags/endtoend/vtcombo.txt b/go/flags/endtoend/vtcombo.txt index f611333e425..7d344e85c90 100644 --- a/go/flags/endtoend/vtcombo.txt +++ b/go/flags/endtoend/vtcombo.txt @@ -261,8 +261,8 @@ Flags: --pprof strings enable profiling --pprof-http enable pprof http endpoints --proto_topo vttest.TopoData vttest proto definition of the topology, encoded in compact text format. See vttest.proto for more information. + --proxy-tablets Setting this true will make vtctld proxy the tablet status instead of redirecting to them --proxy_protocol Enable HAProxy PROXY protocol on MySQL listener socket - --proxy_tablets Setting this true will make vtctld proxy the tablet status instead of redirecting to them --publish_retry_interval duration how long vttablet waits to retry publishing the tablet record (default 30s) --purge-logs-interval duration how often try to remove old logs (default 1h0m0s) --query-log-stream-handler string URL handler for streaming queries log (default "/debug/querylog") @@ -344,6 +344,7 @@ Flags: --table_gc_lifecycle string States for a DROP TABLE garbage collection cycle. Default is 'hold,purge,evac,drop', use any subset ('drop' implicitly always included) (default "hold,purge,evac,drop") --tablet-dir string The directory within the vtdataroot to store vttablet/mysql files. Defaults to being generated by the tablet uid. --tablet-filter-tags StringMap Specifies a comma-separated list of tablet tags (as key:value pairs) to filter the tablets to watch. + --tablet-health-keep-alive duration close streaming tablet health connection if there are no requests for this long (default 5m0s) --tablet-hostname string if not empty, this hostname will be assumed instead of trying to resolve it --tablet-manager-grpc-ca string the server ca to use to validate servers when connecting --tablet-manager-grpc-cert string the cert to use to connect @@ -358,7 +359,6 @@ Flags: --tablet-types-to-wait strings Wait till connected for specified tablet types during Gateway initialization. Should be provided as a comma-separated set of tablet types. --tablet-url-template string Format string describing debug tablet url formatting. See getTabletDebugURL() for how to customize this. (default "http://{{ "{{.GetTabletHostPort}}" }}") --tablet_filters strings Specifies a comma-separated list of 'keyspace|shard_name or keyrange' values to filter the tablets to watch. - --tablet_health_keep_alive duration close streaming tablet health connection if there are no requests for this long (default 5m0s) --throttle_tablet_types string Comma separated VTTablet types to be considered by the throttler. default: 'replica'. example: 'replica,rdonly'. 'replica' always implicitly included (default "replica") --topo-consul-lock-delay duration LockDelay for consul session. (default 15s) --topo-consul-lock-session-checks string List of checks for consul session. (default "serfHealth") @@ -424,7 +424,7 @@ Flags: --vstream-binlog-rotation-threshold int Byte size at which a VStreamer will attempt to rotate the source's open binary log before starting a GTID snapshot based stream (e.g. a ResultStreamer or RowStreamer) (default 67108864) --vstream-dynamic-packet-size Enable dynamic packet sizing for vstreamers. This will adjust the packet size in vreplication workflows to improve performance. (default true) --vstream-packet-size int Suggested packet size for vstreamers. The actual packet size may be more or less than this amount. (default 250000) - --vtctld_sanitize_log_messages When true, vtctld sanitizes logging. + --vtctld-sanitize-log-messages When true, vtctld sanitizes logging. --vtgate-config-terse-errors prevent bind vars from escaping in returned errors --vtgate_grpc_ca string the server ca to use to validate servers when connecting --vtgate_grpc_cert string the cert to use to connect diff --git a/go/flags/endtoend/vtctld.txt b/go/flags/endtoend/vtctld.txt index f29c740fd0c..1291e63083e 100644 --- a/go/flags/endtoend/vtctld.txt +++ b/go/flags/endtoend/vtctld.txt @@ -52,7 +52,7 @@ Flags: --consul-auth-static-file string JSON File to read the topos/tokens from. --datadog-agent-host string host to send spans to. if empty, no tracing will be done --datadog-agent-port string port to send spans to. if empty, no tracing will be done - --disable_active_reparents if set, do not allow active reparents. Use this to protect a cluster using external reparents. + --disable-active-reparents if set, do not allow active reparents. Use this to protect a cluster using external reparents. --emit-stats If set, emit stats to push-based monitoring and stats backends --file_backup_storage_root string Root directory for the file backup storage. --gcs-backup-storage-bucket string Google Cloud Storage bucket to use for backups. @@ -101,12 +101,12 @@ Flags: --mysql-server-version string MySQL server version to advertise. (default "8.0.40-Vitess") --onclose-timeout duration wait no more than this for OnClose handlers before stopping (default 10s) --onterm-timeout duration wait no more than this for OnTermSync handlers before stopping (default 10s) - --opentsdb_uri string URI of opentsdb /api/put method + --opentsdb-uri string URI of opentsdb /api/put method --pid-file string If set, the process will write its pid to the named file, and delete it on graceful shutdown. --port int port for the server --pprof strings enable profiling --pprof-http enable pprof http endpoints - --proxy_tablets Setting this true will make vtctld proxy the tablet status instead of redirecting to them + --proxy-tablets Setting this true will make vtctld proxy the tablet status instead of redirecting to them --purge-logs-interval duration how often try to remove old logs (default 1h0m0s) --remote-operation-timeout duration time to wait for a remote operation (default 15s) --s3-backup-aws-endpoint string endpoint of the S3 backend (region must be provided). @@ -119,11 +119,11 @@ Flags: --s3-backup-storage-bucket string S3 bucket to use for backups. --s3-backup-storage-root string root prefix for all backup-related object names. --s3-backup-tls-skip-verify-cert skip the 'certificate is valid' check for SSL connections. - --schema_change_check_interval duration How often the schema change dir is checked for schema changes. This value must be positive; if zero or lower, the default of 1m is used. (default 1m0s) - --schema_change_controller string Schema change controller is responsible for finding schema changes and responding to schema change events. - --schema_change_dir string Directory containing schema changes for all keyspaces. Each keyspace has its own directory, and schema changes are expected to live in '$KEYSPACE/input' dir. (e.g. 'test_keyspace/input/*sql'). Each sql file represents a schema change. - --schema_change_replicas_timeout duration How long to wait for replicas to receive a schema change. (default 10s) - --schema_change_user string The user who schema changes are submitted on behalf of. + --schema-change-check-interval duration How often the schema change dir is checked for schema changes. This value must be positive; if zero or lower, the default of 1m is used. (default 1m0s) + --schema-change-controller string Schema change controller is responsible for finding schema changes and responding to schema change events. + --schema-change-dir string Directory containing schema changes for all keyspaces. Each keyspace has its own directory, and schema changes are expected to live in '$KEYSPACE/input' dir. (e.g. 'test_keyspace/input/*sql'). Each sql file represents a schema change. + --schema-change-replicas-timeout duration How long to wait for replicas to receive a schema change. (default 10s) + --schema-change-user string The user who schema changes are submitted on behalf of. --security-policy string the name of a registered security policy to use for controlling access to URLs - empty means allow all for anyone (built-in policies: deny-all, read-only) --service-map strings comma separated list of services to enable (or disable if prefixed with '-') Example: grpc-queryservice --sql-max-length-errors int truncate queries in error logs to the given length (default unlimited) @@ -141,6 +141,7 @@ Flags: --tablet-grpc-crl string the server crl to use to validate server certificates when connecting --tablet-grpc-key string the key to use to connect --tablet-grpc-server-name string the server name to use to validate server certificate + --tablet-health-keep-alive duration close streaming tablet health connection if there are no requests for this long (default 5m0s) --tablet-manager-grpc-ca string the server ca to use to validate servers when connecting --tablet-manager-grpc-cert string the cert to use to connect --tablet-manager-grpc-concurrency int concurrency to use to talk to a vttablet server for performance-sensitive RPCs (like ExecuteFetchAs{Dba,App}, CheckThrottler and FullStatus) (default 8) @@ -153,7 +154,6 @@ Flags: --tablet-refresh-interval duration Tablet refresh interval. (default 1m0s) --tablet-refresh-known-tablets Whether to reload the tablet's address/port map from topo in case they change. (default true) --tablet-url-template string Format string describing debug tablet url formatting. See getTabletDebugURL() for how to customize this. (default "http://{{ "{{.GetTabletHostPort}}" }}") - --tablet_health_keep_alive duration close streaming tablet health connection if there are no requests for this long (default 5m0s) --topo-consul-lock-delay duration LockDelay for consul session. (default 15s) --topo-consul-lock-session-checks string List of checks for consul session. (default "serfHealth") --topo-consul-lock-session-ttl string TTL for consul session. @@ -179,4 +179,4 @@ Flags: --v Level log level for V logs -v, --version print binary version --vmodule vModuleFlag comma-separated list of pattern=N settings for file-filtered logging - --vtctld_sanitize_log_messages When true, vtctld sanitizes logging. + --vtctld-sanitize-log-messages When true, vtctld sanitizes logging. diff --git a/go/flags/endtoend/vtgate.txt b/go/flags/endtoend/vtgate.txt index b489004cd35..fdb4d54e388 100644 --- a/go/flags/endtoend/vtgate.txt +++ b/go/flags/endtoend/vtgate.txt @@ -164,7 +164,7 @@ Flags: --normalize_queries Rewrite queries with bind vars. Turn this off if the app itself sends normalized queries with bind vars. (default true) --onclose-timeout duration wait no more than this for OnClose handlers before stopping (default 10s) --onterm-timeout duration wait no more than this for OnTermSync handlers before stopping (default 10s) - --opentsdb_uri string URI of opentsdb /api/put method + --opentsdb-uri string URI of opentsdb /api/put method --pid-file string If set, the process will write its pid to the named file, and delete it on graceful shutdown. --planner-version string Sets the default planner to use when the session has not changed it. Valid values are: Gen4, Gen4Greedy, Gen4Left2Right --port int port for the server diff --git a/go/flags/endtoend/vttablet.txt b/go/flags/endtoend/vttablet.txt index b333c91c634..897d9dabf28 100644 --- a/go/flags/endtoend/vttablet.txt +++ b/go/flags/endtoend/vttablet.txt @@ -3,7 +3,7 @@ The VTTablet server _controls_ a running MySQL server. VTTablet supports two pri * Managed MySQL (most common) * External MySQL -In addition to these deployment types, a partially managed VTTablet is also possible by setting `--disable_active_reparents`. +In addition to these deployment types, a partially managed VTTablet is also possible by setting `--disable-active-reparents`. ### Managed MySQL @@ -252,7 +252,7 @@ Flags: --mysqlctl_socket string socket file to use for remote mysqlctl actions (empty for local actions) --onclose-timeout duration wait no more than this for OnClose handlers before stopping (default 10s) --onterm-timeout duration wait no more than this for OnTermSync handlers before stopping (default 10s) - --opentsdb_uri string URI of opentsdb /api/put method + --opentsdb-uri string URI of opentsdb /api/put method --pid-file string If set, the process will write its pid to the named file, and delete it on graceful shutdown. --pool-hostname-resolve-interval duration if set force an update to all hostnames and reconnect if changed, defaults to 0 (disabled) --port int port for the server diff --git a/go/stats/opentsdb/flags.go b/go/stats/opentsdb/flags.go index 8ccd0279981..a9cfa59ba23 100644 --- a/go/stats/opentsdb/flags.go +++ b/go/stats/opentsdb/flags.go @@ -20,6 +20,7 @@ import ( "github.com/spf13/pflag" "vitess.io/vitess/go/vt/servenv" + "vitess.io/vitess/go/vt/utils" ) var ( @@ -27,7 +28,7 @@ var ( ) func registerFlags(fs *pflag.FlagSet) { - fs.StringVar(&openTSDBURI, "opentsdb_uri", openTSDBURI, "URI of opentsdb /api/put method") + utils.SetFlagStringVar(fs, &openTSDBURI, "opentsdb-uri", openTSDBURI, "URI of opentsdb /api/put method") } func init() { diff --git a/go/stats/opentsdb/flags_test.go b/go/stats/opentsdb/flags_test.go index ca9d63e37d9..63f14177a58 100644 --- a/go/stats/opentsdb/flags_test.go +++ b/go/stats/opentsdb/flags_test.go @@ -33,7 +33,7 @@ func TestRegisterFlags(t *testing.T) { registerFlags(fs) - err := fs.Set("opentsdb_uri", "testURI") + err := fs.Set("opentsdb-uri", "testURI") assert.NoError(t, err) assert.Equal(t, "testURI", openTSDBURI) } diff --git a/go/stats/opentsdb/init.go b/go/stats/opentsdb/init.go index 51186ad7650..9f7ab1b8954 100644 --- a/go/stats/opentsdb/init.go +++ b/go/stats/opentsdb/init.go @@ -76,7 +76,7 @@ func InitWithoutServenv(prefix string) (stats.PushBackend, error) { func newBackend(prefix string) (*backend, error) { if openTSDBURI == "" { - return nil, fmt.Errorf("cannot create opentsdb PushBackend with empty --opentsdb_uri") + return nil, fmt.Errorf("cannot create opentsdb PushBackend with empty --opentsdb-uri") } var w writer @@ -84,11 +84,11 @@ func newBackend(prefix string) (*backend, error) { // Use the file API when the uri is in format file://... u, err := url.Parse(openTSDBURI) if err != nil { - return nil, fmt.Errorf("failed to parse --opentsdb_uri %s: %v", openTSDBURI, err) + return nil, fmt.Errorf("failed to parse --opentsdb-uri %s: %v", openTSDBURI, err) } else if u.Scheme == "file" { fw, err := newFileWriter(u.Path) if err != nil { - return nil, fmt.Errorf("failed to create file-based writer for --opentsdb_uri %s: %v", openTSDBURI, err) + return nil, fmt.Errorf("failed to create file-based writer for --opentsdb-uri %s: %v", openTSDBURI, err) } else { w = fw } diff --git a/go/test/endtoend/backup/vtbackup/backup_only_test.go b/go/test/endtoend/backup/vtbackup/backup_only_test.go index 8d52f335194..e6ba2c00c96 100644 --- a/go/test/endtoend/backup/vtbackup/backup_only_test.go +++ b/go/test/endtoend/backup/vtbackup/backup_only_test.go @@ -245,7 +245,7 @@ func startVtBackup(t *testing.T, initialBackup bool, restartBeforeBackup, disabl // Use opentsdb for stats. utils.GetFlagVariantForTests("--stats-backend"), "opentsdb", // Write stats to file for reading afterwards. - "--opentsdb_uri", fmt.Sprintf("file://%s", statsPath), + utils.GetFlagVariantForTests("--opentsdb-uri"), fmt.Sprintf("file://%s", statsPath), } if restartBeforeBackup { extraArgs = append(extraArgs, "--restart_before_backup") diff --git a/go/test/endtoend/onlineddl/flow/onlineddl_flow_test.go b/go/test/endtoend/onlineddl/flow/onlineddl_flow_test.go index 8f86c689fca..7a05ddc974e 100644 --- a/go/test/endtoend/onlineddl/flow/onlineddl_flow_test.go +++ b/go/test/endtoend/onlineddl/flow/onlineddl_flow_test.go @@ -132,6 +132,7 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ + // TODO: Replace flag with dashed version in v25 "--schema_change_dir", schemaChangeDirectory, "--schema_change_controller", "local", "--schema_change_check_interval", "1s", diff --git a/go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go b/go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go index cc2725c694b..16560a66616 100644 --- a/go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go +++ b/go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go @@ -150,9 +150,9 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ - "--schema_change_dir", schemaChangeDirectory, - "--schema_change_controller", "local", - "--schema_change_check_interval", "1s", + "--schema-change-dir", schemaChangeDirectory, + "--schema-change-controller", "local", + "--schema-change-check-interval", "1s", } clusterInstance.VtTabletExtraArgs = []string{ diff --git a/go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go b/go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go index 5d904e96678..d48677922ae 100644 --- a/go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go +++ b/go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go @@ -252,9 +252,9 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ - "--schema_change_dir", schemaChangeDirectory, - "--schema_change_controller", "local", - "--schema_change_check_interval", "1s", + "--schema-change-dir", schemaChangeDirectory, + "--schema-change-controller", "local", + "--schema-change-check-interval", "1s", } clusterInstance.VtTabletExtraArgs = []string{ diff --git a/go/test/endtoend/onlineddl/vrepl/onlineddl_vrepl_test.go b/go/test/endtoend/onlineddl/vrepl/onlineddl_vrepl_test.go index 8258c51f31c..4b35d37fa06 100644 --- a/go/test/endtoend/onlineddl/vrepl/onlineddl_vrepl_test.go +++ b/go/test/endtoend/onlineddl/vrepl/onlineddl_vrepl_test.go @@ -173,9 +173,9 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ - "--schema_change_dir", schemaChangeDirectory, - "--schema_change_controller", "local", - "--schema_change_check_interval", "1s", + "--schema-change-dir", schemaChangeDirectory, + "--schema-change-controller", "local", + "--schema-change-check-interval", "1s", } clusterInstance.VtTabletExtraArgs = []string{ diff --git a/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go b/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go index 68bc6e19f95..fa8dd7305a3 100644 --- a/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go +++ b/go/test/endtoend/onlineddl/vrepl_stress/onlineddl_vrepl_mini_stress_test.go @@ -172,9 +172,9 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ - "--schema_change_dir", schemaChangeDirectory, - "--schema_change_controller", "local", - "--schema_change_check_interval", "1s", + "--schema-change-dir", schemaChangeDirectory, + "--schema-change-controller", "local", + "--schema-change-check-interval", "1s", } clusterInstance.VtTabletExtraArgs = []string{ diff --git a/go/test/endtoend/onlineddl/vrepl_stress_suite/onlineddl_vrepl_stress_suite_test.go b/go/test/endtoend/onlineddl/vrepl_stress_suite/onlineddl_vrepl_stress_suite_test.go index 308f70f58fb..8861e8bed15 100644 --- a/go/test/endtoend/onlineddl/vrepl_stress_suite/onlineddl_vrepl_stress_suite_test.go +++ b/go/test/endtoend/onlineddl/vrepl_stress_suite/onlineddl_vrepl_stress_suite_test.go @@ -420,9 +420,9 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ - "--schema_change_dir", schemaChangeDirectory, - "--schema_change_controller", "local", - "--schema_change_check_interval", "1s", + "--schema-change-dir", schemaChangeDirectory, + "--schema-change-controller", "local", + "--schema-change-check-interval", "1s", } // --vstream_packet_size is set to a small value that ensures we get multiple stream iterations, diff --git a/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go b/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go index e7801e748d7..a1bf634334a 100644 --- a/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go +++ b/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go @@ -82,6 +82,7 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ + // TODO: Replace flag with dashed version in v25 "--schema_change_dir", schemaChangeDirectory, "--schema_change_controller", "local", "--schema_change_check_interval", "1s", diff --git a/go/test/endtoend/recovery/recovery_util.go b/go/test/endtoend/recovery/recovery_util.go index 23c484f3668..ac519fda518 100644 --- a/go/test/endtoend/recovery/recovery_util.go +++ b/go/test/endtoend/recovery/recovery_util.go @@ -72,7 +72,8 @@ func RestoreTablet(t *testing.T, localCluster *cluster.LocalProcessCluster, tabl if UseXb { replicaTabletArgs = append(replicaTabletArgs, XbArgs...) } - replicaTabletArgs = append(replicaTabletArgs, "--disable_active_reparents", + replicaTabletArgs = append(replicaTabletArgs, + utils.GetFlagVariantForTests("--disable-active-reparents"), "--enable_replication_reporter=false", utils.GetFlagVariantForTests("--init-tablet-type"), "replica", utils.GetFlagVariantForTests("--init-keyspace"), restoreKSName, diff --git a/go/test/endtoend/schemadiff/vrepl/schemadiff_vrepl_suite_test.go b/go/test/endtoend/schemadiff/vrepl/schemadiff_vrepl_suite_test.go index b0cd640ed2a..0a51bf69ab0 100644 --- a/go/test/endtoend/schemadiff/vrepl/schemadiff_vrepl_suite_test.go +++ b/go/test/endtoend/schemadiff/vrepl/schemadiff_vrepl_suite_test.go @@ -81,9 +81,9 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ - "--schema_change_dir", schemaChangeDirectory, - "--schema_change_controller", "local", - "--schema_change_check_interval", "1s", + "--schema-change-dir", schemaChangeDirectory, + "--schema-change-controller", "local", + "--schema-change-check-interval", "1s", } clusterInstance.VtTabletExtraArgs = []string{ diff --git a/go/test/endtoend/tabletmanager/tablet_health_test.go b/go/test/endtoend/tabletmanager/tablet_health_test.go index 79aa4c58f5f..57d91fa594c 100644 --- a/go/test/endtoend/tabletmanager/tablet_health_test.go +++ b/go/test/endtoend/tabletmanager/tablet_health_test.go @@ -66,7 +66,7 @@ func TestTabletReshuffle(t *testing.T) { "--lock_tables_timeout", "5s", vtutils.GetFlagVariantForTests("--mycnf-server-id"), fmt.Sprintf("%d", rTablet.TabletUID), vtutils.GetFlagVariantForTests("--db-socket"), fmt.Sprintf("%s/mysql.sock", primaryTablet.VttabletProcess.Directory), - "--disable_active_reparents", + vtutils.GetFlagVariantForTests("--disable-active-reparents"), "--enable_replication_reporter=false", } defer func() { clusterInstance.VtTabletExtraArgs = []string{} }() diff --git a/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go b/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go index 3090e9db25f..333baff5404 100644 --- a/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go +++ b/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go @@ -110,7 +110,7 @@ func TestMain(m *testing.M) { "--enable_replication_reporter", utils.GetFlagVariantForTests("--heartbeat-interval"), "250ms", "--heartbeat_on_demand_duration", onDemandHeartbeatDuration.String(), - "--disable_active_reparents", + utils.GetFlagVariantForTests("--disable-active-reparents"), } // Start keyspace diff --git a/go/test/endtoend/versionupgrade/upgrade_test.go b/go/test/endtoend/versionupgrade/upgrade_test.go index 48e552c3a7c..2d4cd972460 100644 --- a/go/test/endtoend/versionupgrade/upgrade_test.go +++ b/go/test/endtoend/versionupgrade/upgrade_test.go @@ -85,9 +85,9 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ - "--schema_change_dir", schemaChangeDirectory, - "--schema_change_controller", "local", - "--schema_change_check_interval", "1s", + "--schema-change-dir", schemaChangeDirectory, + "--schema-change-controller", "local", + "--schema-change-check-interval", "1s", } if err := clusterInstance.StartTopo(); err != nil { diff --git a/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go b/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go index d8dbfb33b8e..ff262217014 100644 --- a/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go +++ b/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go @@ -349,9 +349,9 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ - "--schema_change_dir", schemaChangeDirectory, - "--schema_change_controller", "local", - "--schema_change_check_interval", "1s", + "--schema-change-dir", schemaChangeDirectory, + "--schema-change-controller", "local", + "--schema-change-check-interval", "1s", } clusterInstance.VtTabletExtraArgs = []string{ diff --git a/go/test/endtoend/vtgate/schema/schema_test.go b/go/test/endtoend/vtgate/schema/schema_test.go index fd84b5b2793..bed6f46bb4b 100644 --- a/go/test/endtoend/vtgate/schema/schema_test.go +++ b/go/test/endtoend/vtgate/schema/schema_test.go @@ -68,9 +68,9 @@ func TestMain(m *testing.M) { } clusterInstance.VtctldExtraArgs = []string{ - "--schema_change_dir", schemaChangeDirectory, - "--schema_change_controller", "local", - "--schema_change_check_interval", "1s", + "--schema-change-dir", schemaChangeDirectory, + "--schema-change-controller", "local", + "--schema-change-check-interval", "1s", } if err := clusterInstance.StartTopo(); err != nil { diff --git a/go/test/endtoend/vtorc/utils/utils.go b/go/test/endtoend/vtorc/utils/utils.go index b00e3897a61..13544c56b03 100644 --- a/go/test/endtoend/vtorc/utils/utils.go +++ b/go/test/endtoend/vtorc/utils/utils.go @@ -134,7 +134,7 @@ func createVttablets(clusterInstance *cluster.LocalProcessCluster, cellInfos []* } clusterInstance.VtTabletExtraArgs = []string{ "--lock_tables_timeout", "5s", - "--disable_active_reparents", + "--disable-active-reparents", } // Initialize Cluster shard0.Vttablets = tablets @@ -813,7 +813,7 @@ func SetupNewClusterSemiSync(t *testing.T) *VTOrcClusterInfo { clusterInstance.VtTabletExtraArgs = []string{ "--lock_tables_timeout", "5s", - "--disable_active_reparents", + "--disable-active-reparents", } // Initialize Cluster @@ -888,7 +888,7 @@ func AddSemiSyncKeyspace(t *testing.T, clusterInfo *VTOrcClusterInfo) { }() clusterInfo.ClusterInstance.VtTabletExtraArgs = []string{ "--lock_tables_timeout", "5s", - "--disable_active_reparents", + "--disable-active-reparents", } // Initialize Cluster diff --git a/go/vt/mysqlctl/mysqld.go b/go/vt/mysqlctl/mysqld.go index 6470a20eac9..26ed883cefb 100644 --- a/go/vt/mysqlctl/mysqld.go +++ b/go/vt/mysqlctl/mysqld.go @@ -150,12 +150,12 @@ func registerMySQLDFlags(fs *pflag.FlagSet) { } func registerReparentFlags(fs *pflag.FlagSet) { - fs.BoolVar(&DisableActiveReparents, "disable_active_reparents", DisableActiveReparents, "if set, do not allow active reparents. Use this to protect a cluster using external reparents.") + utils.SetFlagBoolVar(fs, &DisableActiveReparents, "disable-active-reparents", DisableActiveReparents, "if set, do not allow active reparents. Use this to protect a cluster using external reparents.") } func registerDeprecatedReparentFlags(fs *pflag.FlagSet) { - fs.BoolVar(&DisableActiveReparents, "disable_active_reparents", DisableActiveReparents, "if set, do not allow active reparents. Use this to protect a cluster using external reparents.") - fs.MarkDeprecated("disable_active_reparents", "Use --unmanaged flag instead for unmanaged tablets.") + utils.SetFlagBoolVar(fs, &DisableActiveReparents, "disable-active-reparents", DisableActiveReparents, "if set, do not allow active reparents. Use this to protect a cluster using external reparents.") + fs.MarkDeprecated("disable-active-reparents", "Use --unmanaged flag instead for unmanaged tablets.") } func registerPoolFlags(fs *pflag.FlagSet) { diff --git a/go/vt/schemamanager/schemamanager.go b/go/vt/schemamanager/schemamanager.go index 8a695a1164e..84d5398fbbf 100644 --- a/go/vt/schemamanager/schemamanager.go +++ b/go/vt/schemamanager/schemamanager.go @@ -30,10 +30,10 @@ import ( const ( // SchemaChangeDirName is the key name in the ControllerFactory params. // It specifies the schema change directory. - SchemaChangeDirName = "schema_change_dir" + SchemaChangeDirName = "schema-change-dir" // SchemaChangeUser is the key name in the ControllerFactory params. // It specifies the user who submits this schema change. - SchemaChangeUser = "schema_change_user" + SchemaChangeUser = "schema-change-user" ) // ControllerFactory takes a set params and construct a Controller instance. diff --git a/go/vt/vtctl/reparent.go b/go/vt/vtctl/reparent.go index 192d19ed7ee..161306c0308 100644 --- a/go/vt/vtctl/reparent.go +++ b/go/vt/vtctl/reparent.go @@ -69,7 +69,7 @@ func init() { func commandReparentTablet(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error { if mysqlctl.DisableActiveReparents { - return fmt.Errorf("active reparent commands disabled (unset the --disable_active_reparents flag to enable)") + return fmt.Errorf("active reparent commands disabled (unset the --disable-active-reparents flag to enable)") } if err := subFlags.Parse(args); err != nil { @@ -87,7 +87,7 @@ func commandReparentTablet(ctx context.Context, wr *wrangler.Wrangler, subFlags func commandInitShardPrimary(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error { if mysqlctl.DisableActiveReparents { - return fmt.Errorf("active reparent commands disabled (unset the --disable_active_reparents flag to enable)") + return fmt.Errorf("active reparent commands disabled (unset the --disable-active-reparents flag to enable)") } force := subFlags.Bool("force", false, "will force the reparent even if the provided tablet is not writable or the shard primary") @@ -111,7 +111,7 @@ func commandInitShardPrimary(ctx context.Context, wr *wrangler.Wrangler, subFlag func commandPlannedReparentShard(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error { if mysqlctl.DisableActiveReparents { - return fmt.Errorf("active reparent commands disabled (unset the --disable_active_reparents flag to enable)") + return fmt.Errorf("active reparent commands disabled (unset the --disable-active-reparents flag to enable)") } waitReplicasTimeout := subFlags.Duration("wait_replicas_timeout", topo.RemoteOperationTimeout, "time to wait for replicas to catch up on replication before and after reparenting") @@ -164,7 +164,7 @@ func commandPlannedReparentShard(ctx context.Context, wr *wrangler.Wrangler, sub func commandEmergencyReparentShard(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error { if mysqlctl.DisableActiveReparents { - return fmt.Errorf("active reparent commands disabled (unset the --disable_active_reparents flag to enable)") + return fmt.Errorf("active reparent commands disabled (unset the --disable-active-reparents flag to enable)") } waitReplicasTimeout := subFlags.Duration("wait_replicas_timeout", topo.RemoteOperationTimeout, "time to wait for replicas to catch up in reparenting") diff --git a/go/vt/vtctld/api.go b/go/vt/vtctld/api.go index 0452fce3c3d..dc03470200a 100644 --- a/go/vt/vtctld/api.go +++ b/go/vt/vtctld/api.go @@ -39,6 +39,7 @@ import ( "vitess.io/vitess/go/vt/servenv" "vitess.io/vitess/go/vt/topo" "vitess.io/vitess/go/vt/topo/topoproto" + "vitess.io/vitess/go/vt/utils" "vitess.io/vitess/go/vt/vtctl" "vitess.io/vitess/go/vt/vttablet/tmclient" "vitess.io/vitess/go/vt/wrangler" @@ -84,7 +85,7 @@ func init() { func registerVtctldAPIFlags(fs *pflag.FlagSet) { fs.StringVar(&localCell, "cell", localCell, "cell to use") - fs.BoolVar(&proxyTablets, "proxy_tablets", proxyTablets, "Setting this true will make vtctld proxy the tablet status instead of redirecting to them") + utils.SetFlagBoolVar(fs, &proxyTablets, "proxy-tablets", proxyTablets, "Setting this true will make vtctld proxy the tablet status instead of redirecting to them") } func newTabletWithURL(t *topodatapb.Tablet) *TabletWithURL { diff --git a/go/vt/vtctld/tablet_data.go b/go/vt/vtctld/tablet_data.go index f9482849bee..88162bcbf69 100644 --- a/go/vt/vtctld/tablet_data.go +++ b/go/vt/vtctld/tablet_data.go @@ -29,6 +29,7 @@ import ( "vitess.io/vitess/go/vt/servenv" "vitess.io/vitess/go/vt/topo" "vitess.io/vitess/go/vt/topo/topoproto" + "vitess.io/vitess/go/vt/utils" "vitess.io/vitess/go/vt/vttablet/tabletconn" querypb "vitess.io/vitess/go/vt/proto/query" @@ -66,7 +67,7 @@ func init() { } func registerVtctlTabletFlags(fs *pflag.FlagSet) { - fs.DurationVar(&tabletHealthKeepAlive, "tablet_health_keep_alive", tabletHealthKeepAlive, "close streaming tablet health connection if there are no requests for this long") + utils.SetFlagDurationVar(fs, &tabletHealthKeepAlive, "tablet-health-keep-alive", tabletHealthKeepAlive, "close streaming tablet health connection if there are no requests for this long") } func newTabletHealth() *tabletHealth { diff --git a/go/vt/vtctld/vtctld.go b/go/vt/vtctld/vtctld.go index 5ca3908c053..c380b1f1ed2 100644 --- a/go/vt/vtctld/vtctld.go +++ b/go/vt/vtctld/vtctld.go @@ -23,6 +23,7 @@ import ( "github.com/spf13/pflag" + "vitess.io/vitess/go/vt/utils" "vitess.io/vitess/go/vt/vtenv" "vitess.io/vitess/go/vt/servenv" @@ -46,7 +47,7 @@ func init() { } func registerVtctldFlags(fs *pflag.FlagSet) { - fs.BoolVar(&sanitizeLogMessages, "vtctld_sanitize_log_messages", sanitizeLogMessages, "When true, vtctld sanitizes logging.") + utils.SetFlagBoolVar(fs, &sanitizeLogMessages, "vtctld-sanitize-log-messages", sanitizeLogMessages, "When true, vtctld sanitizes logging.") } // InitVtctld initializes all the vtctld functionality. diff --git a/go/vt/wrangler/testlib/external_reparent_test.go b/go/vt/wrangler/testlib/external_reparent_test.go index 556debae64a..402b6725b4b 100644 --- a/go/vt/wrangler/testlib/external_reparent_test.go +++ b/go/vt/wrangler/testlib/external_reparent_test.go @@ -503,8 +503,8 @@ func TestRPCTabletExternallyReparentedDemotesPrimaryToConfiguredTabletType(t *te }() discovery.SetTabletPickerRetryDelay(5 * time.Millisecond) - flag.Set("disable_active_reparents", "true") - defer flag.Set("disable_active_reparents", "false") + flag.Set("disable-active-reparents", "true") + defer flag.Set("disable-active-reparents", "false") ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) defer cancel()