Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go/flags/endtoend/mysqlctl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ Global flags:
--stderrthreshold severity logs at or above this threshold go to stderr (default 1)
--tablet_dir string The directory within the vtdataroot to store vttablet/mysql files. Defaults to being generated by the tablet uid.
--tablet_uid uint Tablet UID (default 41983)
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--xbstream_restore_flags string flags to pass to xbstream command during restore. These should be space separated and will be added to the end of the command. These need to match the ones used for backup e.g. --compress / --decompress, --encrypt / --decrypt
--xtrabackup_backup_flags string flags to pass to backup command. These should be space separated and will be added to the end of the command
Expand Down
4 changes: 2 additions & 2 deletions go/flags/endtoend/mysqlctld.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ Usage of mysqlctld:
--stderrthreshold severity logs at or above this threshold go to stderr (default 1)
--tablet_dir string The directory within the vtdataroot to store vttablet/mysql files. Defaults to being generated by the tablet uid.
--tablet_uid uint Tablet UID (default 41983)
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--wait_time duration How long to wait for mysqld startup or shutdown (default 5m0s)
--xbstream_restore_flags string flags to pass to xbstream command during restore. These should be space separated and will be added to the end of the command. These need to match the ones used for backup e.g. --compress / --decompress, --encrypt / --decrypt
Expand Down
4 changes: 2 additions & 2 deletions go/flags/endtoend/vtaclcheck.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Usage of vtaclcheck:
--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)
--static-auth-file string The path of the auth_server_static JSON file to check
--stderrthreshold severity logs at or above this threshold go to stderr (default 1)
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
4 changes: 2 additions & 2 deletions go/flags/endtoend/vtbackup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ Usage of vtbackup:
--topo_zk_tls_ca string the server ca to use to validate servers when connecting to the zk topo server
--topo_zk_tls_cert string the cert to use to connect to the zk topo server, requires topo_zk_tls_key, enables TLS
--topo_zk_tls_key string the key to use to connect to the zk topo server, enables TLS
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--xbstream_restore_flags string flags to pass to xbstream command during restore. These should be space separated and will be added to the end of the command. These need to match the ones used for backup e.g. --compress / --decompress, --encrypt / --decrypt
--xtrabackup_backup_flags string flags to pass to backup command. These should be space separated and will be added to the end of the command
Expand Down
4 changes: 2 additions & 2 deletions go/flags/endtoend/vtctlclient.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Usage of vtctlclient:
--tracing-enable-logging whether to enable logging in the tracing service
--tracing-sampling-rate float sampling rate for the probabilistic jaeger sampler (default 0.1)
--tracing-sampling-type string sampling strategy to use for jaeger. possible values are 'const', 'probabilistic', 'rateLimiting', or 'remote' (default "const")
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--vtctl_client_protocol string Protocol to use to talk to the vtctl server. (default "grpc")
--vtctld_grpc_ca string the server ca to use to validate servers when connecting
Expand Down
4 changes: 2 additions & 2 deletions go/flags/endtoend/vtctld.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ Usage of vtctld:
--tracing-enable-logging whether to enable logging in the tracing service
--tracing-sampling-rate float sampling rate for the probabilistic jaeger sampler (default 0.1)
--tracing-sampling-type string sampling strategy to use for jaeger. possible values are 'const', 'probabilistic', 'rateLimiting', or 'remote' (default "const")
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--vtctl_healthcheck_retry_delay duration delay before retrying a failed healthcheck (default 5s)
--vtctl_healthcheck_timeout duration the health check timeout period (default 1m0s)
Expand Down
4 changes: 2 additions & 2 deletions go/flags/endtoend/vtexplain.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ Usage of vtexplain:
--topo_global_root string the path of the global topology data in the global topology server
--topo_global_server_address string the address of the global topology server
--topo_implementation string the topology implementation to use
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--vschema string Identifies the VTGate routing schema
--vschema-file string Identifies the VTGate routing schema file
Expand Down
4 changes: 2 additions & 2 deletions go/flags/endtoend/vtgate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ Usage of vtgate:
--tracing-sampling-rate float sampling rate for the probabilistic jaeger sampler (default 0.1)
--tracing-sampling-type string sampling strategy to use for jaeger. possible values are 'const', 'probabilistic', 'rateLimiting', or 'remote' (default "const")
--transaction_mode string SINGLE: disallow multi-db transactions, MULTI: allow multi-db transactions with best effort commit, TWOPC: allow multi-db transactions with 2pc commit (default "MULTI")
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--vschema_ddl_authorized_users string List of users authorized to execute vschema ddl operations, or '%' to allow all users.
--vtctld_addr string address of a vtctld instance
Expand Down
4 changes: 2 additions & 2 deletions go/flags/endtoend/vtgr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Usage of vtgr:
--topo_zk_tls_ca string the server ca to use to validate servers when connecting to the zk topo server
--topo_zk_tls_cert string the cert to use to connect to the zk topo server, requires topo_zk_tls_key, enables TLS
--topo_zk_tls_key string the key to use to connect to the zk topo server, enables TLS
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--vtgr_config string Config file for vtgr.
4 changes: 2 additions & 2 deletions go/flags/endtoend/vtorc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Usage of vtorc:
--topo_zk_tls_ca string the server ca to use to validate servers when connecting to the zk topo server
--topo_zk_tls_cert string the cert to use to connect to the zk topo server, requires topo_zk_tls_key, enables TLS
--topo_zk_tls_key string the key to use to connect to the zk topo server, enables TLS
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--wait-replicas-timeout duration Duration for which to wait for replica's to respond when issuing RPCs (default 30s)
4 changes: 2 additions & 2 deletions go/flags/endtoend/vttablet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ Usage of vttablet:
--tx_throttler_healthcheck_cells strings A comma-separated list of cells. Only tabletservers running in these cells will be monitored for replication lag by the transaction throttler.
--unhealthy_threshold duration replication lag after which a replica is considered unhealthy (default 2h0m0s)
--use_super_read_only Set super_read_only flag when performing planned failover.
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--vreplication_copy_phase_duration duration Duration for each copy phase loop (before running the next catchup: default 1h) (default 1h0m0s)
--vreplication_copy_phase_max_innodb_history_list_length int The maximum InnoDB transaction history that can exist on a vstreamer (source) before starting another round of copying rows. This helps to limit the impact on the source tablet. (default 1000000)
Expand Down
4 changes: 2 additions & 2 deletions go/flags/endtoend/vttestserver.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ Usage of vttestserver:
--topo_zk_tls_cert string the cert to use to connect to the zk topo server, requires topo_zk_tls_key, enables TLS
--topo_zk_tls_key string the key to use to connect to the zk topo server, enables TLS
--transaction_mode string Transaction mode MULTI (default), SINGLE or TWOPC (default "MULTI")
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--vschema_ddl_authorized_users string Comma separated list of users authorized to execute vschema ddl operations via vtgate
--vtctl_client_protocol string Protocol to use to talk to the vtctl server. (default "grpc")
Expand Down
4 changes: 2 additions & 2 deletions go/flags/endtoend/zkctl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Usage of zkctl:
--pprof strings enable profiling
--purge_logs_interval duration how often try to remove old logs (default 1h0m0s)
--stderrthreshold severity logs at or above this threshold go to stderr (default 1)
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--zk.cfg string zkid@server1:leaderPort1:electionPort1:clientPort1,...) (default "6@<hostname>:3801:3802:3803")
--zk.myid uint which server do you want to be? only needed when running multiple instance on one box, otherwise myid is implied by hostname
4 changes: 2 additions & 2 deletions go/flags/endtoend/zkctld.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Usage of zkctld:
--purge_logs_interval duration how often try to remove old logs (default 1h0m0s)
--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)
--stderrthreshold severity logs at or above this threshold go to stderr (default 1)
-v, --v Level log level for V logs
--version print binary version
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
--zk.cfg string zkid@server1:leaderPort1:electionPort1:clientPort1,...) (default "6@<hostname>:3801:3802:3803")
--zk.myid uint which server do you want to be? only needed when running multiple instance on one box, otherwise myid is implied by hostname
28 changes: 28 additions & 0 deletions go/internal/flag/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
//
// See VEP-4, phase 1 for details: https://github.com/vitessio/enhancements/blob/c766ea905e55409cddeb666d6073cd2ac4c9783e/veps/vep-4.md#phase-1-preparation
func Parse(fs *flag.FlagSet) {
preventGlogVFlagFromClobberingVersionFlagShorthand(fs)
fs.AddGoFlagSet(goflag.CommandLine)

if fs.Lookup("help") == nil {
Expand Down Expand Up @@ -96,6 +97,32 @@ func TrickGlog() {
os.Args = append(os.Args, args...)
}

// The default behavior of PFlagFromGoFlag (which is called on each flag when
// calling AddGoFlagSet) is to allow any flags with single-character names to be
// accessible both as, for example, `-v` and `--v`.
//
// This prevents us from exposing version via `--version|-v` (pflag will actually
// panic when it goes to add the glog log-level flag), so we intervene to blank
// out the Shorthand for _just_ that flag before adding the rest of the goflags
// to a particular pflag FlagSet.
//
// IMPORTANT: This must be called prior to AddGoFlagSet in both Parse and
// ParseFlagsForTest.
func preventGlogVFlagFromClobberingVersionFlagShorthand(fs *flag.FlagSet) {
// N.B. we use goflag.Lookup instead of this package's Lookup, because we
// explicitly want to check only the goflags.
if f := goflag.Lookup("v"); f != nil {
if fs.Lookup("v") != nil { // This check is exactly what AddGoFlagSet does.
return
}

pf := flag.PFlagFromGoFlag(f)
pf.Shorthand = ""

fs.AddFlag(pf)
}
}

// Usage invokes the current CommandLine's Usage func, or if not overridden,
// "prints a simple header and calls PrintDefaults".
func Usage() {
Expand Down Expand Up @@ -135,6 +162,7 @@ func ParseFlagsForTest() {
}

// parse remaining flags including the log-related ones like --alsologtostderr
preventGlogVFlagFromClobberingVersionFlagShorthand(flag.CommandLine)
flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
flag.Parse()
}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/servenv/buildinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var (
)

func registerVersionFlag(fs *pflag.FlagSet) {
fs.BoolVar(&version, "version", version, "print binary version")
fs.BoolVarP(&version, "version", "v", version, "print binary version")
}

// AppVersion is the struct to store build info.
Expand Down