[ 
https://issues.apache.org/jira/browse/KAFKA-20837?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chia-Ping Tsai resolved KAFKA-20837.
------------------------------------
    Resolution: Fixed

> Fix slow MirrorConnectorsIntegrationBaseTest#produceMessages
> ------------------------------------------------------------
>
>                 Key: KAFKA-20837
>                 URL: https://issues.apache.org/jira/browse/KAFKA-20837
>             Project: Kafka
>          Issue Type: Test
>            Reporter: Chia-Ping Tsai
>            Assignee: Ming-Yen Chung
>            Priority: Major
>             Fix For: 4.5.0
>
>
> Many mirror tests need to produce a bunch of records, but the helper method 
> blocks until each record is completed. That is freaking slow for all tests...
> We can refactor this while keeping the original timeout behaviour.
> {code:java}
>     protected void produceMessages(Producer<byte[], byte[]> producer, 
> List<ProducerRecord<byte[], byte[]>> records) {
>         Timer timer = Time.SYSTEM.timer(RECORD_PRODUCE_DURATION_MS);
>         try {
>             var futures = records.stream().map(producer::send).toList();
>             for (var f : futures) {
>                 f.get(timer.remainingMs(), TimeUnit.MILLISECONDS);
>                 timer.update();
>             }
>         } catch (ExecutionException | InterruptedException | TimeoutException 
> e) {
>             throw new RuntimeException(e);
>         }
>     }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to