Efrat19 commented on code in PR #332:
URL:
https://github.com/apache/flink-connector-kafka/pull/332#discussion_r4192126418
##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/sink/ExactlyOnceKafkaWriter.java:
##########
@@ -273,7 +273,8 @@ public void close() throws Exception {
this::abortCurrentProducer,
() -> closeAll(producerPool),
backchannel,
- super::close);
+ super::close,
+ adminClient);
Review Comment:
Null check?
Since lazily created
##########
flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/sink/ExactlyOnceKafkaWriterITCase.java:
##########
@@ -374,6 +378,40 @@ void testAbortOnClose() throws Exception {
}
}
+ /**
+ * Tests that POOLING releases its admin client and INCREMENTING closes
without creating one.
+ */
+ @ParameterizedTest
+ @EnumSource(TransactionNamingStrategy.class)
+ void testCloseReleasesAdminClient(TransactionNamingStrategy
namingStrategy) throws Exception {
+ final String clientId = "test-close-admin-client-" + UUID.randomUUID();
+ final List<Thread> adminThreads;
+ try (final KafkaWriter<Integer> writer =
+ createWriter(
+ builder ->
+
builder.setDeliveryGuarantee(DeliveryGuarantee.EXACTLY_ONCE)
+
.setTransactionNamingStrategy(namingStrategy)
+
.setProperty(ProducerConfig.CLIENT_ID_CONFIG, clientId),
+ createInitContext())) {
+ adminThreads =
Review Comment:
Nit: wdyt about making `ExactlyOnceKafkaWriter#getAdminClient` visible for
testing and check it instead of collecting threads?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]