Skip to content

Commit 0361dda

Browse files
committed
rangefeed: de-flake TestRangefeedCatchupStarvation
It installed a callback that would send to a channel to signal that it was blocked, but it could do this sending more than once but the channel was not buffered and only read once. This resulted in a deadlock. The fix is to make the channel 1-buffered and to skip sending if it is full. Closes #143163. Epic: none Release note: None
1 parent af1c770 commit 0361dda

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/kv/kvclient/rangefeed/rangefeed_external_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,10 +1923,14 @@ func TestRangefeedCatchupStarvation(t *testing.T) {
19231923
f, err := rangefeed.NewFactory(s.AppStopper(), db, s.ClusterSettings(), nil)
19241924
require.NoError(t, err)
19251925

1926-
blocked := make(chan struct{})
1926+
blocked := make(chan struct{}, 1)
19271927
r1, err := f.RangeFeed(ctx, "consumer-1-rf-1", []roachpb.Span{span}, ts,
19281928
func(ctx context.Context, value *kvpb.RangeFeedValue) {
1929-
blocked <- struct{}{}
1929+
select {
1930+
case blocked <- struct{}{}:
1931+
default:
1932+
// We can hit this case on retries.
1933+
}
19301934
<-ctx.Done()
19311935
},
19321936
rangefeed.WithConsumerID(1),

0 commit comments

Comments
 (0)