File tree Expand file tree Collapse file tree
src/main/scala/org/apache/spark/sql/kinesis Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,7 +165,18 @@ private[kinesis] class KinesisSourceRDD(
165165 }
166166
167167 def canFetchMoreRecords (currentTimestamp : Long ): Boolean = {
168- currentTimestamp - startTimestamp < maxFetchTimeInMs
168+ val iteratorType : String = sourcePartition.shardInfo.iteratorType
169+ if (lastReadSequenceNumber.isEmpty && ! (iteratorType == " AT_TIMESTAMP" )) {
170+ // We are not using timestamp as offset. So we have to make sure that
171+ // a) we reach the tip of the stream if we have not able to
172+ // b) we read at-least one records
173+ // so that we are never stuck in the loop where we have data near the tip of the stream
174+ // but we are not spending enough time to read it
175+ true
176+ } else {
177+ // honour the maxFetchTime provided in the options.
178+ currentTimestamp - startTimestamp < maxFetchTimeInMs
179+ }
169180 }
170181
171182 def addDelayInFetchingRecords (currentTimestamp : Long ): Unit = {
You can’t perform that action at this time.
0 commit comments