-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
96230: kvcoord: Fix multiple MuxRangeFeed client bugs r=miretskiy a=miretskiy This PR addresses multiple issues with MuxRangeFeed client implementation, identified by running various CDC stress tests. The first issue was incorrect context used when establishing MuxRangeFeed with a node. When calling `startMuxRangeFeed`, the caller provided context was used to establish the RPC with a node. However, this context was meant to be used only for a single range rangefeed -- and not for a node level MuxRangeFeed RPC. As a result, as soon as the first rangefeed completed (perhaps due to an error, such as range split), the entire node level MuxRangeFeed, along with all of the ranges running on that node, would be canceled. The second issue is a race between consumer termination (consumer is a single range rangefeed), and the "demux" loop. There were really two races here. First, when we return an error to the caller (e.g. range split), the caller simply executes cleanup and returns. The cleanup removes the information about the stream from the mux rangefeed, which produces an error. Secondly, it is possible for the demux loop to observe additional events even after receving event error. This is because the rangefeed processor (server side) termination is asynchronous. It is possible that when the server shuts down (i.e. cancels) output loop due to an error (range split), the internal buffer may still have some events (such as checkpoint). It's a race whether or not such event will be sent on the RPC stream. If such event arrives, demux loop will block forever because the caller already terminated. The fixes in this PR were verified by observing non-flaky execution over 25000 runs of multiple CDC tests(TestChangefeedInitialScanOnly, and others). Informs #95781 Release note: None Co-authored-by: Yevgeniy Miretskiy <[email protected]>
- Loading branch information
Showing
7 changed files
with
289 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.