From 884d935af9a7892042f8f338ee0a1e8371be1c1a Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Wed, 15 Nov 2023 14:49:10 +0000 Subject: [PATCH] rangefeed: clarify `runRequest()` comments Epic: none Release note: None --- pkg/kv/kvserver/rangefeed/scheduled_processor.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/kv/kvserver/rangefeed/scheduled_processor.go b/pkg/kv/kvserver/rangefeed/scheduled_processor.go index ee2e26076798..38617c13ee29 100644 --- a/pkg/kv/kvserver/rangefeed/scheduled_processor.go +++ b/pkg/kv/kvserver/rangefeed/scheduled_processor.go @@ -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: @@ -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: