@@ -94,6 +94,72 @@ class FetchResponse_v6(Response):
94
94
SCHEMA = FetchResponse_v5 .SCHEMA
95
95
96
96
97
+ class FetchResponse_v7 (Response ):
98
+ """
99
+ Add error_code and session_id to response
100
+ """
101
+ API_KEY = 1
102
+ API_VERSION = 7
103
+ SCHEMA = Schema (
104
+ ('throttle_time_ms' , Int32 ),
105
+ ('error_code' , Int16 ),
106
+ ('session_id' , Int32 ),
107
+ ('topics' , Array (
108
+ ('topics' , String ('utf-8' )),
109
+ ('partitions' , Array (
110
+ ('partition' , Int32 ),
111
+ ('error_code' , Int16 ),
112
+ ('highwater_offset' , Int64 ),
113
+ ('last_stable_offset' , Int64 ),
114
+ ('log_start_offset' , Int64 ),
115
+ ('aborted_transactions' , Array (
116
+ ('producer_id' , Int64 ),
117
+ ('first_offset' , Int64 ))),
118
+ ('message_set' , Bytes )))))
119
+ )
120
+
121
+
122
+ class FetchResponse_v8 (Response ):
123
+ API_KEY = 1
124
+ API_VERSION = 8
125
+ SCHEMA = FetchResponse_v7 .SCHEMA
126
+
127
+
128
+ class FetchResponse_v9 (Response ):
129
+ API_KEY = 1
130
+ API_VERSION = 9
131
+ SCHEMA = FetchResponse_v7 .SCHEMA
132
+
133
+
134
+ class FetchResponse_v10 (Response ):
135
+ API_KEY = 1
136
+ API_VERSION = 10
137
+ SCHEMA = FetchResponse_v7 .SCHEMA
138
+
139
+
140
+ class FetchResponse_v11 (Response ):
141
+ API_KEY = 1
142
+ API_VERSION = 11
143
+ SCHEMA = Schema (
144
+ ('throttle_time_ms' , Int32 ),
145
+ ('error_code' , Int16 ),
146
+ ('session_id' , Int32 ),
147
+ ('topics' , Array (
148
+ ('topics' , String ('utf-8' )),
149
+ ('partitions' , Array (
150
+ ('partition' , Int32 ),
151
+ ('error_code' , Int16 ),
152
+ ('highwater_offset' , Int64 ),
153
+ ('last_stable_offset' , Int64 ),
154
+ ('log_start_offset' , Int64 ),
155
+ ('aborted_transactions' , Array (
156
+ ('producer_id' , Int64 ),
157
+ ('first_offset' , Int64 ))),
158
+ ('preferred_read_replica' , Int32 ),
159
+ ('message_set' , Bytes )))))
160
+ )
161
+
162
+
97
163
class FetchRequest_v0 (Request ):
98
164
API_KEY = 1
99
165
API_VERSION = 0
@@ -196,13 +262,125 @@ class FetchRequest_v6(Request):
196
262
SCHEMA = FetchRequest_v5 .SCHEMA
197
263
198
264
265
+ class FetchRequest_v7 (Request ):
266
+ """
267
+ Add incremental fetch requests
268
+ """
269
+ API_KEY = 1
270
+ API_VERSION = 7
271
+ RESPONSE_TYPE = FetchResponse_v7
272
+ SCHEMA = Schema (
273
+ ('replica_id' , Int32 ),
274
+ ('max_wait_time' , Int32 ),
275
+ ('min_bytes' , Int32 ),
276
+ ('max_bytes' , Int32 ),
277
+ ('isolation_level' , Int8 ),
278
+ ('session_id' , Int32 ),
279
+ ('session_epoch' , Int32 ),
280
+ ('topics' , Array (
281
+ ('topic' , String ('utf-8' )),
282
+ ('partitions' , Array (
283
+ ('partition' , Int32 ),
284
+ ('fetch_offset' , Int64 ),
285
+ ('log_start_offset' , Int64 ),
286
+ ('max_bytes' , Int32 ))))),
287
+ ('forgotten_topics_data' , Array (
288
+ ('topic' , String ),
289
+ ('partitions' , Array (Int32 ))
290
+ )),
291
+ )
292
+
293
+
294
+ class FetchRequest_v8 (Request ):
295
+ """
296
+ bump used to indicate that on quota violation brokers send out responses before throttling.
297
+ """
298
+ API_KEY = 1
299
+ API_VERSION = 8
300
+ RESPONSE_TYPE = FetchResponse_v8
301
+ SCHEMA = FetchRequest_v7 .SCHEMA
302
+
303
+
304
+ class FetchRequest_v9 (Request ):
305
+ """
306
+ adds the current leader epoch (see KIP-320)
307
+ """
308
+ API_KEY = 1
309
+ API_VERSION = 9
310
+ RESPONSE_TYPE = FetchResponse_v9
311
+ SCHEMA = Schema (
312
+ ('replica_id' , Int32 ),
313
+ ('max_wait_time' , Int32 ),
314
+ ('min_bytes' , Int32 ),
315
+ ('max_bytes' , Int32 ),
316
+ ('isolation_level' , Int8 ),
317
+ ('session_id' , Int32 ),
318
+ ('session_epoch' , Int32 ),
319
+ ('topics' , Array (
320
+ ('topic' , String ('utf-8' )),
321
+ ('partitions' , Array (
322
+ ('partition' , Int32 ),
323
+ ('current_leader_epoch' , Int32 ),
324
+ ('fetch_offset' , Int64 ),
325
+ ('log_start_offset' , Int64 ),
326
+ ('max_bytes' , Int32 ))))),
327
+ ('forgotten_topics_data' , Array (
328
+ ('topic' , String ),
329
+ ('partitions' , Array (Int32 )),
330
+ )),
331
+ )
332
+
333
+
334
+ class FetchRequest_v10 (Request ):
335
+ """
336
+ bumped up to indicate ZStandard capability. (see KIP-110)
337
+ """
338
+ API_KEY = 1
339
+ API_VERSION = 10
340
+ RESPONSE_TYPE = FetchResponse_v10
341
+ SCHEMA = FetchRequest_v9 .SCHEMA
342
+
343
+
344
+ class FetchRequest_v11 (Request ):
345
+ """
346
+ added rack ID to support read from followers (KIP-392)
347
+ """
348
+ API_KEY = 1
349
+ API_VERSION = 11
350
+ RESPONSE_TYPE = FetchResponse_v11
351
+ SCHEMA = Schema (
352
+ ('replica_id' , Int32 ),
353
+ ('max_wait_time' , Int32 ),
354
+ ('min_bytes' , Int32 ),
355
+ ('max_bytes' , Int32 ),
356
+ ('isolation_level' , Int8 ),
357
+ ('session_id' , Int32 ),
358
+ ('session_epoch' , Int32 ),
359
+ ('topics' , Array (
360
+ ('topic' , String ('utf-8' )),
361
+ ('partitions' , Array (
362
+ ('partition' , Int32 ),
363
+ ('current_leader_epoch' , Int32 ),
364
+ ('fetch_offset' , Int64 ),
365
+ ('log_start_offset' , Int64 ),
366
+ ('max_bytes' , Int32 ))))),
367
+ ('forgotten_topics_data' , Array (
368
+ ('topic' , String ),
369
+ ('partitions' , Array (Int32 ))
370
+ )),
371
+ ('rack_id' , String ('utf-8' )),
372
+ )
373
+
374
+
199
375
FetchRequest = [
200
376
FetchRequest_v0 , FetchRequest_v1 , FetchRequest_v2 ,
201
377
FetchRequest_v3 , FetchRequest_v4 , FetchRequest_v5 ,
202
- FetchRequest_v6
378
+ FetchRequest_v6 , FetchRequest_v7 , FetchRequest_v8 ,
379
+ FetchRequest_v9 , FetchRequest_v10 , FetchRequest_v11 ,
203
380
]
204
381
FetchResponse = [
205
382
FetchResponse_v0 , FetchResponse_v1 , FetchResponse_v2 ,
206
383
FetchResponse_v3 , FetchResponse_v4 , FetchResponse_v5 ,
207
- FetchResponse_v6
384
+ FetchResponse_v6 , FetchResponse_v7 , FetchResponse_v8 ,
385
+ FetchResponse_v9 , FetchResponse_v10 , FetchResponse_v11 ,
208
386
]
0 commit comments