You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/03/26 08:52:24 UTC

[GitHub] [spark] vkrot opened a new pull request #24218: [SPARK-27281][DStreams] Change the way latest kafka offsets are retrieved to consumer#endOffsets

vkrot opened a new pull request #24218: [SPARK-27281][DStreams] Change the way latest kafka offsets are retrieved to consumer#endOffsets
URL: https://github.com/apache/spark/pull/24218
 
 
   ## What changes were proposed in this pull request?
   Change the way latest kafka offsets are retrieved in `latestOffsets` methods from
   ```
   consumer#seekToEnd(tp)
   consumer#position(tp)
   ```
   to
   ```
   consumer#endOffsets(partitions)
   ```
   
   This fixed the issue from corresponding jira issue.
   
   With existing code from time to time I get an error
   ```
   java.lang.IllegalArgumentException: requirement failed: numRecords must not be negative
   at scala.Predef$.require(Predef.scala:224)
   at org.apache.spark.streaming.scheduler.StreamInputInfo.<init>(InputInfoTracker.scala:38)
   at org.apache.spark.streaming.kafka010.DirectKafkaInputDStream.compute(DirectKafkaInputDStream.scala:250)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1$$anonfun$apply$7.apply(DStream.scala:342)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1$$anonfun$apply$7.apply(DStream.scala:342)
   at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1.apply(DStream.scala:341)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1.apply(DStream.scala:341)
   at org.apache.spark.streaming.dstream.DStream.createRDDWithLocalProperties(DStream.scala:416)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1.apply(DStream.scala:336)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1.apply(DStream.scala:334)
   at scala.Option.orElse(Option.scala:289)
   at org.apache.spark.streaming.dstream.DStream.getOrCompute(DStream.scala:331)
   at org.apache.spark.streaming.dstream.ForEachDStream.generateJob(ForEachDStream.scala:48)
   at org.apache.spark.streaming.DStreamGraph$$anonfun$1.apply(DStreamGraph.scala:122)
   at org.apache.spark.streaming.DStreamGraph$$anonfun$1.apply(DStreamGraph.scala:121)
   at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
   at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
   at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
   at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
   at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
   at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
   at org.apache.spark.streaming.DStreamGraph.generateJobs(DStreamGraph.scala:121)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anonfun$3.apply(JobGenerator.scala:249)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anonfun$3.apply(JobGenerator.scala:247)
   at scala.util.Try$.apply(Try.scala:192)
   at org.apache.spark.streaming.scheduler.JobGenerator.generateJobs(JobGenerator.scala:247)
   at org.apache.spark.streaming.scheduler.JobGenerator.org$apache$spark$streaming$scheduler$JobGenerator$$processEvent(JobGenerator.scala:183)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anon$1.onReceive(JobGenerator.scala:89)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anon$1.onReceive(JobGenerator.scala:88)
   at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:49)
   19/01/29 13:10:00 ERROR apps.BusinessRuleEngine: Job failed. Stopping JVM
   java.lang.IllegalArgumentException: requirement failed: numRecords must not be negative
   at scala.Predef$.require(Predef.scala:224)
   at org.apache.spark.streaming.scheduler.StreamInputInfo.<init>(InputInfoTracker.scala:38)
   at org.apache.spark.streaming.kafka010.DirectKafkaInputDStream.compute(DirectKafkaInputDStream.scala:250)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1$$anonfun$apply$7.apply(DStream.scala:342)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1$$anonfun$apply$7.apply(DStream.scala:342)
   at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1.apply(DStream.scala:341)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1.apply(DStream.scala:341)
   at org.apache.spark.streaming.dstream.DStream.createRDDWithLocalProperties(DStream.scala:416)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1.apply(DStream.scala:336)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1.apply(DStream.scala:334)
   at scala.Option.orElse(Option.scala:289)
   at org.apache.spark.streaming.dstream.DStream.getOrCompute(DStream.scala:331)
   at org.apache.spark.streaming.dstream.ForEachDStream.generateJob(ForEachDStream.scala:48)
   at org.apache.spark.streaming.DStreamGraph$$anonfun$1.apply(DStreamGraph.scala:122)
   at org.apache.spark.streaming.DStreamGraph$$anonfun$1.apply(DStreamGraph.scala:121)
   at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
   at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
   at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
   at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
   at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
   at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
   at org.apache.spark.streaming.DStreamGraph.generateJobs(DStreamGraph.scala:121)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anonfun$3.apply(JobGenerator.scala:249)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anonfun$3.apply(JobGenerator.scala:247)
   at scala.util.Try$.apply(Try.scala:192)
   at org.apache.spark.streaming.scheduler.JobGenerator.generateJobs(JobGenerator.scala:247)
   at org.apache.spark.streaming.scheduler.JobGenerator.org$apache$spark$streaming$scheduler$JobGenerator$$processEvent(JobGenerator.scala:183)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anon$1.onReceive(JobGenerator.scala:89)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anon$1.onReceive(JobGenerator.scala:88)
   at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:49)
   java.lang.IllegalArgumentException: requirement failed: numRecords must not be negative
   at scala.Predef$.require(Predef.scala:224)
   at org.apache.spark.streaming.scheduler.StreamInputInfo.<init>(InputInfoTracker.scala:38)
   at org.apache.spark.streaming.kafka010.DirectKafkaInputDStream.compute(DirectKafkaInputDStream.scala:250)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1$$anonfun$apply$7.apply(DStream.scala:342)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1$$anonfun$apply$7.apply(DStream.scala:342)
   at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1.apply(DStream.scala:341)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1$$anonfun$1.apply(DStream.scala:341)
   at org.apache.spark.streaming.dstream.DStream.createRDDWithLocalProperties(DStream.scala:416)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1.apply(DStream.scala:336)
   at org.apache.spark.streaming.dstream.DStream$$anonfun$getOrCompute$1.apply(DStream.scala:334)
   at scala.Option.orElse(Option.scala:289)
   at org.apache.spark.streaming.dstream.DStream.getOrCompute(DStream.scala:331)
   at org.apache.spark.streaming.dstream.ForEachDStream.generateJob(ForEachDStream.scala:48)
   at org.apache.spark.streaming.DStreamGraph$$anonfun$1.apply(DStreamGraph.scala:122)
   at org.apache.spark.streaming.DStreamGraph$$anonfun$1.apply(DStreamGraph.scala:121)
   at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
   at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
   at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
   at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
   at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
   at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
   at org.apache.spark.streaming.DStreamGraph.generateJobs(DStreamGraph.scala:121)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anonfun$3.apply(JobGenerator.scala:249)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anonfun$3.apply(JobGenerator.scala:247)
   at scala.util.Try$.apply(Try.scala:192)
   at org.apache.spark.streaming.scheduler.JobGenerator.generateJobs(JobGenerator.scala:247)
   at org.apache.spark.streaming.scheduler.JobGenerator.org$apache$spark$streaming$scheduler$JobGenerator$$processEvent(JobGenerator.scala:183)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anon$1.onReceive(JobGenerator.scala:89)
   at org.apache.spark.streaming.scheduler.JobGenerator$$anon$1.onReceive(JobGenerator.scala:88)
   at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:49)
   ```
   With 10+ jobs consuming 100+ partitions this happens only once a day - once a week. The code seekToEnd returns offsets that are lower that `currentOffsets`, while `consumer#endOffsets` returns correct end offsets
   
   
   ## How was this patch tested?
   
   Existing tests
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org