Skip to content

Commit

Permalink
[FLINK-10154][connectors] Make sure we always read at least one recor…
Browse files Browse the repository at this point in the history
…d in KinesisConnector.

This closes #6564.
  • Loading branch information
Jamie Grier authored and StefanRRichter committed Aug 16, 2018
1 parent 92815e7 commit 02152e7
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -278,8 +278,8 @@ private int adaptRecordsToRead(long runLoopTimeNanos, int numRecords, long recor
double loopFrequencyHz = 1000000000.0d / runLoopTimeNanos;
double bytesPerRead = KINESIS_SHARD_BYTES_PER_SECOND_LIMIT / loopFrequencyHz;
maxNumberOfRecordsPerFetch = (int) (bytesPerRead / averageRecordSizeBytes);
// Ensure the value is not more than 10000L
maxNumberOfRecordsPerFetch = Math.min(maxNumberOfRecordsPerFetch, ConsumerConfigConstants.DEFAULT_SHARD_GETRECORDS_MAX);
// Ensure the value is greater than 0 and not more than 10000L
maxNumberOfRecordsPerFetch = Math.max(1, Math.min(maxNumberOfRecordsPerFetch, ConsumerConfigConstants.DEFAULT_SHARD_GETRECORDS_MAX));
}
return maxNumberOfRecordsPerFetch;
}
Expand Down

0 comments on commit 02152e7

Please sign in to comment.