Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix consumer: do not buffer partitions we reload
There are two cases where we delete a used offset from our usedOffsets map: when the response indicated a partition needs to be fetched on a different replica, and when a response indicated the partition has either the OffsetOutOfRange error or FencedLeaderEpoch error. In the first case, we already avoided processing the response partition & keeping it. There was nothing to process. In the second case, we always kept the partition and returned it to users. We would clear the error, which we handled internally, but returning the partition potentially allowed giving the user some high / low watermarks. Odds are that the watermakrs actually were not usable because of the partition error, and keeping the partition resulting in problems with PollRecords. If we returns the partition to users, but deleted it from our own used offsets, then takeNBuffered would panic. takeNBuffered would lookup the taken partition in the used offsets and blindly use the offset, but the offset would be nil. We now keep the partition & return it to users only if it has no error or an error we are not internally handling. This means waste for users to process, and no bug in takeNBuffered. I've tested this locally, causing the panic by internally setting kerr.OffsetOutOfRange, and then ensuring this patch fixes it. Closes #87.
- Loading branch information