Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add isValidVersion to protocol types #2538

Merged
merged 8 commits into from
Aug 3, 2023
Merged

Conversation

dnwe
Copy link
Collaborator

@dnwe dnwe commented Aug 1, 2023

The intention here is to add a common isValidVersion to all the protocol types so that we can check that a request version value is supported by the protocol encoder/decoder implementation before sending it (hence avoiding malformed requests on the broker side).

Additionally in this PR fixup the existing requiredVersion checks where they were incorrect and/or add missing values, also ensuring the request and response implementations were in agreement.

Finally add some testing in this area and in a few places start using newer version numbers where the config version value allows.

Contributes-to: #2408

Copy link
Collaborator

@hindessm hindessm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if all my comments made it but I can't see them in my refreshed review page now.

find_coordinator_request.go Outdated Show resolved Hide resolved
list_groups_request.go Outdated Show resolved Hide resolved
offset_request.go Outdated Show resolved Hide resolved
sasl_handshake_request.go Outdated Show resolved Hide resolved
create_topics_request.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@hindessm hindessm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When adding Version fields, we should probably fix the version functions to return them?

delete_topics_request.go Outdated Show resolved Hide resolved
@dnwe dnwe force-pushed the dnwe/is-valid-version branch 3 times, most recently from ca24f79 to 70d2c11 Compare August 1, 2023 16:40
init_producer_id_request.go Outdated Show resolved Hide resolved
add_partitions_to_txn_request.go Outdated Show resolved Hide resolved
add_offsets_to_txn_request.go Outdated Show resolved Hide resolved
end_txn_request.go Outdated Show resolved Hide resolved
txn_offset_commit_request.go Outdated Show resolved Hide resolved
delete_groups_request.go Show resolved Hide resolved
delete_records_request.go Outdated Show resolved Hide resolved
describe_log_dirs_request.go Outdated Show resolved Hide resolved
consumer_metadata_response.go Show resolved Hide resolved
produce_response.go Outdated Show resolved Hide resolved
@dnwe dnwe force-pushed the dnwe/is-valid-version branch 3 times, most recently from 12e0507 to 47c6581 Compare August 2, 2023 21:16
The intention here is that we can check that a request version value is
supported by the protocol encoder/decoder before sending it

Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
This is identical to v0 but can used from broker 2.0.0.0 onwards

Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
dnwe and others added 5 commits August 2, 2023 22:18
Testing uncovered a few mismatches between the requiredVersion
implementation in the request and response for these types

Also fix wrong key() in alter_configs_response!

Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
Co-authored-by: Mark Hindess <hindessm@users.noreply.github.com>
Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
This is really just proxying to
FindCoordinatorRequest/FindCoordinatorResponse, but for now just copy in
the same isValidVersion/requiredVersion code and ensure we're passing
Version to and from it correctly.

Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
Initially seeded with only the protocol versions required for Kafka
v1.1, check we've implemented the expected versions and they pass the
isValidVersion and the requiredVersion checks as expected.

Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
@dnwe dnwe added the feat label Aug 2, 2023
Copy link
Collaborator

@hindessm hindessm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dnwe dnwe merged commit ce1ac25 into main Aug 3, 2023
19 checks passed
@dnwe dnwe deleted the dnwe/is-valid-version branch August 3, 2023 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants