-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sink: fix decInflight double decrement bug
a3d9f73 accidentally introduced a double decrement: we would handle a batch (first decrement), and if we needed to retry the batch, we would add it to be retried and decrement again. This would result in a negative inflight, and when the partition migrated to a different sink, it would never start draining because the inflight count would never hit 0 and thus it would always be "inflight" on the old sink. The panic that I added to catch a negative inflight was three lines too low; the conditional just before the panic would return on non-zero. We now move the panic up to ensure it will be hit just in case, but more importantly we simplify the inflight decrementing. This commit adds a new batchesFlat field to the produceRequest. batchesFlat is not modified after being issued, so now we can just range over all the batches that were in the request when handling the response and decrement them all inflight in one spot. This replaces three places we were decrementing inflight with one.
- Loading branch information
Showing
1 changed file
with
27 additions
and
12 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