Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-24713]AppMatser of spark streaming kafka OOM if there are hund… #21690

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ private[spark] class DirectKafkaInputDStream[K, V](
* which would throw off consumer position. Fix position if this happens.
*/
private def paranoidPoll(c: Consumer[K, V]): Unit = {
// don't actually want to consume any messages, so pause all partitions
c.pause(c.assignment())
val msgs = c.poll(0)
if (!msgs.isEmpty) {
// position should be minimum offset per topicpartition
Expand Down Expand Up @@ -204,8 +206,6 @@ private[spark] class DirectKafkaInputDStream[K, V](
// position for new partitions determined by auto.offset.reset if no commit
currentOffsets = currentOffsets ++ newPartitions.map(tp => tp -> c.position(tp)).toMap

// don't want to consume messages, so pause
c.pause(newPartitions.asJava)
// find latest available offsets
c.seekToEnd(currentOffsets.keySet.asJava)
parts.map(tp => tp -> c.position(tp)).toMap
Expand Down Expand Up @@ -262,9 +262,6 @@ private[spark] class DirectKafkaInputDStream[K, V](
tp -> c.position(tp)
}.toMap
}

// don't actually want to consume any messages, so pause all partitions
c.pause(currentOffsets.keySet.asJava)
}

override def stop(): Unit = this.synchronized {
Expand Down