Ensure lifted committers carry a reference to root committer so they're not duplicated - #1531
Merged
Merged
Conversation
…re not duplicated New `mapK` function introduced in typelevel#1522 creates a new committer on every call and its `Eq` instance is based on `equals` so every mapK generates a new committer equal to nothing else. The problem is CommittableOffsetBatch groups by committer, so a lifted stream like the one we create in trace4cats-kafka fell back to one comit per record, in parallel. This solves it by adding a "pointer" to the source committer, so that can be used for `hashCode` and `equals`.
The class is sealed with a package-private constructor so no one outside this repo can implement it.
Contributor
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Member
|
Thanks @alejandrohdezma! |
Member
|
@alejandrohdezma v4.1.2 is on it's way to Maven Central with this and #1530. |
Contributor
Author
|
Thank you @vlovgr! |
scala-steward
pushed a commit
to scala-steward/trace4cats-kafka
that referenced
this pull request
Oct 1, 2026
fs2-kafka 4.1.2 (typelevel/fs2-kafka#1531) makes a committer produced by `KafkaCommitter#mapK` equal to the committer it was derived from, so `CommittableOffsetBatch` merges lifted offsets again. `injectK` no longer needs to cache one lifted committer per consumer, and the `fs2.kafka.LiftedCommittableOffset` shim that rebuilt offsets around the cached committer goes with it. 4.1.2 also fixes the deadlock on `KafkaConsumer#unsubscribe` once partitions are assigned (typelevel/fs2-kafka#1530).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
New
mapKfunction introduced in #1522 creates a new committer on every call and itsEqinstance is based onequalsso every mapK generates a new committer equal to nothing else. The problem is CommittableOffsetBatch groups by committer, so a lifted stream like the one we create in trace4cats-kafka fell back to one comit per record, in parallel.This solves it by adding a "pointer" to the source committer, so that can be used for
hashCodeandequals.