-
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sink: fix out-of-order response handling across partition rebalances
If a recBuf moves from one sink to another while requests are inflight, there is a pathological case that allows responses to finish out of order. A lot of assumptions in the code exist such that all requests will be processed in order: this is the guarantee of handleSeqResps. However, handleSeqResps only works per sink. If a recBuf moves to a different sink while requests are inflight, theoretically it could create a request, issue it, receive a response, and handle that response before the active inflight responses are received / handled on the original sink. In the worst case, this could lead to panics: A: has two requests in flight A: first request fails, reset the drain index to 0 metadata update moves partition to sink B B: issues and finishes first request B: issues second request. This is duplicate to A's second request. A: second request finally fails, resets the drain index to 0 B: second request finishes successfully, decrements batch drain index The next time the recBuf is used, the batchDrainIdx will be negative and the client will panic. It is difficult to imagine a scenario that has this same failure case without multiple requests inflight. Regardless, the code now does not start issuing requests on the new sink until all requests on the old have finished. This moves closer to the guarantee that all requests are handled in order: we remove the cross-sink failure case.
- Loading branch information
Showing
1 changed file
with
93 additions
and
24 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