Skip to content

Commit

Permalink
Merge #114493
Browse files Browse the repository at this point in the history
114493: rangefeed: clarify `runRequest()` comments r=erikgrinaker a=erikgrinaker

See #114379 (review).

Epic: none
Release note: None

Co-authored-by: Erik Grinaker <[email protected]>
  • Loading branch information
craig[bot] and erikgrinaker committed Nov 29, 2023
2 parents 01baf83 + 884d935 commit 30c40a2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/kv/kvserver/rangefeed/scheduled_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ func runRequest[T interface{}](
result <- f(ctx, p)
// Assert that we never process requests after stoppedC is closed. This is
// necessary to coordinate catchup iter ownership and avoid double-closing.
// Note that request/stop processing is always sequential, see process().
if buildutil.CrdbTestBuild {
select {
case <-p.stoppedC:
Expand All @@ -600,8 +601,9 @@ func runRequest[T interface{}](
case r = <-result:
return r
case <-p.stoppedC:
// If the request was processed concurrently with a stop, there's a 50%
// chance we didn't take the result branch. Check again.
// If a request and stop were processed in rapid succession, and the node is
// overloaded, this select may observe them happening at the same time and
// take this branch instead of the result with 50% probability. Check again.
select {
case r = <-result:
default:
Expand Down

0 comments on commit 30c40a2

Please sign in to comment.