Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vtcombo] Expose --tablet_types_to_wait flag #14951

Merged
merged 1 commit into from
Feb 20, 2024
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
31 changes: 23 additions & 8 deletions go/cmd/vtcombo/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"vitess.io/vitess/go/vt/srvtopo"
"vitess.io/vitess/go/vt/topo"
"vitess.io/vitess/go/vt/topo/memorytopo"
"vitess.io/vitess/go/vt/topo/topoproto"
"vitess.io/vitess/go/vt/topotools"
"vitess.io/vitess/go/vt/vtcombo"
"vitess.io/vitess/go/vt/vtctld"
Expand Down Expand Up @@ -77,9 +78,10 @@
plannerName string
vschemaPersistenceDir string

tpb vttestpb.VTTestTopology
ts *topo.Server
resilientServer *srvtopo.ResilientServer
tpb vttestpb.VTTestTopology
ts *topo.Server
resilientServer *srvtopo.ResilientServer
tabletTypesToWait []topodatapb.TabletType

env *vtenv.Environment
)
Expand Down Expand Up @@ -114,6 +116,8 @@
Main.Flags().Var(vttest.TextTopoData(&tpb), "proto_topo", "vttest proto definition of the topology, encoded in compact text format. See vttest.proto for more information.")
Main.Flags().Var(vttest.JSONTopoData(&tpb), "json_topo", "vttest proto definition of the topology, encoded in json format. See vttest.proto for more information.")

Main.Flags().Var((*topoproto.TabletTypeListFlag)(&tabletTypesToWait), "tablet_types_to_wait", "Wait till connected for specified tablet types during Gateway initialization. Should be provided as a comma-separated set of tablet types.")

Check warning on line 119 in go/cmd/vtcombo/cli/main.go

View check run for this annotation

Codecov / codecov/patch

go/cmd/vtcombo/cli/main.go#L119

Added line #L119 was not covered by tests

// We're going to force the value later, so don't even bother letting the
// user know about this flag.
Main.Flags().MarkHidden("tablet_protocol")
Expand Down Expand Up @@ -294,19 +298,30 @@

// vtgate configuration and init
resilientServer = srvtopo.NewResilientServer(context.Background(), ts, "ResilientSrvTopoServer")
tabletTypesToWait := []topodatapb.TabletType{
topodatapb.TabletType_PRIMARY,
topodatapb.TabletType_REPLICA,
topodatapb.TabletType_RDONLY,

tabletTypes := make([]topodatapb.TabletType, 0, 1)
if len(tabletTypesToWait) != 0 {
for _, tt := range tabletTypesToWait {
if topoproto.IsServingType(tt) {
tabletTypes = append(tabletTypes, tt)

Check warning on line 306 in go/cmd/vtcombo/cli/main.go

View check run for this annotation

Codecov / codecov/patch

go/cmd/vtcombo/cli/main.go#L302-L306

Added lines #L302 - L306 were not covered by tests
}
}

if len(tabletTypes) == 0 {
log.Exitf("tablet_types_to_wait should contain at least one serving tablet type")

Check warning on line 311 in go/cmd/vtcombo/cli/main.go

View check run for this annotation

Codecov / codecov/patch

go/cmd/vtcombo/cli/main.go#L310-L311

Added lines #L310 - L311 were not covered by tests
}
} else {
tabletTypes = append(tabletTypes, topodatapb.TabletType_PRIMARY, topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY)

Check warning on line 314 in go/cmd/vtcombo/cli/main.go

View check run for this annotation

Codecov / codecov/patch

go/cmd/vtcombo/cli/main.go#L313-L314

Added lines #L313 - L314 were not covered by tests
}

plannerVersion, _ := plancontext.PlannerNameToVersion(plannerName)

vtgate.QueryLogHandler = "/debug/vtgate/querylog"
vtgate.QueryLogzHandler = "/debug/vtgate/querylogz"
vtgate.QueryzHandler = "/debug/vtgate/queryz"

// pass nil for healthcheck, it will get created
vtg := vtgate.Init(context.Background(), env, nil, resilientServer, tpb.Cells[0], tabletTypesToWait, plannerVersion)
vtg := vtgate.Init(context.Background(), env, nil, resilientServer, tpb.Cells[0], tabletTypes, plannerVersion)

Check warning on line 324 in go/cmd/vtcombo/cli/main.go

View check run for this annotation

Codecov / codecov/patch

go/cmd/vtcombo/cli/main.go#L324

Added line #L324 was not covered by tests

// vtctld configuration and init
err = vtctld.InitVtctld(env, ts)
Expand Down
1 change: 1 addition & 0 deletions go/flags/endtoend/vtcombo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ Flags:
--tablet_manager_protocol string Protocol to use to make tabletmanager RPCs to vttablets. (default "grpc")
--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_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.
arthurschreiber marked this conversation as resolved.
Show resolved Hide resolved
--tablet_url_template string Format string describing debug tablet url formatting. See getTabletDebugURL() for how to customize this. (default "http://{{ "{{.GetTabletHostPort}}" }}")
--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)
Expand Down
Loading