@@ -99,10 +99,10 @@ func hasShardInKeyRanges(shard string, keyRanges []*topodatapb.KeyRange) (bool,
99
99
// getKeyspaceShardsToWatch converts the input clustersToWatch into a list of individual keyspace/shards.
100
100
func getKeyspaceShardsToWatch () ([]* topo.KeyspaceShard , error ) {
101
101
var keyspaceShards []* topo.KeyspaceShard
102
- keyspaceWatchKeyRanges := make (map [string ][]* topodatapb.KeyRange )
102
+ keyspaceWatchKeyRanges := make (map [string ][]* topodatapb.KeyRange , 0 )
103
103
for _ , clusterToWatch := range clustersToWatch {
104
104
var err error
105
- var keyRange * topodatapb.KeyRange
105
+ keyRange := & topodatapb.KeyRange {}
106
106
keyspace := clusterToWatch
107
107
if strings .Contains (clusterToWatch , "/" ) {
108
108
var shard string
@@ -143,11 +143,11 @@ func getKeyspaceShardsToWatch() ([]*topo.KeyspaceShard, error) {
143
143
log .Errorf ("Failed to parse key ranges for shard %q: %+v" , s , err )
144
144
} else if found {
145
145
keyspaceShardsMu .Lock ()
146
- defer keyspaceShardsMu .Unlock ()
147
146
keyspaceShards = append (keyspaceShards , & topo.KeyspaceShard {
148
147
Keyspace : keyspace ,
149
148
Shard : s ,
150
149
})
150
+ keyspaceShardsMu .Unlock ()
151
151
}
152
152
}
153
153
return nil
@@ -157,10 +157,6 @@ func getKeyspaceShardsToWatch() ([]*topo.KeyspaceShard, error) {
157
157
return nil , err
158
158
}
159
159
160
- slices .SortStableFunc (keyspaceShards , func (a , b * topo.KeyspaceShard ) int {
161
- return strings .Compare (a .String (), b .String ())
162
- })
163
-
164
160
return keyspaceShards , nil
165
161
}
166
162
0 commit comments