Skip to content

Commit

Permalink
bug: fix slice init length
Browse files Browse the repository at this point in the history
  • Loading branch information
longhutianjie committed Sep 4, 2024
1 parent 1ed18d0 commit d8be0f9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
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

0 comments on commit d8be0f9

Please sign in to comment.