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

bug: fix slice init length #16708

Closed
wants to merge 1 commit into from
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
2 changes: 1 addition & 1 deletion go/vt/topo/srv_keyspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ func (ts *Server) GetSrvKeyspaceAllCells(ctx context.Context, keyspace string) (
return nil, err
}

srvKeyspaces := make([]*topodatapb.SrvKeyspace, len(cells))
srvKeyspaces := make([]*topodatapb.SrvKeyspace, 0, len(cells))
for _, cell := range cells {
srvKeyspace, err := ts.GetSrvKeyspace(ctx, cell, keyspace)
switch {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/fakerpcvtgateconn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func newSession(
keyspace string,
shards []string,
tabletType topodatapb.TabletType) *vtgatepb.Session {
shardSessions := make([]*vtgatepb.Session_ShardSession, len(shards))
shardSessions := make([]*vtgatepb.Session_ShardSession, 0, len(shards))
for _, shard := range shards {
shardSessions = append(shardSessions, &vtgatepb.Session_ShardSession{
Target: &querypb.Target{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (vc *vcopier) copyAll(ctx context.Context, settings binlogplayer.VRSettings

lastpk = nil
// pkfields are only used for logging, so that we can monitor progress.
pkfields = make([]*querypb.Field, len(resp.Pkfields))
pkfields = make([]*querypb.Field, 0, len(resp.Pkfields))
for _, f := range resp.Pkfields {
pkfields = append(pkfields, f.CloneVT())
}
Expand Down