Github user tzulitai commented on a diff in the pull request:
https://github.com/apache/flink/pull/6021#discussion_r189164871
--- Diff:
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/FlinkKinesisProducer.java
---
@@ -326,6 +342,24 @@ private void checkAndPropagateAsyncError() throws
Exception {
}
}
+ /**
+ * If the internal queue of the {@link KinesisProducer} gets too long,
+ * flush some of the records until we are below the limit again.
+ * We don't want to flush _all_ records at this point since that would
+ * break record aggregation.
+ */
+ private void checkQueueLimit() {
+ while (producer.getOutstandingRecordsCount() >= queueLimit) {
+ producer.flush();
--- End diff --
Do we have to do a flush here? Shouldn't the KPL child process process the
user records in the background without an explicit flush call?
If so, perhaps a more graceful solution here is to wait on a local object,
and notify it to wake up in the asynchronous producer write call backs. After
being notified, we check the `getOutstandingRecordsCount` agains the
queueLimit, and either wait more or escape the loop.
What do you think?
---