Skip to content

fix(protocol): handle ElectLeaders V1 non-flexible headers#3478

Open
DCjanus wants to merge 2 commits intoIBM:mainfrom
DCjanus:test/elect-leaders-regression
Open

fix(protocol): handle ElectLeaders V1 non-flexible headers#3478
DCjanus wants to merge 2 commits intoIBM:mainfrom
DCjanus:test/elect-leaders-regression

Conversation

@DCjanus
Copy link
Contributor

@DCjanus DCjanus commented Mar 19, 2026

Why

ElectLeaders request/response version 1 must use the non-flexible wire format.

That path was fixed once in #3312, but a later refactor left the ElectLeaders header version selection inconsistent with the protocol version again. As a result, a client configured for V2_3_0_0 can fail to decode ElectLeaders V1 responses from newer brokers with:

kafka: insufficient data to decode packet, more bytes expected

What

  • add a functional test that covers low-version client compatibility against newer brokers for the ElectLeaders V1 non-flexible path
  • select ElectLeaders request/response header versions from the actual protocol version instead of treating V1 as flexible

Testing

This PR contains two commits. The first commit only adds a functional test and is expected to fail. The second commit only contains the protocol fix and is expected to make CI pass.

Before opening this PR, I created a draft PR in my fork to run CI and verify that the test was actually effective.

DCjanus added 2 commits March 19, 2026 16:31
Signed-off-by: DCjanus <DCjanus@dcjanus.com>
Signed-off-by: DCjanus <DCjanus@dcjanus.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant