KAFKA-20786: Speed up TimeWindowedKStreamIntegrationTest - #22824
Merged
Conversation
Currently, the test needs to wait for 45sec for session timeout to expire. With a 60sec test timeout the test is flaky. This PR let Kafka Streams send a leave group request on close() which reduces the test runtime (for a single parameter run) from about 50sec to 5sec.
bbejeck
approved these changes
Jul 14, 2026
chia7712
reviewed
Jul 19, 2026
| kafkaStreams.close(); | ||
| // Leave the group on close so the immediate restart below does not have to wait for the | ||
| // previous member to be evicted via session timeout (~45s) before its rebalance completes. | ||
| kafkaStreams.close(CloseOptions.groupMembershipOperation(GroupMembershipOperation.LEAVE_GROUP)); |
Member
There was a problem hiding this comment.
This is a good approach to reduce the elapsed time. We will file a patch for TimestampedStoreUpgradeIntegrationTest, which can reduce the elapsed time from 5m to 30s
Gradle Test Run :streams:integration-tests:test > Gradle Test Executor 35 > TimestampedStoreUpgradeIntegrationTest > shouldMigrateInMemoryKeyValueStoreToTimestampedKeyValueStoreUsingPapi() PASSED
Gradle Test Run :streams:integration-tests:test > Gradle Test Executor 35 > TimestampedStoreUpgradeIntegrationTest > shouldProxyWindowStoreToTimestampedWindowStoreUsingPapi() PASSED
Gradle Test Run :streams:integration-tests:test > Gradle Test Executor 35 > TimestampedStoreUpgradeIntegrationTest > shouldMigratePersistentKeyValueStoreToTimestampedKeyValueStoreUsingPapi() PASSED
Gradle Test Run :streams:integration-tests:test > Gradle Test Executor 35 > TimestampedStoreUpgradeIntegrationTest > shouldMigratePersistentWindowStoreToTimestampedWindowStoreUsingPapi() PASSED
Gradle Test Run :streams:integration-tests:test > Gradle Test Executor 35 > TimestampedStoreUpgradeIntegrationTest > shouldSuccessfullyDowngradeFromTimestampedToRegularKeyValueStoreAfterCleanup() PASSED
Gradle Test Run :streams:integration-tests:test > Gradle Test Executor 35 > TimestampedStoreUpgradeIntegrationTest > shouldProxyKeyValueStoreToTimestampedKeyValueStoreUsingPapi() PASSED
Gradle Test Run :streams:integration-tests:test > Gradle Test Executor 35 > TimestampedStoreUpgradeIntegrationTest > shouldMigrateInMemoryWindowStoreToTimestampedWindowStoreUsingPapi() PASSED
Gradle Test Run :streams:integration-tests:test > Gradle Test Executor 35 > TimestampedStoreUpgradeIntegrationTest > shouldFailDowngradeFromTimestampedToRegularKeyValueStore() PASSED
[Incubating] Problems report is available at: file:///home/chia7712/project/kafka/build/reports/problems/problems-report.html
Deprecated Gradle features were used in this build, making it incompatible with Gradle 10.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/9.4.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 34s
Contributor
There was a problem hiding this comment.
HeadersStoreUpgradeIntegrationTest has the same pattern:
https://github.com/apache/kafka/blob/trunk/streams/integration-tests/src/test/java/org/apache/kafka/streams/integration/HeadersStoreUpgradeIntegrationTest.java
I'll fix it in a follow-up patch.
nileshkumar3
pushed a commit
to nileshkumar3/kafka
that referenced
this pull request
Jul 25, 2026
Currently, the test needs to wait for 45sec for session timeout to expire. With a 60sec test timeout the test is flaky. This PR let Kafka Streams send a leave group request on close() which reduces the test runtime (for a single parameter run) from about 50sec to 5sec. Reviewers: Bill Bejeck <bbejeck@apache.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the test needs to wait for 45sec for session timeout to
expire. With a 60sec test timeout the test is flaky.
This PR let Kafka Streams send a leave group request on close() which
reduces the test runtime (for a single parameter run) from about 50sec
to 5sec.
Reviewers: Bill Bejeck bbejeck@apache.org