Skip to content

Commit b4b8751

Browse files
petrosaggjkosh44
authored andcommitted
Merge pull request #24973 from petrosagg/sink-progress-record-retry
storage/sinks: handle QueueFull error when sending progress records
1 parent 108c8a2 commit b4b8751

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/storage/src/sink/kafka.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,20 @@ impl TransactionalProducer {
374374
let record = BaseRecord::to(&self.progress_topic)
375375
.payload(&payload)
376376
.key(&self.progress_key);
377-
self.producer.send(record).map_err(|(e, _)| e)?;
377+
match self.producer.send(record) {
378+
Ok(()) => {}
379+
Err((err, record)) => match err.rdkafka_error_code() {
380+
Some(RDKafkaErrorCode::QueueFull) => {
381+
// If the internal rdkafka queue is full we have no other option than to flush
382+
// TODO(petrosagg): remove this logic once we fix the issue that cannot be
383+
// named
384+
let timeout = self.transaction_timeout;
385+
self.spawn_blocking(move |p| p.flush(timeout)).await?;
386+
self.producer.send(record).map_err(|(err, _)| err)?;
387+
}
388+
_ => return Err(err.into()),
389+
},
390+
}
378391

379392
let timeout = self.socket_timeout;
380393
match self

0 commit comments

Comments
 (0)