Skip to content

Commit

Permalink
crosscluster/physical: defensively check errCh in span config event s…
Browse files Browse the repository at this point in the history
…tream

Select does not choose which channel to read from based on some order, but the
span config event stream must return as soon as there is an error. For this
reason, this patch rechecks the errCh after select chooses to read from the
data channel.

Informs #128865

Release note: none
  • Loading branch information
msbutler committed Aug 27, 2024
1 parent 6eb869f commit 8d6de3b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/ccl/crosscluster/producer/span_config_event_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ func (s *spanConfigEventStream) Next(ctx context.Context) (bool, error) {
case err := <-s.errCh:
return false, err
case s.data = <-s.streamCh:
return true, nil
select {
case err := <-s.errCh:
return false, err
default:
return true, nil
}
}
}

Expand Down

0 comments on commit 8d6de3b

Please sign in to comment.