IBM / sarama

Sarama is a Go library for Apache Kafka.
MIT License
11.57k stars 1.76k forks source link

Breaking API change in a minor version release (v1.34.0) #2358

Closed Jeffail closed 1 year ago

Jeffail commented 2 years ago
Problem Description

Hey, we recently upgraded sarama from v1.30.1 to v1.37 in https://github.com/benthosdev/benthos. However, in v1.34.0 you introduced a breaking API change to (*OffsetCommitRequest) AddBlock (https://github.com/Shopify/sarama/commit/59a3d390ffc78a91fefdab99a094802a16e3750f#diff-df5fe5e6335379dccdd93c2bf7f3e52783a9b16cad64e53383066f5d8d2b070cR223). This might not seem like a big deal but because you're using Go modules and you haven't incremented the major version number it means downstream importers can potentially conflict with each other on which signature they're using, making it impossible(?) to import them both at the same time.

For example, a hypothetical user might want to import both benthos v3 and v4 at the same time, if v4 is using a version of sarama after v1.34 then their build will break because both imports will differ as to which signature they expect. I'm not sure how feasible it is for that user to fix things downstream.

We're going to have to downgrade for now, is this something you'd be willing to remedy in a future release?

dnwe commented 2 years ago

@Jeffail thanks for getting in touch. That's interesting, I wasn't aware that anyone was driving the offset commit protocol directly via the broker.go call rather than via offset_manager.go (or via a consumer client)

We can look at restoring the old AddBlock in another point release to fix this up in the short term

mihaitodor commented 1 year ago

I took a quick peek across GitHub and multiple projects will be impacted by this breaking change when they'll have to upgrade Sarama. It can be a nightmare if it's a transitive dependency and it would help a lot if you can address this somehow @dnwe before any major projects start patching their code to work around this change.