Github user GJL commented on a diff in the pull request:
https://github.com/apache/flink/pull/4910#discussion_r147678943
--- Diff:
flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer011.java
---
@@ -442,13 +445,31 @@ public FlinkKafkaProducer011(
throw new
IllegalArgumentException(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG + " must be
supplied in the producer config properties.");
}
- if
(!producerConfig.contains(ProducerConfig.TRANSACTION_TIMEOUT_CONFIG)) {
+ if
(!producerConfig.containsKey(ProducerConfig.TRANSACTION_TIMEOUT_CONFIG)) {
long timeout =
DEFAULT_KAFKA_TRANSACTION_TIMEOUT.toMilliseconds();
checkState(timeout < Integer.MAX_VALUE && timeout > 0,
"timeout does not fit into 32 bit integer");
this.producerConfig.put(ProducerConfig.TRANSACTION_TIMEOUT_CONFIG, (int)
timeout);
LOG.warn("Property [%s] not specified. Setting it to
%s", ProducerConfig.TRANSACTION_TIMEOUT_CONFIG,
DEFAULT_KAFKA_TRANSACTION_TIMEOUT);
}
+ // Enable transactionTimeoutWarnings to avoid silent data loss
+ // See KAFKA-6119 (affects versions 0.11.0.0 and 0.11.0.1):
+ // The KafkaProducer may not throw an exception if the
transaction failed to commit
+ if (semantic == Semantic.EXACTLY_ONCE) {
+ final Object object =
this.producerConfig.get(ProducerConfig.TRANSACTION_TIMEOUT_CONFIG);
--- End diff --
Couldn't find any.
---