mdev
mdev

Reputation: 1416

Producer lost some message on kafka restart

Kafka Client : 0.11.0.0-cp1 Kafka Broker :

On Kafka broker rolling restart, our application lost some messages while sending to broker. I believe with rolling restart there should not be any loss of message. These are the producer (Using Producer with asynchronous send() and not using callback/future etc) settings we are using :


val acksConfig: String = "all",
val retriesConfig: Int = Int.MAX_VALUE,
val retriesBackOffConfig: Int = 1000,
val batchSize: Int = 32768,
val lingerTime: Int = 1,
val maxBlockTime: Int = Int.MAX_VALUE,
val requestTimeOut: Int = 420000,
val bufferMemory: Int = 33_554_432,
val compressionType: String = "gzip",
val keySerializer: Class<StringSerializer> = StringSerializer::class.java,
val valueSerializer: Class<ByteArraySerializer> = ByteArraySerializer::class.java

I am seeing these exceptions in the logs

2019-03-19 17:30:59,224 [org.apache.kafka.clients.producer.internals.Sender] [kafka-producer-network-thread | producer-1] (Sender.java:511) WARN  org.apache.kafka.clients.producer.internals.Sender  - Got error produce response with correlation id 1105790 on topic-partition catapult_on_entitlement_updates_prod-67, retrying (2147483643 attempts left). Error: NOT_LEADER_FOR_PARTITION

But log says retry attempt left, i am curious why didnt it retry then? Let me know if anyone has any idea?

Upvotes: 0

Views: 892

Answers (1)

Vassilis
Vassilis

Reputation: 1054

Two things to note:

  1. What is the replication factor of the topic you are producing and what is the required number of min.insync.replicas?
  2. What do you mean by "producer lost some messages". The producer if it cannot successfully produce to #min.insync.replicas brokers it will throw an exception and fail (for synchronous production). It is up to the producer/ client to retry in case of failure (synchronous or asynchronous production).

Upvotes: 1

Related Questions