Skip to content

Commit 65113cf

Browse files
authored
Updates protocol json files to 4.3 (#3037)
1 parent 3822879 commit 65113cf

32 files changed

Lines changed: 142 additions & 46 deletions

kafka/admin/_groups.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ def _alter_group_offsets_request(group_id, offsets):
378378
retention_time_ms=-1,
379379
topics=[_Topic(name=name, partitions=parts)
380380
for name, parts in topic2partitions.items()],
381+
max_version=8,
381382
)
382383

383384
@staticmethod

kafka/coordinator/consumer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ async def _send_offset_commit_request(self, offsets):
937937
_Topic = OffsetCommitRequest.OffsetCommitRequestTopic
938938
_Partition = _Topic.OffsetCommitRequestPartition
939939
request = OffsetCommitRequest(
940+
max_version=8,
940941
group_id=self.group_id,
941942
generation_id_or_member_epoch=generation.generation_id,
942943
member_id=generation.member_id,

kafka/protocol/admin/cluster.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class DescribeLogDirsResponse(ApiMessage):
180180
topics: list[DescribeLogDirsTopic]
181181
total_bytes: int
182182
usable_bytes: int
183+
is_cordoned: bool
183184
def __init__(
184185
self,
185186
*args: Any,
@@ -188,6 +189,7 @@ class DescribeLogDirsResponse(ApiMessage):
188189
topics: list[DescribeLogDirsTopic] = ...,
189190
total_bytes: int = ...,
190191
usable_bytes: int = ...,
192+
is_cordoned: bool = ...,
191193
version: int | None = None,
192194
**kwargs: Any,
193195
) -> None: ...

kafka/protocol/admin/topics.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,13 @@ class AlterPartitionReassignmentsRequest(ApiMessage):
394394
def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...
395395

396396
timeout_ms: int
397+
allow_replication_factor_change: bool
397398
topics: list[ReassignableTopic]
398399
def __init__(
399400
self,
400401
*args: Any,
401402
timeout_ms: int = ...,
403+
allow_replication_factor_change: bool = ...,
402404
topics: list[ReassignableTopic] = ...,
403405
version: int | None = None,
404406
**kwargs: Any,
@@ -454,13 +456,15 @@ class AlterPartitionReassignmentsResponse(ApiMessage):
454456
def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...
455457

456458
throttle_time_ms: int
459+
allow_replication_factor_change: bool
457460
error_code: int
458461
error_message: str | None
459462
responses: list[ReassignableTopicResponse]
460463
def __init__(
461464
self,
462465
*args: Any,
463466
throttle_time_ms: int = ...,
467+
allow_replication_factor_change: bool = ...,
464468
error_code: int = ...,
465469
error_message: str | None = ...,
466470
responses: list[ReassignableTopicResponse] = ...,

kafka/protocol/consumer/fetch.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class FetchRequest(ApiMessage):
3333
log_start_offset: int
3434
partition_max_bytes: int
3535
replica_directory_id: uuid.UUID
36+
high_watermark: int
3637
def __init__(
3738
self,
3839
*args: Any,
@@ -43,6 +44,7 @@ class FetchRequest(ApiMessage):
4344
log_start_offset: int = ...,
4445
partition_max_bytes: int = ...,
4546
replica_directory_id: uuid.UUID = ...,
47+
high_watermark: int = ...,
4648
version: int | None = None,
4749
**kwargs: Any,
4850
) -> None: ...

kafka/protocol/consumer/group.pyi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,13 @@ class OffsetFetchRequest(ApiMessage):
386386
class OffsetFetchRequestGroup(DataContainer):
387387
class OffsetFetchRequestTopics(DataContainer):
388388
name: str
389+
topic_id: uuid.UUID
389390
partition_indexes: list[int]
390391
def __init__(
391392
self,
392393
*args: Any,
393394
name: str = ...,
395+
topic_id: uuid.UUID = ...,
394396
partition_indexes: list[int] = ...,
395397
version: int | None = None,
396398
**kwargs: Any,
@@ -509,11 +511,13 @@ class OffsetFetchResponse(ApiMessage):
509511
def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...
510512

511513
name: str
514+
topic_id: uuid.UUID
512515
partitions: list[OffsetFetchResponsePartitions]
513516
def __init__(
514517
self,
515518
*args: Any,
516519
name: str = ...,
520+
topic_id: uuid.UUID = ...,
517521
partitions: list[OffsetFetchResponsePartitions] = ...,
518522
version: int | None = None,
519523
**kwargs: Any,
@@ -593,11 +597,13 @@ class OffsetCommitRequest(ApiMessage):
593597
def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...
594598

595599
name: str
600+
topic_id: uuid.UUID
596601
partitions: list[OffsetCommitRequestPartition]
597602
def __init__(
598603
self,
599604
*args: Any,
600605
name: str = ...,
606+
topic_id: uuid.UUID = ...,
601607
partitions: list[OffsetCommitRequestPartition] = ...,
602608
version: int | None = None,
603609
**kwargs: Any,
@@ -659,11 +665,13 @@ class OffsetCommitResponse(ApiMessage):
659665
def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...
660666

661667
name: str
668+
topic_id: uuid.UUID
662669
partitions: list[OffsetCommitResponsePartition]
663670
def __init__(
664671
self,
665672
*args: Any,
666673
name: str = ...,
674+
topic_id: uuid.UUID = ...,
667675
partitions: list[OffsetCommitResponsePartition] = ...,
668676
version: int | None = None,
669677
**kwargs: Any,

kafka/protocol/producer/produce.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ class ProduceRequest(ApiMessage):
2626
def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...
2727

2828
name: str
29+
topic_id: uuid.UUID
2930
partition_data: list[PartitionProduceData]
3031
def __init__(
3132
self,
3233
*args: Any,
3334
name: str = ...,
35+
topic_id: uuid.UUID = ...,
3436
partition_data: list[PartitionProduceData] = ...,
3537
version: int | None = None,
3638
**kwargs: Any,
@@ -131,11 +133,13 @@ class ProduceResponse(ApiMessage):
131133
def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...
132134

133135
name: str
136+
topic_id: uuid.UUID
134137
partition_responses: list[PartitionProduceResponse]
135138
def __init__(
136139
self,
137140
*args: Any,
138141
name: str = ...,
142+
topic_id: uuid.UUID = ...,
139143
partition_responses: list[PartitionProduceResponse] = ...,
140144
version: int | None = None,
141145
**kwargs: Any,

kafka/protocol/producer/transaction.pyi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ class InitProducerIdRequest(ApiMessage):
1212
transaction_timeout_ms: int
1313
producer_id: int
1414
producer_epoch: int
15+
enable2_pc: bool
16+
keep_prepared_txn: bool
1517
def __init__(
1618
self,
1719
*args: Any,
1820
transactional_id: str | None = ...,
1921
transaction_timeout_ms: int = ...,
2022
producer_id: int = ...,
2123
producer_epoch: int = ...,
24+
enable2_pc: bool = ...,
25+
keep_prepared_txn: bool = ...,
2226
version: int | None = None,
2327
**kwargs: Any,
2428
) -> None: ...
@@ -44,13 +48,17 @@ class InitProducerIdResponse(ApiMessage):
4448
error_code: int
4549
producer_id: int
4650
producer_epoch: int
51+
ongoing_txn_producer_id: int
52+
ongoing_txn_producer_epoch: int
4753
def __init__(
4854
self,
4955
*args: Any,
5056
throttle_time_ms: int = ...,
5157
error_code: int = ...,
5258
producer_id: int = ...,
5359
producer_epoch: int = ...,
60+
ongoing_txn_producer_id: int = ...,
61+
ongoing_txn_producer_epoch: int = ...,
5462
version: int | None = None,
5563
**kwargs: Any,
5664
) -> None: ...

kafka/protocol/schemas/resources/AlterPartitionReassignmentsRequest.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
"type": "request",
1919
"listeners": ["broker", "controller"],
2020
"name": "AlterPartitionReassignmentsRequest",
21-
"validVersions": "0",
21+
// Version 1 adds the ability to allow/disallow changing the replication factor as part of the request.
22+
"validVersions": "0-1",
2223
"flexibleVersions": "0+",
2324
"fields": [
2425
{ "name": "TimeoutMs", "type": "int32", "versions": "0+", "default": "60000",
2526
"about": "The time in ms to wait for the request to complete." },
27+
{ "name": "AllowReplicationFactorChange", "type": "bool", "versions": "1+", "default": "true",
28+
"about": "The option indicating whether changing the replication factor of any given partition as part of this request is a valid move." },
2629
{ "name": "Topics", "type": "[]ReassignableTopic", "versions": "0+",
2730
"about": "The topics to reassign.", "fields": [
2831
{ "name": "Name", "type": "string", "versions": "0+", "entityType": "topicName",

kafka/protocol/schemas/resources/AlterPartitionReassignmentsResponse.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@
1717
"apiKey": 45,
1818
"type": "response",
1919
"name": "AlterPartitionReassignmentsResponse",
20-
"validVersions": "0",
20+
// Version 1 adds the ability to allow/disallow changing the replication factor as part of the request.
21+
"validVersions": "0-1",
2122
"flexibleVersions": "0+",
2223
"fields": [
2324
{ "name": "ThrottleTimeMs", "type": "int32", "versions": "0+",
2425
"about": "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota." },
26+
{ "name": "AllowReplicationFactorChange", "type": "bool", "versions": "1+", "default": "true", "ignorable": true,
27+
"about": "The option indicating whether changing the replication factor of any given partition as part of the request was allowed." },
2528
{ "name": "ErrorCode", "type": "int16", "versions": "0+",
2629
"about": "The top-level error code, or 0 if there was no error." },
2730
{ "name": "ErrorMessage", "type": "string", "versions": "0+", "nullableVersions": "0+",

0 commit comments

Comments
 (0)