Skip to content

Commit 6b825e3

Browse files
craig[bot]tbg
andcommitted
Merge #143187
143187: rangefeed: de-flake TestRangefeedCatchupStarvation r=tbg a=tbg 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 Co-authored-by: Tobias Grieger <[email protected]>
2 parents 669cbd4 + 0361dda commit 6b825e3

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
@@ -1917,10 +1917,14 @@ func TestRangefeedCatchupStarvation(t *testing.T) {
19171917
f, err := rangefeed.NewFactory(s.AppStopper(), db, s.ClusterSettings(), nil)
19181918
require.NoError(t, err)
19191919

1920-
blocked := make(chan struct{})
1920+
blocked := make(chan struct{}, 1)
19211921
r1, err := f.RangeFeed(ctx, "consumer-1-rf-1", []roachpb.Span{span}, ts,
19221922
func(ctx context.Context, value *kvpb.RangeFeedValue) {
1923-
blocked <- struct{}{}
1923+
select {
1924+
case blocked <- struct{}{}:
1925+
default:
1926+
// We can hit this case on retries.
1927+
}
19241928
<-ctx.Done()
19251929
},
19261930
rangefeed.WithConsumerID(1),

0 commit comments

Comments
 (0)