From 8d6de3bf987c01739d5fb7f882486ab6793781c5 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Tue, 27 Aug 2024 10:58:52 -0400 Subject: [PATCH] crosscluster/physical: defensively check errCh in span config event stream 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 --- pkg/ccl/crosscluster/producer/span_config_event_stream.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/ccl/crosscluster/producer/span_config_event_stream.go b/pkg/ccl/crosscluster/producer/span_config_event_stream.go index feb2c73c5be6..90df0fb04eb1 100644 --- a/pkg/ccl/crosscluster/producer/span_config_event_stream.go +++ b/pkg/ccl/crosscluster/producer/span_config_event_stream.go @@ -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 + } } }