release-23.1: c2c: fix rangefeed error propogration race #103014
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 1/1 commits from #102876 on behalf of @msbutler.
/cc @cockroachdb/release
In the producer dist sql processor, rangefeed errors only propograte to the user if the error can be sent on a non-blocking channel. Because the channel was previously unbuffered, the dist sql processor would inadvertently swallow the error if the receiver was not actively waiting on the channel. This would then cause the sql processor to hang, as the underlying rangefeed would close after the ignored error message.
This patch buffers the errCh, guaranteeing that the first rangefeed error will be processed by the sql processor. If the rangefeed surfaces several errors while the buffered channel is full, these errors will be swallowed, which is fine, as the first error will always shut down the sql processor.
Fixes #102286
Release note: None
Release justification: bug fix