vanzin commented on a change in pull request #26470: [SPARK-27042][SS] 
Invalidate cached Kafka producer in case of task retry
URL: https://github.com/apache/spark/pull/26470#discussion_r346542556
 
 

 ##########
 File path: 
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/CachedKafkaProducer.scala
 ##########
 @@ -93,6 +93,10 @@ private[kafka010] object CachedKafkaProducer extends 
Logging {
         .setAuthenticationConfigIfNeeded()
         .build()
     val key = toCacheKey(updatedKafkaParams)
+    if (TaskContext.get != null && TaskContext.get.attemptNumber >= 1) {
 
 Review comment:
   >  2 jobs must write the same TopicPartition at the same time
   
   Why at the same time? All you need to hit my case is two tasks on the first 
job using different producers, and can't that happen e.g. if you have executors 
with more than one core?
   
   It seems like Spark would eventually self-heal at the cost of some failed 
tasks, but can't we do better? As Jungtaek said we already have to return the 
producer to the pool. It's just a matter of, instead of returning it, 
invalidating it if an error is detected.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to