Skip to content

Commit

Permalink
fix: Makes tests wait only 500ms for consumer group cleanup (#8367)
Browse files Browse the repository at this point in the history
* fix: Makes tests wait only 500ms for consumer group cleanup
  • Loading branch information
AlanConfluent committed Nov 17, 2021
1 parent 13382e7 commit 1a2f7b2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ksqldb-common/src/main/java/io/confluent/ksql/util/KsqlConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@ public class KsqlConfig extends AbstractConfig {
public static final String KSQL_VARIABLE_SUBSTITUTION_ENABLE_DOC
= "Enable variable substitution on SQL statements.";

public static final String KSQL_QUERY_CLEANUP_SHUTDOWN_TIMEOUT_MS
= "ksql.query.cleanup.shutdown.timeout.ms";
public static final long KSQL_QUERY_CLEANUP_SHUTDOWN_TIMEOUT_MS_DEFAULT = 30000;
public static final String KSQL_QUERY_CLEANUP_SHUTDOWN_TIMEOUT_MS_DOC
= "The total time that the query cleanup spends trying to clean things up on shutdown.";

private enum ConfigGeneration {
LEGACY,
CURRENT
Expand Down Expand Up @@ -1179,6 +1185,13 @@ private static ConfigDef buildConfigDef(final ConfigGeneration generation) {
Importance.LOW,
KSQL_SOURCE_TABLE_MATERIALIZATION_ENABLED_DOC
)
.define(
KSQL_QUERY_CLEANUP_SHUTDOWN_TIMEOUT_MS,
Type.LONG,
KSQL_QUERY_CLEANUP_SHUTDOWN_TIMEOUT_MS_DEFAULT,
Importance.LOW,
KSQL_QUERY_CLEANUP_SHUTDOWN_TIMEOUT_MS_DOC
)
.withClientSslSupport();

for (final CompatibilityBreakingConfigDef compatibilityBreakingConfigDef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,9 @@ public void close(final boolean closeQueries) {
primaryContext.getQueryRegistry().close(closeQueries);

try {
cleanupService.stopAsync().awaitTerminated(30, TimeUnit.SECONDS);
cleanupService.stopAsync().awaitTerminated(
ksqlConfig.getLong(KsqlConfig.KSQL_QUERY_CLEANUP_SHUTDOWN_TIMEOUT_MS),
TimeUnit.MILLISECONDS);
} catch (final TimeoutException e) {
log.warn("Timed out while closing cleanup service. "
+ "External resources for the following applications may be orphaned: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ private static KsqlRestConfig buildConfig(
configMap.put(KsqlConfig.KSQL_STREAMS_PREFIX + "auto.offset.reset", "earliest");
configMap.put(KsqlConfig.KSQL_ENABLE_UDFS, false);
configMap.put(KsqlRestConfig.KSQL_HEARTBEAT_ENABLE_CONFIG, false);
configMap.put(KsqlConfig.KSQL_QUERY_CLEANUP_SHUTDOWN_TIMEOUT_MS, 500L);
configMap.putAll(additionalProps);
return configMap;
}
Expand Down

0 comments on commit 1a2f7b2

Please sign in to comment.