Skip to content

Commit

Permalink
var rename
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <[email protected]>
  • Loading branch information
timvaillancourt committed Jan 15, 2025
1 parent 48a50c4 commit c7950a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions go/vt/vtorc/logic/tablet_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func keyRangesContainShard(keyRanges []*topodatapb.KeyRange, shard string) (bool
// getKeyspaceShardsToWatch converts the input clustersToWatch into a list of individual keyspace/shards.
func getKeyspaceShardsToWatch() ([]*topo.KeyspaceShard, error) {
var keyspaceShards []*topo.KeyspaceShard
keyspaceKeyRanges := make(map[string][]*topodatapb.KeyRange)
keyspaceWatchKeyRanges := make(map[string][]*topodatapb.KeyRange)
for _, clusterToWatch := range clustersToWatch {
var err error
var keyRange *topodatapb.KeyRange
Expand All @@ -117,15 +117,15 @@ func getKeyspaceShardsToWatch() ([]*topo.KeyspaceShard, error) {
continue
}
}
keyspaceKeyRanges[keyspace] = append(keyspaceKeyRanges[keyspace], keyRange)
keyspaceWatchKeyRanges[keyspace] = append(keyspaceWatchKeyRanges[keyspace], keyRange)
}

ctx, cancel := context.WithTimeout(context.Background(), topo.RemoteOperationTimeout)
defer cancel()
eg, ctx := errgroup.WithContext(ctx)

var keyspaceShardsMu sync.Mutex
for keyspace, keyRanges := range keyspaceKeyRanges {
for keyspace, watchKeyRanges := range keyspaceWatchKeyRanges {
eg.Go(func() error {
shards, err := ts.GetShardNames(ctx, keyspace)
if err != nil {
Expand All @@ -139,7 +139,7 @@ func getKeyspaceShardsToWatch() ([]*topo.KeyspaceShard, error) {
}

for _, s := range shards {
if found, err := keyRangesContainShard(keyRanges, s); err != nil {
if found, err := keyRangesContainShard(watchKeyRanges, s); err != nil {
log.Errorf("Failed to parse key ranges for shard %q: %+v", s, err)
} else if found {
keyspaceShardsMu.Lock()
Expand Down

0 comments on commit c7950a2

Please sign in to comment.