Skip to content
Closed
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
14 changes: 8 additions & 6 deletions go/test/endtoend/vreplication/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,6 @@ func (vc *VitessCluster) AddKeyspace(t *testing.T, cells []*Cell, ksName string,
cell.Keyspaces[ksName] = keyspace
cellsToWatch = cellsToWatch + cell.Name
}
for _, cell := range cells {
if len(cell.Vtgates) == 0 {
log.Infof("Starting vtgate")
vc.StartVtgate(t, cell, cellsToWatch)
}
}

require.NoError(t, vc.AddShards(t, cells, keyspace, shards, numReplicas, numRdonly, tabletIDBase, opts))
if schema != "" {
Expand All @@ -487,6 +481,14 @@ func (vc *VitessCluster) AddKeyspace(t *testing.T, cells []*Cell, ksName string,

err = vc.VtctldClient.ExecuteCommand("RebuildKeyspaceGraph", ksName)
require.NoError(t, err)

for _, cell := range cells {
if len(cell.Vtgates) == 0 {
log.Infof("Starting vtgate")
vc.StartVtgate(t, cell, cellsToWatch)
}
}

return keyspace, nil
}

Expand Down
16 changes: 14 additions & 2 deletions go/vt/vtgate/vtgate.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,20 @@ func Init(
// TabletGateway can create it's own healthcheck
gw := NewTabletGateway(ctx, hc, serv, cell)
gw.RegisterStats()
if err := gw.WaitForTablets(ctx, tabletTypesToWait); err != nil {
log.Fatalf("tabletGateway.WaitForTablets failed: %v", err)
// Retry loop for potential time-outs waiting for all tablets.
OuterLoop:
for {
err := gw.WaitForTablets(ctx, tabletTypesToWait)
switch {
case err == nil:
break OuterLoop
case errors.Is(err, context.DeadlineExceeded):
log.Warning("TabletGateway timed out waiting for tablets to become available - retrying.")

continue
default:
log.Fatalf("tabletGateway.WaitForTablets failed: %v", err)
}
}

dynamicConfig := NewDynamicViperConfig()
Expand Down
Loading