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

Fix spec for GroupCoordinatorResponse_v1 #961

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions aiokafka/admin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
each request to servers and can be used to identify specific
server-side log entries that correspond to this client. Also
submitted to GroupCoordinator for logging with respect to
consumer group administration. Default: 'kafka-python-{version}'
consumer group administration. Default: 'aiokafka-{version}'
request_timeout_ms (int): Client request timeout in milliseconds.
Default: 40000.
connections_max_idle_ms: Close idle connections after the number of
Expand Down Expand Up @@ -508,10 +508,7 @@

:return int: the acting coordinator broker id
"""
# FIXME GroupCoordinatorRequest_v1 in kafka-python 2.0.2 doesn't match
# spec causing "ValueError: Buffer underrun decoding string"
# version = self._matching_api_version(GroupCoordinatorRequest)
version = self._matching_api_version(GroupCoordinatorRequest[:1])
version = self._matching_api_version(GroupCoordinatorRequest)

Check warning on line 511 in aiokafka/admin/client.py

View check run for this annotation

Codecov / codecov/patch

aiokafka/admin/client.py#L511

Added line #L511 was not covered by tests
if version == 0 and coordinator_type:
raise IncompatibleBrokerVersion(
"Cannot query for transaction id on current broker version"
Expand Down
10 changes: 8 additions & 2 deletions aiokafka/protocol/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ class GroupCoordinatorResponse_v1(Response):
API_KEY = 10
API_VERSION = 1
SCHEMA = Schema(
("throttle_time_ms", Int32),
("error_code", Int16),
("error_message", String("utf-8")),
("coordinator_id", Int32),
Expand All @@ -292,14 +293,19 @@ class GroupCoordinatorRequest_v0(Request):
API_KEY = 10
API_VERSION = 0
RESPONSE_TYPE = GroupCoordinatorResponse_v0
SCHEMA = Schema(("consumer_group", String("utf-8")))
SCHEMA = Schema(
("consumer_group", String("utf-8")),
)


class GroupCoordinatorRequest_v1(Request):
API_KEY = 10
API_VERSION = 1
RESPONSE_TYPE = GroupCoordinatorResponse_v1
SCHEMA = Schema(("coordinator_key", String("utf-8")), ("coordinator_type", Int8))
SCHEMA = Schema(
("coordinator_key", String("utf-8")),
("coordinator_type", Int8),
)


GroupCoordinatorRequest = [GroupCoordinatorRequest_v0, GroupCoordinatorRequest_v1]
Expand Down
Loading