Skip to content

Commit c1bd6d9

Browse files
committed
[SPARK-4964] use newly available attemptNumber for correct retry behavior
1 parent 548d529 commit c1bd6d9

File tree

1 file changed

+1
-2
lines changed
  • external/kafka/src/main/scala/org/apache/spark/rdd/kafka

1 file changed

+1
-2
lines changed

external/kafka/src/main/scala/org/apache/spark/rdd/kafka/KafkaRDD.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,10 @@ class KafkaRDD[
8888
var requestOffset = part.fromOffset
8989
var iter: Iterator[MessageAndOffset] = null
9090

91-
// TODO broken until SPARK-4014 is resolved and attemptId / attemptNumber is meaningful.
9291
// The idea is to use the provided preferred host, except on task retry atttempts,
9392
// to minimize number of kafka metadata requests
9493
private def connectLeader: SimpleConsumer = {
95-
if (context.attemptId > 0) {
94+
if (context.attemptNumber > 0) {
9695
kc.connectLeader(part.topic, part.partition).fold(
9796
errs => throw new Exception(
9897
s"Couldn't connect to leader for topic ${part.topic} ${part.partition}: " +

0 commit comments

Comments
 (0)