Skip to content

Commit b3767d8

Browse files
Migrate vtclient and vtgate protocol flags
Signed-off-by: Rohit Nayak <[email protected]>
1 parent 1dd002b commit b3767d8

File tree

3 files changed

+103
-101
lines changed

3 files changed

+103
-101
lines changed

go/cmd/vtclient/cli/vtclient.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"vitess.io/vitess/go/vt/logutil"
4040
"vitess.io/vitess/go/vt/servenv"
4141
"vitess.io/vitess/go/vt/sqlparser"
42+
"vitess.io/vitess/go/vt/utils"
4243
"vitess.io/vitess/go/vt/vitessdriver"
4344
"vitess.io/vitess/go/vt/vterrors"
4445
"vitess.io/vitess/go/vt/vtgate/vtgateconn"
@@ -92,16 +93,16 @@ func InitializeFlags() {
9293
Main.Flags().BoolVar(&jsonOutput, "json", jsonOutput, "Output JSON instead of human-readable table")
9394
Main.Flags().IntVar(&parallel, "parallel", parallel, "DMLs only: Number of threads executing the same query in parallel. Useful for simple load testing.")
9495
Main.Flags().IntVar(&count, "count", count, "DMLs only: Number of times each thread executes the query. Useful for simple, sustained load testing.")
95-
Main.Flags().IntVar(&minSeqID, "min_sequence_id", minSeqID, "min sequence ID to generate. When max_sequence_id > min_sequence_id, for each query, a number is generated in [min_sequence_id, max_sequence_id) and attached to the end of the bind variables.")
96-
Main.Flags().IntVar(&maxSeqID, "max_sequence_id", maxSeqID, "max sequence ID.")
97-
Main.Flags().BoolVar(&useRandom, "use_random_sequence", useRandom, "use random sequence for generating [min_sequence_id, max_sequence_id)")
96+
utils.SetFlagIntVar(Main.Flags(), &minSeqID, "min-sequence-id", minSeqID, "min sequence ID to generate. When max-sequence-id > min-sequence-id, for each query, a number is generated in [min-sequence-id, max-sequence-id) and attached to the end of the bind variables.")
97+
utils.SetFlagIntVar(Main.Flags(), &maxSeqID, "max-sequence-id", maxSeqID, "max sequence ID.")
98+
utils.SetFlagBoolVar(Main.Flags(), &useRandom, "use-random-sequence", useRandom, "use random sequence for generating [min-sequence-id, max-sequence-id)")
9899
Main.Flags().IntVar(&qps, "qps", qps, "queries per second to throttle each thread at.")
99100

100101
acl.RegisterFlags(Main.Flags())
101102
grpccommon.RegisterFlags(Main.Flags())
102103
servenv.RegisterMySQLServerFlags(Main.Flags())
103104

104-
bindVariables = newBindvars(Main.Flags(), "bind_variables", "bind variables as a json list")
105+
bindVariables = newBindvars(Main.Flags(), "bind-variables", "bind variables as a json list")
105106
}
106107

107108
type bindvars []any
@@ -146,7 +147,7 @@ func (bv *bindvars) Type() string {
146147

147148
func newBindvars(fs *pflag.FlagSet, name, usage string) *bindvars {
148149
var bv bindvars
149-
fs.Var(&bv, name, usage)
150+
utils.SetFlagVar(fs, &bv, name, usage)
150151
return &bv
151152
}
152153

go/flags/endtoend/flags_analysis.json

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -74,95 +74,95 @@
7474
}
7575
},
7676
"unique_underscore_flags": [
77-
"bind_variables",
78-
"default_tablet_type",
7977
"statsd_sample_rate",
78+
"shutdown_wait_time",
79+
"action_timeout",
80+
"mysql_ldap_auth_method",
81+
"restart_before_backup",
8082
"topocustomrule_cell",
81-
"min_number_serving_vttablets",
82-
"cells_to_watch",
83-
"binlog_player_grpc_crl",
84-
"binlog_player_grpc_cert",
85-
"statsd_address",
86-
"mysql_auth_vault_role_secretidfile",
87-
"mysql_auth_server_static_file",
83+
"external_topo_global_server_address",
84+
"mysql_timeout",
85+
"binlog_player_grpc_server_name",
86+
"max_sequence_id",
87+
"external_topo_global_root",
88+
"enable_online_ddl",
89+
"transaction_mode",
90+
"min_retention_time",
91+
"bind_variables",
8892
"file_backup_storage_root",
93+
"tablet_config",
94+
"mysql_auth_vault_addr",
95+
"unix_socket",
96+
"use_random_sequence",
97+
"binlog_player_grpc_crl",
98+
"rng_seed",
99+
"mysql_auth_vault_role_mountpoint",
100+
"cells_to_watch",
101+
"mysql_auth_vault_path",
102+
"num_shards",
103+
"binlog_player_grpc_key",
104+
"vtgate_protocol",
105+
"min_retention_count",
106+
"rdonly_count",
89107
"mysql_ldap_auth_config_string",
90-
"legacy_replication_lag_algorithm",
91-
"max_sequence_id",
92-
"snapshot_file",
93-
"min_table_shard_size",
108+
"discovery_high_replication_lag_minimum_serving",
109+
"mysql_ldap_auth_config_file",
110+
"extra_my_cnf",
111+
"vschema_ddl_authorized_users",
112+
"mysql_auth_vault_role_secretidfile",
113+
"min_number_serving_vttablets",
94114
"enable_buffer",
95-
"mysql_only",
96-
"min_retention_count",
97-
"mysql_auth_vault_role_mountpoint",
98-
"persistent_mode",
115+
"mysql_auth_server_static_file",
116+
"mysql_auth_vault_tls_ca",
117+
"filecustomrules_watch",
118+
"external_topo_implementation",
119+
"binlog_player_grpc_ca",
120+
"mysql_clientcert_auth_method",
121+
"mysql_bind_host",
122+
"data_dir",
123+
"null_probability",
99124
"gateway_initial_tablet_timeout",
100-
"default_schema_dir",
101-
"shutdown_wait_time",
102-
"mysql_ldap_auth_method",
103125
"enable_direct_ddl",
104-
"discovery_high_replication_lag_minimum_serving",
105-
"data_dir",
106-
"allow_first_backup",
107-
"binlog_player_grpc_key",
108126
"min_sequence_id",
109-
"incremental_from_pos",
110-
"min_retention_time",
111-
"min_backup_interval",
112-
"clusters_to_watch",
113-
"mysql_clientcert_auth_method",
114-
"external_topo_implementation",
115-
"mysql_timeout",
116-
"mysql_auth_vault_tls_ca",
117-
"num_shards",
118-
"log_backtrace_at",
119-
"external_topo_global_root",
120-
"mysql_auth_vault_path",
121-
"tablet_config",
122-
"topocustomrule_path",
123-
"restart_before_backup",
124-
"log_dir",
125-
"discovery_low_replication_lag",
126-
"initial_backup",
127-
"binlog_player_grpc_ca",
128-
"mysql_auth_vault_roleid",
129-
"mysql_auth_vault_timeout",
127+
"max_table_shard_size",
128+
"replica_count",
130129
"mysqlctl_client_protocol",
130+
"log_link",
131131
"log_queries",
132+
"log_backtrace_at",
133+
"enable_system_settings",
132134
"mysql_auth_server_static_string",
133-
"unix_socket",
134-
"external_topo_global_server_address",
135+
"default_schema_dir",
136+
"initial_backup",
137+
"persistent_mode",
138+
"binlog_player_grpc_cert",
139+
"mysql_auth_vault_timeout",
140+
"discovery_low_replication_lag",
141+
"min_table_shard_size",
135142
"mysql_auth_vault_tokenfile",
136-
"rdonly_count",
137-
"enable_system_settings",
138-
"extra_my_cnf",
139-
"mysql_bind_host",
140-
"vschema_ddl_authorized_users",
141-
"binlog_player_grpc_server_name",
142-
"action_timeout",
143-
"null_probability",
144-
"filecustomrules_watch",
145143
"mysql_auth_static_reload_interval",
144+
"min_backup_interval",
145+
"default_tablet_type",
146+
"topocustomrule_path",
147+
"legacy_replication_lag_algorithm",
148+
"mysql_auth_vault_roleid",
149+
"log_dir",
150+
"allow_first_backup",
146151
"mysql_auth_vault_ttl",
147-
"use_random_sequence",
148-
"mysql_ldap_auth_config_file",
149-
"max_table_shard_size",
150-
"replica_count",
151-
"rng_seed",
152-
"transaction_mode",
153-
"mysql_auth_vault_addr",
154-
"enable_online_ddl",
155-
"vtgate_protocol",
156-
"log_link"
152+
"mysql_only",
153+
"incremental_from_pos",
154+
"clusters_to_watch",
155+
"snapshot_file",
156+
"statsd_address"
157157
],
158158
"flag_to_binaries": {
159159
"allow_first_backup": [
160160
"vtbackup"
161161
],
162162
"file_backup_storage_root": [
163+
"vttablet",
163164
"vtctld",
164-
"vtbackup",
165-
"vttablet"
165+
"vtbackup"
166166
],
167167
"incremental_from_pos": [
168168
"vtbackup"
@@ -171,32 +171,32 @@
171171
"vtbackup"
172172
],
173173
"log_backtrace_at": [
174-
"vttestserver",
174+
"vtcombo",
175175
"vtorc",
176-
"vtbackup",
177-
"mysqlctl",
178-
"vtctldclient",
179176
"vtbench",
180-
"mysqlctld",
177+
"vtclient",
178+
"vttablet",
179+
"mysqlctl",
180+
"vttestserver",
181181
"vtgate",
182-
"vtcombo",
183182
"vtctld",
184-
"vttablet",
185-
"vtclient"
183+
"mysqlctld",
184+
"vtctldclient",
185+
"vtbackup"
186186
],
187187
"log_dir": [
188-
"vttestserver",
188+
"vtcombo",
189189
"vtorc",
190-
"vtbackup",
191-
"mysqlctl",
192-
"vtctldclient",
193190
"vtbench",
194-
"mysqlctld",
191+
"vtclient",
192+
"vttablet",
193+
"mysqlctl",
194+
"vttestserver",
195195
"vtgate",
196-
"vtcombo",
197196
"vtctld",
198-
"vttablet",
199-
"vtclient"
197+
"mysqlctld",
198+
"vtctldclient",
199+
"vtbackup"
200200
],
201201
"min_backup_interval": [
202202
"vtbackup"
@@ -214,9 +214,9 @@
214214
"vtbackup"
215215
],
216216
"action_timeout": [
217-
"vtcombo",
217+
"vtctldclient",
218218
"vtctld",
219-
"vtctldclient"
219+
"vtcombo"
220220
],
221221
"log_link": [
222222
"vtctldclient"
@@ -242,18 +242,18 @@
242242
"vtgate"
243243
],
244244
"enable_direct_ddl": [
245-
"vtcombo",
246245
"vttestserver",
246+
"vtcombo",
247247
"vtgate"
248248
],
249249
"enable_online_ddl": [
250-
"vtcombo",
251250
"vttestserver",
251+
"vtcombo",
252252
"vtgate"
253253
],
254254
"enable_system_settings": [
255-
"vtcombo",
256255
"vttestserver",
256+
"vtcombo",
257257
"vtgate"
258258
],
259259
"gateway_initial_tablet_timeout": [
@@ -314,21 +314,21 @@
314314
"vtgate"
315315
],
316316
"statsd_address": [
317-
"vttablet",
318-
"vtgate"
317+
"vtgate",
318+
"vttablet"
319319
],
320320
"statsd_sample_rate": [
321-
"vttablet",
322-
"vtgate"
321+
"vtgate",
322+
"vttablet"
323323
],
324324
"transaction_mode": [
325-
"vtcombo",
326325
"vttestserver",
326+
"vtcombo",
327327
"vtgate"
328328
],
329329
"vschema_ddl_authorized_users": [
330-
"vtcombo",
331330
"vttestserver",
331+
"vtcombo",
332332
"vtgate"
333333
],
334334
"clusters_to_watch": [

go/vt/vtgate/vtgateconn/vtgateconn.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"vitess.io/vitess/go/sqltypes"
2727
"vitess.io/vitess/go/vt/log"
2828
"vitess.io/vitess/go/vt/servenv"
29+
"vitess.io/vitess/go/vt/utils"
2930

3031
binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
3132
querypb "vitess.io/vitess/go/vt/proto/query"
@@ -37,7 +38,7 @@ import (
3738
var vtgateProtocol = "grpc"
3839

3940
func registerFlags(fs *pflag.FlagSet) {
40-
fs.StringVar(&vtgateProtocol, "vtgate_protocol", vtgateProtocol, "how to talk to vtgate")
41+
utils.SetFlagStringVar(fs, &vtgateProtocol, "vtgate-protocol", vtgateProtocol, "how to talk to vtgate")
4142
}
4243

4344
func init() {

0 commit comments

Comments
 (0)