100 Commits
Author SHA1 Message Date
Ken Huang 7596c4bc4b KAFKA-19042 Rewrite TransactionsBounceTest from Scala to Java (#23879)
Rewrite TransactionsBounceTest from Scala to Java and move it to
clients-integration-tests. The transaction status header helpers are
moved to ClientsTestUtils and shared with ProducerIdExpirationTest, and
the Scala helpers in TestUtils that were only used by this test are
removed.

Reviewers: Murali Basani <muralidhar.basani@aiven.io>, Chia-Ping Tsai
<chia7712@gmail.com>
2026-10-28 05:05:05 +08:00
Ken Huang cf93eefad7 KAFKA-21293 SubscriptionState#unsubscribe should not reset the rebalance listener (#23852)
`SubscriptionState#unsubscribe()` resets the listener context to
`NULL_LISTENER`, so calling `unsubscribe()` silently drops the user's
rebalance listener.

KIP-1306 only states that passing null removes the current listener. The
previous implementation also did not reset the listener on
unsubscribe().

Reviewers: ChickenchickenLove <ojt90902@naver.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
2026-10-19 23:39:43 +08:00
Ken Huang b234a3a667 KAFKA-18477 Remove usage of OffsetForLeaderEpochRequest in AbstractFetcherThread (#23318)
Since the 4.0 baseline `MetadataVersion` is 3.0, all brokers support
truncation on fetch (`Fetch` v12+ with `LastFetchedEpoch` and
`DivergingEpoch`). Fetcher threads can therefore skip the separate
`OffsetsForLeaderEpochRequest` and detect divergence directly from fetch
responses.

Reviewers: Jun Rao <junrao@gmail.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
2026-10-08 02:35:36 +08:00
Ken Huang 38d8adec14 MINOR: Add 4.3.2 to upgrade.md (#23479)
Add 4.3.2 notable changes.

Reviewers: PoAn Yang <payang@apache.org>, Chia-Ping Tsai
<chia7712@gmail.com>
2026-09-28 21:01:00 +08:00
Ken Huang 91970ff8c3 KAFKA-20898 PushTelemetry sets terminating flag on validation failure, permanently locking out client instance (#23094)
Fix a bug in `ClientMetricsManager.processPushTelemetryRequest()` where
the `terminating` flag is unconditionally set in the `finally` block,
even when request validation fails.

  When a client sends a `PushTelemetry` request with `terminating=true`
but the request fails validation (e.g., stale `subscriptionId` →
`UNKNOWN_SUBSCRIPTION_ID`), the client instance is    permanently marked
as terminating. All subsequent requests from that client are rejected
with `INVALID_REQUEST`, making recovery impossible without creating a
new client instance.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Apoorv Mittal <apoorvmittal10@gmail.com>
2026-09-24 12:06:04 +01:00
Ken Huang 53abf0e80d KAFKA-21059 Consolidate maximumTimeToWait tests for Share and Consumer (#23455)
Move duplicate tests from `ShareHeartbeatRequestManagerTest` and
`ConsumerHeartbeatRequestManagerTest` to
`AbstractHeartbeatRequestManagerTest`.

Reviewers: Lianet Magrans <lmagrans@confluent.io>
2026-09-17 15:47:06 -04:00
Ken Huang db6f147797 KAFKA-21010 Another busy loop happens if the member is in JOINING state and bootstrap DNS resolution is not finished (#23348)
Follow-up to (#23227).

Before bootstrap DNS resolution completes,
`coordinatorRequestManager.coordinator()` is empty, causing the
coordinator-unknown path in `maximumTimeToWait()` to return
`heartbeatRequestState.heartbeatIntervalMs()`. However, the heartbeat
interval is initialized to 0 and is not updated until the first
heartbeat response is received. As a result, a member in the JOINING
state reports `maximumTimeToWait() == 0`.

Since the application thread's poll timeout is bounded by this value,
both the application and network threads can busy-spin until the
coordinator is discovered.

Returning `retryBackoffMs` aligns with the behavior discussed in #23227.
Until the coordinator is discovered, no heartbeat can be sent, making
this equivalent to the "nothing to send right now, wait for a backoff"
case for which `FetchRequestManager#maximumTimeToWait()` already returns
the retry backoff. Coordinator discovery itself is also paced by the
coordinator manager's backoff.

Reviewers: Lianet Magrans <lmagrans@confluent.io>
2026-09-09 12:58:31 -04:00
Ken Huang aaabc5b7b7 MINOR: Followup Add KIP-1284 into streams upgrade document (#22563)
FYI: https://github.com/apache/kafka/pull/21579#issuecomment-4694521039
2026-09-04 15:27:38 +02:00
Ken Huang ec65e09a04 KAFKA-20970 Another busy loop happens if auto.commit.interval.ms is less than bootstrap.resolve.timeout.ms (#23227)
`CommitRequestManager#maximumTimeToWait()` returned the raw remaining
time of the  auto-commit timer, which becomes `0` once the interval
elapses. However, `poll()`  cannot actually send an auto-commit until
the coordinator is known; it returns  `EMPTY` while
`coordinatorRequestManager.coordinator()` is empty. When bootstrap  DNS
resolution is still in progress (`bootstrap.resolve.timeout.ms > 0`) and
`auto.commit.interval.ms` is shorter than the resolution window, the
auto-commit  timer can expire before the coordinator is discovered.
`remainingMs()` then  continues to return `0` indefinitely, since the
timer is not reset until the  application thread successfully sends an
auto-commit.

This `0` is propagated to
`ConsumerNetworkThread#cachedMaximumTimeToWait`, which  bounds the
`pollTimeout` in `AsyncKafkaConsumer#pollForFetches()` to `0`, causing
the application and network threads to busy-loop for as long as the
coordinator  remains unknown.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Andrew Schofield
 <aschofield@confluent.io>, TengYao Chi <frankvicky@apache.org>, Lianet
 Magrans <lmagrans@confluent.io>
2026-09-03 15:57:46 +01:00
Ken Huang a5b1952693 KAFKA-20939 Mark "bootstrap.resolve.timeout.ms" as an experimental feature (#23214)
1. Add an evolving tag to BootstrapResolutionException.
2. Add docs stating that setting a positive value for
bootstrap.resolve.timeout.ms is evolving.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, TengYao Chi
 <frankvicky@apache.org>, Andrew Schofield <aschofield@confluent.io>
2026-08-21 20:23:55 +08:00
Ken Huang 7ff5d7b71c KAFKA-20854 A more obvious busy loop due to KIP-909 (#23014)
`FetchRequestManager` currently wakes up the `FetchBuffer`
unconditionally  whenever `prepareFetchRequests()` returns no requests
to send. This behavior  was intended for one specific case: all
currently fetchable partitions already  have buffered data waiting to be
consumed. However, the wakeup also happens for  any other case that
produces an empty result, including states where no progress  can be
made until some external event occurs:

  - No partitions are fetchable at all (no assignment yet, invalid
positions,      paused, pending revocation/callback).    - The
partition's leader is unknown (`metadata.requestUpdate()` was just
triggered).    - The target node is in its reconnect backoff window.
- The target node already has an in-flight fetch request outstanding.
- The target node hosts other partitions that already have buffered
data.

Because this wakeup bypasses the caller's normal `retryBackoffMs` delay,
the  application thread and the background `ConsumerNetworkThread` can
enter a tight  loop: `poll()` issues a fetch-request event, the
background thread finds nothing  to send, wakes the buffer, `poll()`
returns immediately, and the cycle repeats  without any meaningful
delay.

This is a pre-existing issue introduced with the non-blocking
`AsyncPollEvent` redesign in KAFKA-18376. However, KIP-909's async
bootstrap DNS  resolution extends the "no node available" window from
effectively instantaneous  to up to `bootstrapResolveTimeoutMs`, making
the busy loop much more visible.

Reviewers: Andrew Schofield <aschofield@confluent.io>, Lianet Magrans
 <lmagrans@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
2026-08-19 17:03:04 +01:00
Ken Huang 1e0a3b5922 KAFKA-19042 Rewrite SaslPlaintextConsumerTest from Scala to Java (#22918)
Rewrite SaslPlaintextConsumerTest from Scala to Java

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-08-18 19:26:45 +08:00
Ken Huang 2283829d79 MINOR: Rewrite ReplicaFetchTest from scala to java (#23059)
Rewrite ReplicaFetchTest and move to server module

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-08-06 00:17:39 +08:00
Ken Huangand@Dpk376 11eabc05f6 KAFKA-13716 Add unit tests for DeleteRecordsCommand (#23018)
Adds unit tests for DeleteRecordsCommand.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>

Co-authored-by: @Dpk376
2026-08-02 02:48:38 +08:00
Ken Huang 6ce2682d7b KAFKA-20539 Prevent Hot Data Loss on Partition Expansion for Latest Policy (#22784)
Enhanced the auto.offset.reset documentation in ConsumerConfig.java to
clearly explain the message-loss risk when using latest after increasing
the partition count, and recommended by_duration:<duration> as a safer
alternative.

Updated `basic-kafka-operations.md` with a recommendation section and a
comparison table for suitable `<duration>` values under both the
consumer (KIP-848) and classic group protocols.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-07-28 22:25:23 +08:00
Ken Huang a3123b01ec KAFKA-967 Use key range in ProducerPerformance (#22326)
Currently, kafka-producer-perf-test.sh only produces records with null keys, which makes it impossible to benchmark real-world keyed workloads (e.g., compacted topics, semantic partitioning, and stream joins). This PR implements KIP-1299 to introduce key generation support for the producer performance tool.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-07-27 10:57:04 +08:00
Ken Huang 3ab2c3e620 KAFKA-20553 Use ClusterInstance for streams ResetIntegrationTest (#22871)
Followup from:
https://github.com/apache/kafka/pull/22521#discussion_r3491032876

Migrate the streams group command integration tests from
EmbeddedKafkaCluster to the ClusterInstance test framework:

- ResetIntegrationTest.java
- AbstractResetIntegrationTest.java
- ResetIntegrationWithSslTest.java

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-07-26 08:46:57 +08:00
Ken Huang be319eacb8 MINOR: Remove testImplementation storage:storage-api (#22924)
See the comment:
https://github.com/apache/kafka/pull/22903#issuecomment-5068682305

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-07-25 07:55:59 +08:00
Ken Huang 13f5dd3451 MINOR: Cleanup build.gradle unused dependency (#22903)
Cleanup unused dependencies in `build.gradle`

1. `libs.spotbugs`: he SpotBugs Gradle plugin performs static analysis
using its own bundled jar, it does not require this compile-time
dependency.
2. `libs.jacksonJDK8Datatypes`: Jackson 2.15+ baked Optional support
directly into jackson-databind core.
3. `libs.jmhCoreBenchmarks`: Benchmarks only use jmh-core (annotations,
Blackhole, Runner) and jmh-generator-annprocess. No source file imports
anything from the org.openjdk.jmh.samples or benchmarks package.
4. `libs.bndlib`: Safely removed as no modules currently depend on it.
5. `libs.jacksonDataformatYaml` & `libs.junitPlatformLanucher`: Removed
from individual submodules because they are already globally included in
the runtimeTestLibs array.
6. `libs.caffeine` & `libs.hdrHistogram`: group-coordinator does not use
them
7. `libs.jacksonDataformatCsv`, `libs.jacksonJakartarsJsonProvider`, and
`libs.junitPlatformSuiteEngine`: Removed from specific modules as they
are either no longer directly imported or handled implicitly

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-07-23 06:33:58 +08:00
Ken Huang cb69d5716e MINOR: Rewrite TransactionMetadataTest from Scala to Java (#22811)
Rewrite it, and move it to transaction coordinator module

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-07-21 02:20:44 +08:00
Ken Huang 1720948dd6 MINOR: Move RequestChannelTest to server module (#22764)
Move `RequestChannelTest.scala` (core) to `RequestTest.java` (server
module), rewriting it in Java as part of the ongoing Scala-to-Java test
migration.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-07-10 01:53:47 +08:00
Ken Huang a5137f7c38 KAFKA-20759 testUnsubscribeDoesNotCommitOffsetsEvenWithAutoCommitEnabled hangs in closing (#22733)
Since `testUnsubscribeDoesNotCommitOffsetsEvenWithAutoCommitEnabled`
enables    auto-commit, closing the consumer in the `@AfterEach`
teardown triggers    `autoCommitOnClose()`, which calls
`commitSyncAllConsumed()` and blocks waiting    on the resulting
`SyncCommitEvent` future:

  ```java
  private void autoCommitOnClose(final Timer timer) {
      if (groupMetadata.get().isEmpty() || applicationEventHandler ==
null)
          return;

      if (autoCommitEnabled)            commitSyncAllConsumed(timer); //
sends a blocking SyncCommitEvent

      applicationEventHandler.add(new CommitOnCloseEvent());
  }
```
  Because the test mocks applicationEventHandler and never completes
this event,
  close() blocks until the timeout.

  This patch completes the commit event during close by calling
completeCommitSyncApplicationEventSuccessfully() at the end of the test

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-07-04 06:49:52 +08:00
Ken Huang cac4d1f5c5 MINOR: Remove clients test-fixtures shadow JAR rewire hack (#22699)
See the discussion:
https://github.com/apache/kafka/pull/22201#discussion_r3491163510

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-07-03 02:57:05 +08:00
Ken Huang 45b580c8a2 MINOR: Move DelayedProduceTest to server module (#22638)
Rewite this test to Java, and move it to server module

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-06-25 03:10:26 +08:00
Ken Huang 9f19c795cf MINOR: Note that formatted storage directories are not forward-compatible (#22429)
Follow-up to #20707, which unified bootstrap metadata into the KRaft
zero checkpoint. As a side effect, a directory produced by a newer
`kafka-storage` tool can no longer be started by an older Kafka broker —
even if `--release-version` was set to an older version at format time.
The flag only chooses the initial feature levels; the on-disk checkpoint
layout itself is dictated by the tool's own code version.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-06-07 19:54:16 +08:00
Ken Huang d9c3b92588 KAFKA-20167 Introduce CloseOptions.DEFAULT for Kafka Streams (#21579)
This patch is addressed the

https://cwiki.apache.org/confluence/display/KAFKA/KIP-1284+Introduce+CloseOptions.DEFAULT+for+Kafka+Streams

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>
2026-05-27 18:49:16 +02:00
Ken Huang fa097fa593 KAFKA-20605 upgrade gradle action to enable the CI (#22362)
5.0.0 was removed by

https://github.com/apache/infrastructure-actions/commit/9ef334e76e7ff0298931d114ec2ac2517c77306c

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-05-24 23:00:48 +08:00
Ken Huang 8c079f405e KAFKA-17689 Migrate TieredStorageTestHarness to new test infra (AlterLogDirTest) (#22306)
Migrate `AlterLogDirTest` to the new test infrastructure

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, PoAn Yang
 <payang@apache.org>, TaiJuWu <tjwu1217@gmail.com>
2026-05-21 15:58:31 +08:00
Ken Huang 4ef1ff840f KAFKA-20553 Eliminate the dependencies on sourceSets.test.output for server and storage module (#22276)
Gradle test fixtures to the clients module and removes all dependencies
on sourceSets.test.output. We should revisit other usages in this JIRA.
This will simplify the dependency graph and unblock the upgrade to
Gradle 9.5+

This patch is working on `server` and `storage`

Reviewers: Murali Basani <muralidhar.basani@aiven.io>, Chia-Ping Tsai
 <chia7712@gmail.com>
2026-05-15 07:27:07 +08:00
Ken Huang 95c21871dd KAFKA-20553 Eliminate the dependencies on sourceSets.test.output for group-coordinator and share-coordinator (#22254)
Gradle test fixtures to the clients module and removes all dependencies
on sourceSets.test.output. We should revisit other usages in this JIRA.
This will simplify the dependency graph and unblock the upgrade to
Gradle 9.5+

This patch is working on `group-coordinator` and `share-coordinator`

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-05-12 11:32:26 +08:00
Ken Huang 4bb5d39c90 MINOR: Use testFixturesImplementation instead of testFixturesApi (#22243)
See https://github.com/apache/kafka/pull/22201/files#r3212511936

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Igor Soarez
 <i@soarez.me>
2026-05-11 00:57:33 +08:00
Ken Huang 5463b69d61 KAFKA-20553 Eliminate the dependencies on "sourceSets.test.output" (Server-common) (#22229)
Gradle test fixtures to the clients module and removes all dependencies
on sourceSets.test.output. We should revisit other usages in this JIRA.
This will simplify the dependency graph and unblock the upgrade to
Gradle 9.5+

This patch is working on server-common module

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-05-09 13:21:55 +08:00
Ken Huang 6a1c8b465b KAFKA-18447 Support SASL_SSL protocol with java.security.auth.login.config (#20376)
The new test framework does not yet support the SASL_SSL security
protocol; we should add support for it.

Reviewers: Igor Soarez <i@soarez.me>, Chia-Ping Tsai
 <chia7712@gmail.com>
2026-05-08 21:17:26 +01:00
Ken Huang 5e6150caf7 HOTFIX: Fix SharePartition build error (#22222)
This Patch lead build error: https://github.com/apache/kafka/pull/22080

Reviewers: PoAn Yang <payang@apache.org>, Apoorv Mittal
 <apoorvmittal10@gmail.com>, TengYao Chi <frankvicky@apache.org>,
 Chia-Ping Tsai <chia7712@gmail.com>
2026-05-06 16:05:42 +01:00
Ken Huang 230e2c2f68 KAFKA-19042 Rewrite TransactionsTest from Scala to Java (#22150)
Rewrite TransactionsTest from Scala to Java

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-05-05 10:57:19 +08:00
Ken Huang c72fcda85c MINOR: Cleanup TestUtils.scala (#22091)
Some methods are only used in a single class; they should be moved into
that class.  Java tests should not use TestUtils.scala

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-05-02 10:10:22 +08:00
Ken Huang d02723aab9 MINOR: Add shutdown broker and bootstrap controller for ConfigCommand (#22134)
FYI: https://github.com/apache/kafka/pull/22104#discussion_r3131634557

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-04-29 00:49:48 +08:00
Ken Huang c9468028bf KAFKA-20506 kafka-configs.sh can't delete the config from a offline broker when using bootstrap controller (#22104)
Ref https://github.com/apache/kafka/pull/22070#issuecomment-4282766703

Remove the pre-flight DescribeConfigs existence check in
`alterResourceConfig()` since deleting a non-existent config is
idempotent, and the check causes a timeout when the target broker is
offline.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-04-23 22:28:59 +08:00
Ken Huang 0a367aa1ec KAFKA-20297 Move OperatingSystem, Java, Exit... into internal (#22093)
We have exposed several classes in org.apache.kafka.common.utils as
public APIs, which can be misleading since not all classes in this
package are intended for external use.

So move following class into internal module
- OperatingSystem
- Java
- Exit
- Shell
- LoggingSignalHandler

Reviewers: cychiu <cychiu8@gmail.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
2026-04-21 23:56:52 +08:00
Ken Huang 4ae78a36ac KAFKA-20297 Move ByteBufferUnmapper, BufferSupplier, ChunkedBytesStream into internal (#22081)
We have exposed several classes in org.apache.kafka.common.utils as
public APIs, which can be misleading since not all classes in this
package are intended for external use.

So move ByteBufferUnmapper, BufferSupplier, ChunkedBytesStream into
internal module

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-04-18 21:00:12 +08:00
Ken Huang 2791424723 MINOR: Use maybeSetDslStoreFormatHeaders helper in more streams test classes (#22057)
See discussion:
https://github.com/apache/kafka/pull/21820#discussion_r3051604424

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-04-16 13:38:54 +08:00
Ken Huang 2299a06e31 KAFKA-20297: Move AbstractIterator, CircularIterator, CloseableIterator... into internal (#22052)
We have exposed several classes in org.apache.kafka.common.utils as
public APIs, which can be misleading since not all classes in this
package are intended for external use.

To clarify API boundaries and prevent unintended usage, we propose
moving the following classes to an internal package:

- AbstractIterator
- CircularIterator
- CloseableIterator
- CopyOnWriteMap
- FixedOrderMap
- PrimitiveRef

Reviewers: Christo <lolovc@amazon.com>, PoAn Yang <payang@apache.org>
2026-04-15 21:53:15 +09:00
Ken Huang 37b1a075f0 MINOR: Move KafkaMetricsGroupTest from Scala to Java (#22028)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2026-04-14 12:16:03 +02:00
Ken Huang 4e3e6858d3 KAFKA-19752 Move parts of UnifiedLogTest to storage module (#21912)
testRecoveryPointNotIncrementedOnProducerStateSnapshotFlushFailure ~
testStaleProducerEpochReturnsRecoverableErrorForTV2Clients

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-04-01 18:28:40 +08:00
Ken Huang 98e13b7ba8 MINOR: Move TerseFailure to server-common (#21890)
Rewite this class and move to server-common module

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-04-01 12:35:31 +08:00
Ken Huang 07c87a8322 KAFKA-19752 Move parts of UnifiedLogTest to storage module (#21807)
testMaybeUpdateHighWatermarkAsFollower ~
testNonZeroSequenceOnFirstAppendNonZeroEpoch

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-03-31 17:02:24 +08:00
Ken Huang 67d1e22070 KAFKA-20036 Handle LogCleaner segment overflow caused by compression level changes (#21379)
We add a new map to record which topic partitions have experienced
overflow.  When an overflow occurs, the next time the group is
processed, we reduce the segment size by a factor of 0.9 to prevent the
overflow from happening again.  If the partition still overflows, we
continue to multiply the ratio by 0.9 on subsequent attempts until the
partition is successfully cleaned.

Reviewers: Jun Rao <junrao@gmail.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
2026-03-31 13:24:53 +08:00
Ken Huang fb3d6fb546 KAFKA-19752 Move parts of UnifiedLogTest to storage module (#21763)
testRetentionIdempotency ~ testLogRollAfterLogHandlerClosed

Reviewers: PoAn Yang <payang@apache.org>
2026-03-17 23:15:58 +09:00
Ken HuangandFan Yang eb0a7358c4 KAFKA-19697 NPE Cannot invoke org.apache.kafka.connect.runtime.ConnectMetrics$MetricGroup.close() (#21717)
The PR fixed an NPE when connectorStatusMetrics unregistering task. The
issue will happen if a connector has more than 1 task on one worker and
these tasks fail to start. For example, if the DNS cant resolve producer
URL, tasks will fail to build. If these tasks failing to start,
ConnectorStatusMetricsGroup will unregister them. After first task
unregistered , connectorStatusMetrics removed connector. When second
task calls `recordTaskRemoved()`, connectorStatusMetrics is empty, so
`connectorStatusMetrics.get(connectorTaskId.connector()).close();` will
throw NPE.  Like in method `recordTaskAdded()`, this fix checks
connectorStatusMetrics at the beginning of method `recordTaskRemoved()`.

Co-authored-by: Fan Yang <fan365@hotmail.com>

Reviewers: Ding <isDing_L@163.com>, Chia-Ping Tsai <chia7712@gmail.com>
2026-03-16 23:33:54 +08:00
Ken Huang dfab5999f6 KAFKA-19752 Move parts of UnifiedLogTest to storage module (#21686)
From `testReadWithMinMessage` to
`testFetchLatestTieredTimestampWithRemoteStorage`

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
2026-03-12 01:50:03 +08:00
Ken Huang a1c574574a MINOR: Followup Deprecate group.coordinator.rebalance.protocols config (#21699)
Cleanup test which using `classic,consumer,streams`, see comment
https://github.com/apache/kafka/pull/21522#issuecomment-4029545287

Reviewers: TengYao Chi <frankvicky@apache.org>, Lan Ding
<isDing_L@163.com>
2026-03-11 09:34:47 +00:00
Ken Huang c1c88968ad KAFKA-19984 Throttle-related dynamic configurations should not have the isReadOnly flag (#21131)
The following configs are weird because those values are definitely not
READONLY
- leader.replication.throttled.rate
- follower.replication.throttled.rate
- replica.alter.log.dirs.io.max.bytes.per.second

Add them into the `DynamicBrokerConfig` to ensure when we query it's not
READONLY

Reviewers: Lan Ding <isDing_L@163.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
2026-02-10 08:33:49 +08:00
Ken Huang 893a4d917a MINOR: Fix zk2kraft page broken link (#21270)
<img width="1580" height="578" alt="CleanShot 2026-01-08 at 21 12 59@2x"

src="https://github.com/user-attachments/assets/47fba3bb-69f3-4ac4-b24c-83b35ebb1bea"
/>

It should be link to

<img width="1614" height="928" alt="CleanShot 2026-01-08 at 21 13 29@2x"

src="https://github.com/user-attachments/assets/07be8573-633d-48b9-8042-c587f1660f8b"
/>

Reviewers: PoAn Yang <payang@apache.org>, Chia-Ping Tsai
 <chia7712@gmail.com>
2026-01-10 23:04:13 +08:00
Ken Huang 84fa53142b KAFKA-20038 Upgrade Log4j to 2.25.3 to fix CVE-2025-68161 (#21249)
Updated lo4j2 version to 2.25.3 to prevent CVE. FYI:
https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core

CVE LINK : https://nvd.nist.gov/vuln/detail/CVE-2025-68161

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2026-01-07 16:32:18 +08:00
Ken Huang 04da4fb4e5 KAFKA-20023 Fix kafka-reassign-partitions.sh to handle dead brokers (#21222)
Return Node objects instead and use Node#isEmpty() to filter them out
before querying.

Test Result:
Broker 4 is alive
```
./bin/kafka-reassign-partitions.sh --bootstrap-server localhost:19092
--topics-to-move-json-file tmp.json   --broker-list "2,3,4"   --generate
Current partition replica assignment
{"version":1,"partitions":[{"topic":"test1","partition":0,"replicas":[3,4],"log_dirs":["/tmp/kraft-broker-logs-1","/tmp/kraft-broker-logs-2"]},{"topic":"test1","partition":1,"replicas":[4,2],"log_dirs":["/tmp/kraft-broker-logs-2","/tmp/kraft-broker-logs"]}]}
```
Broker 4 shutdown
```
/bin/kafka-reassign-partitions.sh --bootstrap-server localhost:19092
--topics-to-move-json-file tmp.json   --broker-list "2,3,4"   --generate
Current partition replica assignment
{"version":1,"partitions":[{"topic":"test1","partition":0,"replicas":[3,4],"log_dirs":["/tmp/kraft-broker-logs-1","any"]},{"topic":"test1","partition":1,"replicas":[4,2],"log_dirs":["any","/tmp/kraft-broker-logs"]}]}

Proposed partition reassignment configuration
{"version":1,"partitions":[{"topic":"test1","partition":0,"replicas":[3,2],"log_dirs":["any","any"]},{"topic":"test1","partition":1,"replicas":[2,3],"log_dirs":["any","any"]}]}

```

Reviewers: PoAn Yang <payang@apache.org>, Andrew Schofield
 <aschofield@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
2026-01-04 00:34:26 +08:00
Ken Huang e9ad221411 MINOR: Remove 4.2 from Streams E2E tests (#21241)
Since Kafka 4.2.0 has not been released yet, using str(LATEST_4_2)
causes the e2e tests to fail, so we should remove it.

Reviewers: TengYao Chi <frankvicky@apache.org>, Chia-Ping Tsai
 <chia7712@gmail.com>
2026-01-03 23:45:52 +08:00
Ken Huang f0488ebbd4 KAFKA-19999 Transaction coordinator livelock caused by invalid producer epoch (#21176)
In Transaction Version 2, strict epoch validation (`markerEpoch >
currentEpoch`) causes hanging transactions in two scenarios:

1. **Coordinator recovery**: When reloading PREPARE_COMMIT/ABORT from
transaction log, retried markers are rejected with
`InvalidProducerEpochException` because they use the same epoch
2. **Network retry**: When marker write succeeds but response is lost,
coordinator retries are rejected for the same reason

Both cases leave transactions permanently hanging in PREPARE state,
causing clients to fail with `CONCURRENT_TRANSACTIONS`.

Detect idempotent marker retries in
`ProducerStateManager.checkProducerEpoch()` by checking three
conditions:
1. Transaction Version ≥ 2
2. markerEpoch == currentEpoch (same epoch)
3. currentTxnFirstOffset is empty (transaction already completed)

When all conditions are met, treat the marker as a successful idempotent
retry instead of throwing an error.

Reviewers: Justine Olshan <jolshan@confluent.io>, TaiJuWu
 <tjwu1217@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-12-28 12:50:08 +08:00
Ken Huang 7ff4835da5 MINOR: Fix the Client/Broker Forward Compatibility table in compatibility page (#21209)
The formatting of this table is currently incorrect.   <img width="885"
height="808" alt="image"

src="https://github.com/user-attachments/assets/6ee71dde-0d3d-44d3-8e82-49b5ab922f64"
/>

The following snapshot is for this patch.  <img width="991" height="656"
alt="image"

src="https://github.com/user-attachments/assets/b9958eb0-0a73-47b4-99dd-359efaa60d08"
/>

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-12-25 19:40:10 +08:00
Ken Huang a2eae88a22 KAFKA-19940 Reduce the log4j2 cpu usage in PersisterStateManager (#21027)
FYI: https://github.com/apache/kafka/pull/20175/files#r2572693459

This PR optimizes the logging mechanism in PersisterStateManager to
reduce CPU overhead and fix issues preventing dynamic log level
configuration for internal handlers.

Replaced the usage of getCanonicalName() with the standard class-based
logger initialization (e.g., LoggerFactory.getLogger(...)).

Reviewers: Sushant Mahajan <smahajan@confluent.io>, Chia-Ping Tsai
 <chia7712@gmail.com>
2025-12-18 01:35:13 +08:00
Ken Huang b11b2cdd6a MINOR: Followup KIP-1161 upgrade and test (#20989)
FYI: https://github.com/apache/kafka/pull/20960#discussion_r2557144873

Reviewers: Jun Rao <junrao@gmail.com>
2025-11-25 11:50:37 -08:00
Ken Huang e8459d3864 KAFKA-19875 Duplicated topic config prevents broker start (#20844)
Ignore duplicated values in a config of List type instead of failing for backward compatibility.

Reviewers: Jun Rao <junrao@gmail.com>
2025-11-21 10:09:21 -08:00
Ken Huang 94d3355b78 MINOR: Fix zombie process issue in ducker containers by using --init (#20899)
While running Kafka e2e tests, various tests were failing with
`TimeoutError('Kafka node failed to stop in 60 seconds')`. In Kafka e2e
tests, we check the PID to ensure the Kafka server has shut down. After
investigating this issue, I found that the Kafka process was a zombie
process in the container:
```bash
ducker@ducker05:/$ jcmd
285 kafka.Kafka /mnt/kafka/kafka.properties
18207 jdk.jcmd/sun.tools.jcmd.JCmd

ducker@ducker05:/$ cat /proc/285/status | grep -i state
State:  Z (zombie)
```

This issue is related to [this
change](https://github.com/apache/kafka/pull/17554/files#r1845737954).
When using `CMD ["sudo", "service", "ssh", "start", "-D"]`, PID 1
becomes the SSH service, which does not handle `SIGCHLD` signals and
therefore won't reap zombie processes:
```bash
ducker@ducker05:/$ cat /proc/1/cmdline | tr '\0' ' '
sudo service ssh start -D
```

However, with the old syntax `CMD sudo service ssh start && tail -f
/dev/null`, PID 1 is `/bin/sh`, which is a shell that properly reaps
zombie processes:
```bash
ducker@ducker05:/$ cat /proc/1/cmdline | tr '\0' ' '
/bin/sh -c sudo service ssh start && tail -f /dev/null
```

Use `tini` as PID 1 to properly manage processes and avoid zombie
processes from remaining in the system.

Reviewers: PoAn Yang <payang@apache.org>, TaiJuWu <tjwu1217@gmail.com>,
 Chia-Ping Tsai <chia7712@gmail.com>
2025-11-20 14:43:12 +08:00
Ken Huang 69e1c9101c KAFKA-19876 Replace the base image since openjdk image is deprecated (#20886)
The openjdk image has been officially deprecated (ref:
https://hub.docker.com/_/openjdk  ), so we’ll need to switch to another
base image for our E2E test environment.

I tested this on my local machine using the following command:
```
jdk_version="sapmachine:17-jdk-ubuntu-jammy" \
image_name="ducker-ak:$(git rev-parse --short HEAD)" \
TC_PATHS="tests/kafkatest/tests/client/pluggable_test.py" \
/bin/bash tests/docker/run_tests.sh
```
result:
```
[INFO:2025-11-14 14:40:35,072]: RunnerClient:
kafkatest.tests.client.pluggable_test.PluggableConsumerTest.test_start_stop.metadata_quorum=ISOLATED_KRAFT:
PASS
[WARNING - 2025-11-14 14:40:35,072 - runner_client - log - lineno:459]:
RunnerClient:
kafkatest.tests.client.pluggable_test.PluggableConsumerTest.test_start_stop.metadata_quorum=ISOLATED_KRAFT:
Test requested 4 nodes, used only 3
[WARNING:2025-11-14 14:40:35,072]: RunnerClient:
kafkatest.tests.client.pluggable_test.PluggableConsumerTest.test_start_stop.metadata_quorum=ISOLATED_KRAFT:
Test requested 4 nodes, used only 3
[INFO:2025-11-14 14:40:35,073]: RunnerClient:
kafkatest.tests.client.pluggable_test.PluggableConsumerTest.test_start_stop.metadata_quorum=ISOLATED_KRAFT:
Data: None
================================================================================
SESSION REPORT (ALL TESTS)
ducktape version: 0.12.0
session_id:       2025-11-14--004
run time:         13.568 seconds
tests run:        1
passed:           1
flaky:            0
failed:           0
ignored:          0
================================================================================
test_id:
kafkatest.tests.client.pluggable_test.PluggableConsumerTest.test_start_stop.metadata_quorum=ISOLATED_KRAFT
status:     PASS
run time:   13.460 seconds
--------------------------------------------------------------------------------
```

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Ming-Yen Chung
 <mingyen066@gmail.com>, PoAn Yang <payang@apache.org>
2025-11-15 13:49:35 +08:00
Ken Huang b1b330e664 MINOR: Followup KAFKA-18193 for null check and error message (#20650)
This PR is a follow-up to KAFKA-18193. It addresses the need for a null
check and an improved error message. Please refer to the previous
comments and the review of
https://github.com/apache/kafka/pull/19955#pullrequestreview-3310028108
for more context.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-10-13 00:07:45 +08:00
Ken Huang ebae768bd8 KAFKA-18193 Refactor Kafka Streams CloseOptions to Fluent API Style (#19955)
In Kafka Streams, configuration classes typically follow a fluent API
pattern to ensure a consistent and intuitive developer experience.
However, the current implementation of
`org.apache.kafka.streams.KafkaStreams$CloseOptions` deviates from this
convention by exposing a public constructor, breaking the uniformity
expected across the API.

To address this inconsistency, we propose introducing a new
`CloseOptions` class that adheres to the fluent API style, replacing the
existing implementation. The new class will retain the existing
`timeout(Duration)` and `leaveGroup(boolean)` methods but will enforce
fluent instantiation and configuration. Given the design shift, we will
not maintain backward compatibility with the current class.

This change aligns with the goal of standardizing configuration objects
across Kafka Streams, offering developers a more cohesive and
predictable API.

Reviewers: Bill Bejeck<bbejeck@apache.org>
2025-10-07 08:50:18 -04:00
Ken Huang f68a149a18 KAFKA-18509 Move StateChangeLogger to server-common module (#20637)
We can rewrite this class from scala to java and move to server-common
module.  To maintain backward compatibility, we should keep the logger
name `state.change.logger`.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-10-06 22:56:57 +08:00
Ken Huang 7d098cfbbd KAFKA-17876/ KAFKA-19150 Rename AssignmentsManager and RemoteStorageThreadPool metrics (#20265)
Rename org.apache.kafka.server:type=AssignmentsManager and
org.apache.kafka.storage.internals.log.RemoteStorageThreadPool metrics
for the consist, these metrics should be

- `kafka.log.remote:type=...`
- `kafka.server:type=...`

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-09-29 01:24:38 +08:00
Ken Huang 41611b4bd2 MINOR: Followup KAFKA-19112 document updated (#20492)
Some sections are not very clear, and we need to update the
documentation.

Reviewers: TengYao Chi <kitingiao@gmail.com>, Jun Rao
 <junrao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-09-28 19:06:06 +08:00
Ken Huang 527467d053 KAFKA-18356: Explicitly set up instrumentation for inline mocking (Java 21+) (#18339)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ismael Juma <ismael@juma.me.uk>
2025-09-26 10:31:14 +02:00
Ken Huang 8036e49a6e KAFKA-17554 Flaky testFutureCompletionOutsidePoll in ConsumerNetworkClientTest (#18298)
Jira: https://issues.apache.org/jira/browse/KAFKA-17554

In the previous workflow, the test passes under two conditions:

1. The `t1` thread is waiting for the main thread's `client.wakeup()`.
If successful, `t1` will wake up `t2`, allowing `t2` to complete the
future.
2. If `t1` fails to receive the `client.wakeup()` from the main thread,
`t2` will be woken up by the main thread.

In the previous implementation, we used a `CountDownLatch` to control
the execution of three threads, but it often led to race conditions.
Currently, we have modified it to use two threads to test this scenario.

I run `I=0;  while ./gradlew :clients:test --tests
ConsumerNetworkClientTest.testFutureCompletionOutsidePoll --rerun
--fail-fast; do  (( I=$I+1 )); echo "Completed run: $I"; sleep 1; done`
and pass 3000+ times.

![image](https://github.com/user-attachments/assets/3b8d804e-fbe0-4030-8686-4960fc717d07)

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-09-24 18:42:25 +08:00
Ken Huang da6a562f6d KAFKA-17834: Improvements to Dockerfile (#17554)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-09-22 17:04:42 +02:00
Ken Huang a0640f9517 KAFKA-18351: Remove top-level version field from docker-compose.yml files (#18322)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Sylwester Lachiewicz <slachiewicz@apache.org>, Dávid Szigecsán
2025-09-22 16:57:30 +02:00
Ken Huang 01fccd3513 KAFKA-15186 AppInfo metrics don't contain the client-id (#20493)
All Kafka component register AppInfo metrics to track the application
start time or commit-id etc. These metrics are useful for monitoring and
debugging. However, the AppInfo doesn't provide client-id, which is an
important information for custom metrics reporter.

The AppInfoParser class registers a JMX MBean with the provided
client-id, but when it adds metrics to the Metrics registry, the
client-id is not included. This KIP aims to add the client-id as a tag.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-09-21 16:28:03 +08:00
Ken Huang 07b786e5bf KAFKA-19681 Improve MetadataShell tool by skipping missing children and removing zkMigrationState (#20504)
The current `metadata-shell` find command throws an exception due to
child node `zkMigrationState`.
This interrupts the output and makes the CLI less usable.

Additionally, `zkMigrationState` is no longer used in Kafka 4.x, but it
is still defined under image/features, which causes misleading error
messages.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-09-21 12:35:46 +08:00
Ken Huang 0a12eaa80e KAFKA-19112 Unifying LIST-Type Configuration Validation and Default Values (#20334)
We add the three main changes in this PR

- Disallowing null values for most LIST-type configurations makes sense,
since users cannot explicitly set a configuration to null in a
properties file. Therefore, only configurations with a default value of
null should be allowed to accept null.
- Disallowing duplicate values is reasonable, as there are currently no
known configurations in Kafka that require specifying the same value
multiple times. Allowing duplicates is both rare in practice and
potentially confusing to users.
- Disallowing empty list, even though many configurations currently
accept them. In practice, setting an empty list for several of these
configurations can lead to server startup failures or unexpected
behavior. Therefore, enforcing non-empty lists helps prevent
misconfiguration and improves system robustness.
These changes may introduce some backward incompatibility, but this
trade-off is justified by the significant improvements in safety,
consistency, and overall user experience.

Additionally, we introduce two minor adjustments:

- Reclassify some STRING-type configurations as LIST-type, particularly
those using comma-separated values to represent multiple entries. This
change reflects the actual semantics used in Kafka.
- Update the default values for some configurations to better align with
other configs.
These changes will not introduce any compatibility issues.

Reviewers: Jun Rao <junrao@gmail.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
2025-09-06 01:25:55 +08:00
Ken Huang 8076702c4c MINOR: Add Unit test for TimingWheel (#20443)
There is any unit test for `TimingWheel`, we should add test for it.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-09-05 05:55:57 +08:00
Ken Huang 2cc66f12c3 MINOR: Remove OffsetsForLeaderEpochRequest unused static field (#20418)
This field was used for replica_id, but after

https://github.com/apache/kafka/commit/51c833e7959bd6ab7fbb043f76933456b40ecae4,
the OffsetsForLeaderEpochRequest directly relies on the internal structs
generated by the automated protocol. Therefore, we can safely remove it.

Reviewers: Lan Ding <isDing_L@163.com>, TengYao Chi
<frankvicky@apache.org>
2025-08-28 17:24:01 +08:00
Ken Huang 08057eac53 KAFKA-18600 Cleanup NetworkClient zk related logging (#18644)
This PR removes associated logging within NetworkClient to reduce noise
and streamline the client code.

Reviewers: Ismael Juma <ismael@juma.me.uk>, David Arthur
 <mumrah@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-08-27 03:51:28 +08:00
Ken Huang a9b2a6d9b6 MINOR: Optimize the entriesWithoutErrorsPerPartition when errorResults is empty (#20410)
If `errorResults` is empty, there’s no need to create a new
`entriesPerPartition` map.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-08-27 03:11:35 +08:00
Ken Huang 47bb46c10d KAFKA-19582 the current assignments shown by ReassignPartitionsCommand should include the log directories (#20319)
The ReassignPartitionsCommand shows the topic replicas on each broker.
When using the --generate command, it returns the current partition
replica assignment. However, the log directory for each current replica
is always shown as any. This makes it impossible for users to determine
which specific log directory is being used by each replica. Therefore,
we should fix this behavior.

```
Current partition replica assignment
{
  "version": 1,
  "partitions": [
    {
      "topic": "test1",
      "partition": 0,
      "replicas": [
        4,
        2
      ],
      "log_dirs": [
        "any",
        "any"
      ]
    }
  ]
}
```

This PR
```
Current partition replica assignment
{
  "version": 1,
  "partitions": [
    {
      "topic": "test1",
      "partition": 0,
      "replicas": [
        4,
        2
      ],
      "log_dirs": [
        "/tmp/kraft-broker-logs234",
        "/tmp/kraft-broker-logs"
      ]
    }
  ]
}
```

Reviewers: PoAn Yang <payang@apache.org>, Jhen-Yung Hsu
 <jhenyunghsu@gmail.com>, TaiJuWu <tjwu1217@gmail.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
2025-08-23 02:57:00 +08:00
Ken Huang a12d38f091 MINOR: Cleanup RaftClient#upgradeKRaftVersion java document (#20275)
The compiler warning is due to a lack of import. This patch imports the ApiException to fix it.

Reviewers: TengYao Chi <frankvicky@apache.org>, Yung
<yungyung7654321@gmail.com>
2025-08-05 19:06:17 +08:00
Ken Huang 96c8e86cdf KAFKA-19530 RemoteLogManager should record lag stats when remote storage is offline (#20218)
When remote storage is offline, then the segmentLag and bytesLag metrics
are not recorded.   These metrics are useful to know the pending data to
upload when remote storage is down.

Reviewers: TaiJuWu <tjwu1217@gmail.com>, Kamal Chandraprakash
 <kamal.chandraprakash@gmail.com>
2025-07-29 20:08:06 +05:30
Ken Huang a399852ced KAFKA-19042 Move PlaintextConsumerTest to client-integration-tests module (#20081)
Use Java to rewrite PlaintextConsumerTest by new test infra and  move it
to client-integration-tests module.

Reviewers: Jhen-Yung Hsu <jhenyunghsu@gmail.com>, TengYao Chi
<kitingiao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-07-08 01:41:59 +08:00
Ken Huang d31885d33c MINOR: Use <code> block instead of backtick (#20107)
When writing HTML, it's recommended to use the <code> element instead of
backticks for inline code formatting.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, TengYao Chi
<frankvicky@apache.org>
2025-07-06 14:49:51 +08:00
Ken Huang b919836551 KAFKA-17662: config.providers configuration missing from the docs (#18930)
Ensure the config.providers configuration is documented for all
components supporting it

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Greg Harris
<gharris1727@gmail.com>, Matthias J. Sax <mjsax@apache.org>
2025-06-27 14:13:55 +02:00
Ken Huang 023833fe1f KAFKA-18778 Fix the inconsistent lastest supported version in StorageTool.scala and FutureCommand (#19157)
To maintain code consistency, `MetadataVersion#fromVersionString` uses
`latestTesting()` as the latest version. Therefore, in the tools, we
also need to maintain consistency by updating the outer logging to use
`latestTesting()`.

See the discussion:
https://github.com/apache/kafka/pull/18845#discussion_r1950706791

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-06-25 01:59:52 +08:00
Ken Huang fa4d8836d3 MINOR: DescribeAuthorizedOperationsTest cluster setting has been overridden (#20012)
The old approach `OFFSETS_TOPIC_REPLICATION_FACTOR_CONFIG` will override
`OFFSETS_TOPIC_PARTITIONS_CONFIG` config, this behaviour is not
expected, we should fix it.

Reviewers: TengYao Chi <frankvicky@apache.org>
2025-06-22 21:42:03 +08:00
Ken Huang 15ad3016b7 KAFKA-19140 ConnectAssignor#performAssignment parameter can be replace to ConnectProtocolCompatibility (#19476)
The protocol type; for Connect assignors this is "eager", "compatible",
or "sessioned"

Since `ConnectAssignor` is an interface and the protocol parameter is
restricted to "eager", "compatible", or "sessioned", it aligns with the
existing ConnectProtocolCompatibility enum. Therefore, we can update the
code to use `ConnectProtocolCompatibility` directly.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-06-20 03:07:57 +08:00
Ken Huang 297bc40d96 MINOR: The upgrade.html file contains duplicate IDs on the same page (#19996)
According to correct HTML syntax, IDs on the same page should be unique,
so we should fix this.

Reviewers: TengYao Chi <frankvicky@apache.org>
2025-06-19 17:18:58 +08:00
Ken Huang 91ce182ec5 KAFKA-19042 Move ProducerSendWhileDeletionTest to client-integration-tests module (#19971)
Use Java to rewrite ProducerSendWhileDeletionTest by new test infra and
move it to client-integration-tests module.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-06-18 00:47:30 +08:00
Ken Huang 7c715c02c0 KAFKA-18486 Update testClearPurgatoryOnBecomingFollower etc with KRaft mechanism in ReplicaManagerTest (#19924)
update the following test to avoid using `becomeLeaderOrFollower`
- testClearPurgatoryOnBecomingFollower
- testDelayedFetchIncludesAbortedTransactions
- testDisabledTransactionVerification
- testFailedBuildRemoteLogAuxStateMetrics

Reviewers: TengYao Chi <kitingiao@gmail.com>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-06-11 18:52:08 +08:00
Ken Huang d6861f3f15 MINOR: Use pollUntilTrue instead of waitForCondition (#19911)
We can use `pollUntilTrue` instead of `waitForCondition`, thus do a
little refactor to reduce the duplicate code

Reviewers: TengYao Chi <frankvicky@apache.org>, Lan Ding
 <isDing_L@163.com>, TaiJuWu <tjwu1217@gmail.com>
2025-06-09 15:33:00 +08:00
Ken Huang df73133f3b MINOR: Follow up KAFKA-19080 MetadataLogConfig (#19842)
See Discussion:
https://github.com/apache/kafka/pull/19371#discussion_r2109549343

Do the following changes:
- Update the internal config name with metadata prefix
- add the warning message for setting
`INTERNAL_METADATA_LOG_SEGMENT_BYTES_CONFIG`

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-06-09 03:13:03 +08:00
Ken Huang 8fd0d33670 KAFKA-19042 Move PlaintextConsumerSubscriptionTest to client-integration-tests module (#19827)
Use Java to rewrite PlaintextConsumerSubscriptionTest by new test infra
and move it to client-integration-tests module.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-06-08 05:06:03 +08:00
Ken Huang 5e601b2b26 KAFKA-19042 Move BaseConsumerTest, SaslPlainPlaintextConsumerTest to client-integration-tests module (#19651)
Use Java to rewrite BaseConsumerTest, SaslPlainPlaintextConsumerTest by
new test infra and move it to client-integration-tests module, the
BaseConsumerTest test is still used, thus we should not remove now.

Reviewers: PoAn Yang <payang@apache.org>, TengYao Chi
<frankvicky@apache.org>, Chia-Ping Tsai <chia7712@gmail.com>
2025-05-31 02:19:26 +08:00
Ken Huang bcda92b5b9 KAFKA-19080 The constraint on segment.ms is not enforced at topic level (#19371)
The main issue was that we forgot to set
`TopicConfig.SEGMENT_BYTES_CONFIG` to at least `1024 * 1024`, which
caused problems in tests with small segment sizes.

To address this, we introduced a new internal config:
`LogConfig.INTERNAL_SEGMENT_BYTES_CONFIG`, allowing us to set smaller
segment bytes specifically for testing purposes.

We also updated the logic so that if a user configures the topic-level
segment bytes without explicitly setting the internal config, the
internal value will no longer be returned to the user.

In addition, we removed
`MetadataLogConfig#METADATA_LOG_SEGMENT_MIN_BYTES_CONFIG` and added
three new internal configurations:
- `INTERNAL_MAX_BATCH_SIZE_IN_BYTES_CONFIG`
- `INTERNAL_MAX_FETCH_SIZE_IN_BYTES_CONFIG`
- `INTERNAL_DELETE_DELAY_MILLIS_CONFIG`

Reviewers: Jun Rao <junrao@gmail.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
2025-05-25 20:57:22 +08:00
Ken Huang bbe27e65a3 MINOR: Fix the CLIENT_QUOTA_CALLBACK_CLASS_CONFIG document (#18713)
See the discussion:

https://github.com/apache/kafka/pull/18346/files/7fa0dfd72d516474f783653369622a2c906cd07e#r1929621640

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-05-23 23:49:26 +08:00
Ken Huang aacf3a4b3d KAFKA-19042 Move PlaintextConsumerPollTest to client-integration-tests module (#19582)
Use Java to rewrite PlaintextConsumerPollTest by new test infra and move
it to client-integration-tests module.

Reviewers: PoAn Yang <payang@apache.org>, TengYao Chi
<kitingiao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-05-23 04:01:51 +08:00
Ken Huang 95d31befef MINOR: update the gradle version for java 24 support (#19760)
Gradle 8.14 starts to support Java 24, so we should update the Gradle
version accordingly.

Reviewers: TengYao Chi <kitingiao@gmail.com>, PoAn Yang
<payang@apache.org>, Chia-Ping Tsai <chia7712@gmail.com>
2025-05-21 15:10:56 +08:00
Ken Huang 6573b4ace1 KAFKA-19042 Move PlaintextConsumerCommitTest to client-integration-tests module (#19389)
Use Java to rewrite `PlaintextConsumerCommitTest` by new test infra and
move it to client-integration-tests module.

Reviewers: PoAn Yang <payang@apache.org>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-05-19 21:51:42 +08:00