From 2e11d9c52b515110bb02e19166837dc6d5253b2f Mon Sep 17 00:00:00 2001 From: Polyglot AI <293096396+polyglotAI-bot@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:55:28 +0000 Subject: [PATCH] tests: turn off unused system logs and limit replica memory in the cluster setup The cluster tests read only system.query_log. Each of the 3 replicas still wrote and merged about 22 other system logs. Each replica also sized its memory limit and caches for the whole runner (15 GiB), not for its share. - clickhouse-cluster/config.d/custom_config.xml: remove all default system logs except query_log (a remove of a section that a version does not have is a no-op, so the list works for 25.8 to latest). - ClusterClickHouseContainerStarter: 2 GiB memory limit on each replica container, so each server sets max_server_memory_usage to 1.8 GiB and lowers its caches to 1 GiB. Keeper and nginx stay unlimited. Part of: https://github.com/ClickHouse/clickhouse-java/issues/3267 Co-Authored-By: Claude Opus 5.5 --- .../ClusterClickHouseContainerStarter.java | 8 +++++- .../config.d/custom_config.xml | 27 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/clickhouse-client/src/test/java/com/clickhouse/client/ClusterClickHouseContainerStarter.java b/clickhouse-client/src/test/java/com/clickhouse/client/ClusterClickHouseContainerStarter.java index 9cd96dd7f..7d255fc18 100644 --- a/clickhouse-client/src/test/java/com/clickhouse/client/ClusterClickHouseContainerStarter.java +++ b/clickhouse-client/src/test/java/com/clickhouse/client/ClusterClickHouseContainerStarter.java @@ -21,6 +21,11 @@ final class ClusterClickHouseContainerStarter extends ClickHouseContainerStarter private static final String NGINX_CONFIG = "containers/nginx/nginx.conf"; private static final String KEEPER_CONFIG = "containers/clickhouse-keeper/keeper_config.xml"; private static final int KEEPER_PORT = 9181; + /** + * Memory limit of each replica container. A server sizes its memory limit and caches from the + * container limit, instead of sizing them for the whole runner. + */ + private static final long NODE_MEMORY_BYTES = 2L * 1024 * 1024 * 1024; private final GenericContainer keeper; private final List> nodes; @@ -50,7 +55,8 @@ final class ClusterClickHouseContainerStarter extends ClickHouseContainerStarter List> created = new ArrayList>(NODE_COUNT); for (int index = 1; index <= NODE_COUNT; index++) { String name = baseName == null ? null : baseName + "-" + index; - created.add(newClickHouseServer("clickhouse-" + index, name, "r" + index)); + created.add(newClickHouseServer("clickhouse-" + index, name, "r" + index) + .withCreateContainerCmdModifier(command -> command.getHostConfig().withMemory(NODE_MEMORY_BYTES))); } this.nodes = created; diff --git a/clickhouse-client/src/test/resources/containers/clickhouse-cluster/config.d/custom_config.xml b/clickhouse-client/src/test/resources/containers/clickhouse-cluster/config.d/custom_config.xml index 325b8b81e..eb943c2fd 100644 --- a/clickhouse-client/src/test/resources/containers/clickhouse-cluster/config.d/custom_config.xml +++ b/clickhouse-client/src/test/resources/containers/clickhouse-cluster/config.d/custom_config.xml @@ -116,4 +116,31 @@ 42 + + + + + + + + + + + + + + + + + + + + + + + + + + +