Skip to content

build(deps): Kafka client 4.2.0 upgrade#19441

Merged
FrankChen021 merged 8 commits into
apache:masterfrom
Shekharrajak:feature/kafka-client-4.2.0-upgrade
May 13, 2026
Merged

build(deps): Kafka client 4.2.0 upgrade#19441
FrankChen021 merged 8 commits into
apache:masterfrom
Shekharrajak:feature/kafka-client-4.2.0-upgrade

Conversation

@Shekharrajak
Copy link
Copy Markdown
Contributor

@Shekharrajak Shekharrajak commented May 9, 2026

Ref #19322

Description

  • Kafka client to 4.2.0
  • Docker image: apache/kafka:4.2.0
  • KafkaContainer using testcontainers-kafka jar
  • EmbeddedKafkaBroker test helper using Testcontainers
  • kafka-indexing-service tests to EmbeddedKafkaBroker; drop TestBroker

Release note

Upgraded the bundled Apache Kafka client and broker dependencies from 3.9.2 to 4.2.0; embedded test brokers now run on Testcontainers (apache/kafka:4.2.0) instead of the removed Scala/ZooKeeper-mode broker.


Key changed/added classes in this PR
  • pom.xml: apache.kafka.version4.2.0.

  • New EmbeddedKafkaBroker test helper backed by Testcontainers.

  • Migrated KafkaIndexTaskTest, KafkaRecordSupplierTest, KafkaSamplerSpecTest, KafkaSupervisorTest, KafkaStringHeaderFormatTest, and TestKafkaExtractionCluster off the legacy TestBroker / embedded ZooKeeper.

  • Deleted TestBroker; removed kafka_2.13, curator-test, and scala-library test dependencies.

  • KafkaResource Docker image bumped to apache/kafka:4.2.0.

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@Shekharrajak Shekharrajak changed the title Feature/kafka client 4.2.0 upgrade build(dep) Kafka client 4.2.0 upgrade May 9, 2026
@Shekharrajak Shekharrajak changed the title build(dep) Kafka client 4.2.0 upgrade build(deps): Kafka client 4.2.0 upgrade May 9, 2026
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Druid only ever depended on it from test scope, and only because TestBroker needed kafka.server.KafkaServer. Once TestBroker is gone, nothing imports anything from kafka.* (Scala namespace)

import org.apache.druid.indexing.kafka.KafkaIndexTaskTuningConfig;
import org.apache.druid.indexing.kafka.KafkaRecordSupplier;
import org.apache.druid.indexing.kafka.test.TestBroker;
import org.apache.druid.indexing.kafka.test.EmbeddedKafkaBroker;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestBroker no longer compiles (Scala kafka.server.KafkaServer removed in Kafka 4.0); embedded ZooKeeper mode no longer supported by Kafka 4.x brokers.

<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was only used to embed ZooKeeper for TestBroker/TestKafkaExtractionCluster; KRaft mode means no ZooKeeper.

</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-kafka</artifactId>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kafka container specific - that will help in integration testing and running containers

@BeforeClass
public static void setupClass() throws Exception
{
zkServer = new TestingCluster(1);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KRaft mode - hence no zk

@Shekharrajak
Copy link
Copy Markdown
Contributor Author

This will be the first step to improve & simplify the kafka integration testing , version upgrade to open the path for Queue Semantics Kafka Ingestion #19311

cc @gianm @a2l007 @clintropolis @FrankChen021

{
final String url = getBootstrapServerUrl();
final int colon = url.lastIndexOf(':');
return Integer.parseInt(url.substring(colon + 1));
@Shekharrajak
Copy link
Copy Markdown
Contributor Author

Shekharrajak commented May 9, 2026

@Shekharrajak
Copy link
Copy Markdown
Contributor Author

Please help in triggering the failing CI checks again.

Copy link
Copy Markdown
Member

@FrankChen021 FrankChen021 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.

Reviewed 14 of 14 changed files.


This is an automated review by Codex GPT-5.5

@FrankChen021
Copy link
Copy Markdown
Member

please check the error of this check: Static Checks CI / strict-compilation / strict-compilation (pull_request)Failing after 39m

@Shekharrajak
Copy link
Copy Markdown
Contributor Author

@FrankChen021 thanks for checking, CI checks are looking good now.

Once we have these changes ready the Queue implementation of phase 1 will be easier to review.

@Shekharrajak Shekharrajak force-pushed the feature/kafka-client-4.2.0-upgrade branch 2 times, most recently from 53afc19 to 0f669b7 Compare May 12, 2026 05:47
@Shekharrajak
Copy link
Copy Markdown
Contributor Author

Please re-run the CI check https://github.com/apache/druid/actions/runs/25716029780/job/75506218870?pr=19441 - it is not looking related to our changes.

Copy link
Copy Markdown
Member

@FrankChen021 FrankChen021 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.

Reviewed 14 of 14 changed files.


This is an automated review by Codex GPT-5.5

@FrankChen021 FrankChen021 merged commit eb34e2a into apache:master May 13, 2026
100 of 101 checks passed
@github-actions github-actions Bot added this to the 38.0.0 milestone May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants