@@ -182,7 +182,7 @@ def add_topic(self, topic):
182
182
def _failed_produce (self , batches , node_id , error ):
183
183
log .error ("Error sending produce request to node %d: %s" , node_id , error ) # trace
184
184
for batch in batches :
185
- self ._complete_batch (batch , error , - 1 , None )
185
+ self ._complete_batch (batch , error , - 1 )
186
186
187
187
def _handle_produce_response (self , node_id , send_time , batches , response ):
188
188
"""Handle a produce response."""
@@ -194,7 +194,6 @@ def _handle_produce_response(self, node_id, send_time, batches, response):
194
194
195
195
for topic , partitions in response .topics :
196
196
for partition_info in partitions :
197
- global_error = None
198
197
log_start_offset = None
199
198
if response .API_VERSION < 2 :
200
199
partition , error_code , offset = partition_info
@@ -204,28 +203,27 @@ def _handle_produce_response(self, node_id, send_time, batches, response):
204
203
elif 5 <= response .API_VERSION <= 7 :
205
204
partition , error_code , offset , ts , log_start_offset = partition_info
206
205
else :
207
- # the ignored parameter is record_error of type list[(batch_index: int, error_message: str)]
208
- partition , error_code , offset , ts , log_start_offset , _ , global_error = partition_info
206
+ # Currently unused / TODO: KIP-467
207
+ partition , error_code , offset , ts , log_start_offset , _record_errors , _global_error = partition_info
209
208
tp = TopicPartition (topic , partition )
210
209
error = Errors .for_code (error_code )
211
210
batch = batches_by_partition [tp ]
212
- self ._complete_batch (batch , error , offset , ts , log_start_offset , global_error )
211
+ self ._complete_batch (batch , error , offset , timestamp_ms = ts , log_start_offset = log_start_offset )
213
212
214
213
else :
215
214
# this is the acks = 0 case, just complete all requests
216
215
for batch in batches :
217
- self ._complete_batch (batch , None , - 1 , None )
216
+ self ._complete_batch (batch , None , - 1 )
218
217
219
- def _complete_batch (self , batch , error , base_offset , timestamp_ms = None , log_start_offset = None , global_error = None ):
218
+ def _complete_batch (self , batch , error , base_offset , timestamp_ms = None , log_start_offset = None ):
220
219
"""Complete or retry the given batch of records.
221
220
222
221
Arguments:
223
222
batch (RecordBatch): The record batch
224
223
error (Exception): The error (or None if none)
225
224
base_offset (int): The base offset assigned to the records if successful
226
225
timestamp_ms (int, optional): The timestamp returned by the broker for this batch
227
- log_start_offset (int): The start offset of the log at the time this produce response was created
228
- global_error (str): The summarising error message
226
+ log_start_offset (int, optional): The start offset of the log at the time this produce response was created
229
227
"""
230
228
# Standardize no-error to None
231
229
if error is Errors .NoError :
@@ -237,15 +235,15 @@ def _complete_batch(self, batch, error, base_offset, timestamp_ms=None, log_star
237
235
" retrying (%d attempts left). Error: %s" ,
238
236
batch .topic_partition ,
239
237
self .config ['retries' ] - batch .attempts - 1 ,
240
- global_error or error )
238
+ error )
241
239
self ._accumulator .reenqueue (batch )
242
240
self ._sensors .record_retries (batch .topic_partition .topic , batch .record_count )
243
241
else :
244
242
if error is Errors .TopicAuthorizationFailedError :
245
243
error = error (batch .topic_partition .topic )
246
244
247
245
# tell the user the result of their request
248
- batch .done (base_offset , timestamp_ms , error , log_start_offset , global_error )
246
+ batch .done (base_offset , timestamp_ms , error , log_start_offset )
249
247
self ._accumulator .deallocate (batch )
250
248
if error is not None :
251
249
self ._sensors .record_errors (batch .topic_partition .topic , batch .record_count )
0 commit comments