Skip to content

Look up the default configuration file with all supported extensions (config.yaml, config.yml) - #118422

Merged
alexey-milovidov merged 8 commits into
masterfrom
default-config-file-yaml
Oct 2, 2026
Merged

alexey-milovidov merged 8 commits into
masterfrom
default-config-file-yaml

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

Closes: #118411
Related: #118404

A ClickHouse configuration file can be written in XML or in YAML, but the lookup of the default configuration file only knew about .xml, so a config.yaml or config.yml in the current directory was silently ignored:

  • clickhouse-server fell back to the configuration embedded into the binary and started up with a configuration the user did not write;
  • clickhouse-local behaved as if there were no configuration file at all;
  • the same applied to clickhouse-keeper (keeper_config.xml), clickhouse-keeper-client and clickhouse-disks.

This was inconsistent with the other lookup paths, which already probe all three extensions: ~/.clickhouse-local/config.yaml worked, while ./config.yaml did not.

Now the default configuration file is looked up as config.xml, config.yaml and config.yml, in this order, and the first one that exists is used. The extension probing is factored into tryGetConfigPath / getConfigPathForAnySupportedFormat in src/Common/Config/getConfigPath.h, which getLocalConfigPath and getClientConfigPath now use as well.

The Keeper Docker entrypoints (clickhouse docker-init --keeper and docker/keeper/entrypoint.sh) likewise use the first existing of /etc/clickhouse-keeper/keeper_config.{xml,yaml,yml} when KEEPER_CONFIG is not set.

A file requested explicitly with --config-file / -C is still used as is: silently substituting a different file for the name the user typed would be worse than reporting that it does not exist.

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

A configuration file can be written in XML or in YAML, but only config.xml was looked up as the default configuration file. Now clickhouse-server, clickhouse-keeper, clickhouse-local, clickhouse-keeper-client and clickhouse-disks also find config.yaml and config.yml (keeper_config.yaml and keeper_config.yml for Keeper). Previously, clickhouse-server silently started with the configuration embedded into the binary when only a config.yaml was present.


Workflow [PR]
Sync PR [sync-upstream/pr/118422]

Version info

  • Merged into: 26.10.1.1306-master (included in 26.10 and later)

A ClickHouse configuration file can be written in XML or in YAML, but the
lookup of the *default* configuration file only knew about `.xml`, so a
`config.yaml` or `config.yml` in the current directory was silently
ignored. `clickhouse-server` was the worst case: it fell back to the
configuration embedded into the binary and started up with a
configuration the user did not write.

The other lookup paths already probe all three extensions, so
`~/.clickhouse-local/config.yaml` worked while `./config.yaml` did not.

Now the default configuration file is looked up as `config.xml`,
`config.yaml` and `config.yml`, in this order, and the first one that
exists is used. This covers `clickhouse-server`, `clickhouse-keeper`
(`keeper_config.*`), `clickhouse-local`, `clickhouse-keeper-client` and
`clickhouse-disks`. The extension probing is factored into
`tryGetConfigPath` and `getConfigPathForAnySupportedFormat`, which
`getLocalConfigPath` and `getClientConfigPath` now use as well.

A file requested explicitly with `--config-file` or `-C` is still used as
is: silently substituting a different file for the name the user typed
would be worse than reporting that it does not exist.

Closes: #118411
@mintlify

mintlify Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
ClickHouse-docs 🟢 Ready View Preview Oct 2, 2026, 7:52 AM

@clickhouse-gh

clickhouse-gh Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2401119]

Summary: ✅


AI Review

Summary

This PR correctly extends default config-file auto-discovery to YAML/YML for clickhouse-server, clickhouse-local, clickhouse-keeper, clickhouse-keeper-client, clickhouse-disks, and the Keeper Docker launchers. The shared lookup refactor itself looks sound, but the Keeper Docker entrypoints still violate the PR's explicit-path contract: an explicit KEEPER_CONFIG can be silently dropped and replaced by auto-discovery / the embedded config. Because that can start Keeper from a different config than the operator asked for, I would not merge this yet.

Findings
  • ⚠️ Majors
    • [programs/docker-init/docker-init.cpp:941, docker/keeper/entrypoint.sh:36] The PR promises that an explicitly requested config path is used as-is, but both Keeper Docker entrypoints still only pass --config-file if the path exists at launch time, and they do that after changing the working directory. A missing explicit path, or a relative path that only resolved before the chdir, is silently dropped and Keeper falls back to auto-discovery / the embedded config instead of surfacing the bad path. Track whether KEEPER_CONFIG was set and always pass it through in that case, resolving it to an absolute path before chdir if relative paths should preserve their original meaning.
Tests
  • ⚠️ There is still no focused coverage for the Docker-entrypoint contract around an explicit KEEPER_CONFIG. After the bug above is fixed, add a small regression check that proves both Keeper launchers keep an explicit env path instead of silently re-probing.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions: preserve an explicit KEEPER_CONFIG across both Keeper Docker entrypoints, and add focused regression coverage for that explicit-path behavior.

LLVM Coverage Report

Measured on commit 2401119.

Metric Baseline Current Δ
Lines 88.10% 88.10% +0.00%
Functions 91.80% 91.80% +0.00%
Branches 79.50% 79.40% -0.10%

Changed lines: Changed C/C++ lines covered: 54/56 (96.43%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Sep 6, 2026
Comment thread programs/keeper-client/KeeperClient.cpp Resolved
@clickhouse-gh clickhouse-gh Bot added the comp-config Server configuration infrastructure: XML/YAML config parsing, preprocessor (includes, substitutio... label Sep 6, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 24011199f with master 0819758a1 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 287737bbc; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes

10 object files changed (+18.91 KiB total), 1 added.

Object file Master PR Δ
src/Common/Config/CMakeFiles/clickhouse_common_config.dir/getConfigPath.cpp.o new 22.20 KiB +22.20 KiB

719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

14 translation units recompiled, 40 s compile time in total, 13 of them have a recent master baseline.

Median compile-time ratio to the baselines is ×1.08 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio.
The matched translation units cost +3.5 s (+10%) in total before that adjustment.

Job report

Comment thread programs/keeper-client/KeeperClient.cpp Resolved
Comment thread programs/disks/DisksApp.cpp Resolved
alexey-milovidov and others added 2 commits September 11, 2026 07:35
…d document the new lookup

Addresses the review of #118422.

`clickhouse-keeper-client` now finds `config.yaml` and `config.yml`, but its
diagnostics still named `config.xml`: the `--config-file` help text and the
`Found keeper node in the config.xml, will use it for connection` message. A
user connected through a YAML file was pointed at a file that does not exist.
The resolved path is now threaded through `connectToKeeper` and logged, and the
help text mentions all three names.

The utility documentation of `clickhouse-keeper-client` and `clickhouse-disks`
still described the XML-only default, and the `Configuration files` section of
the `clickhouse-local` page contradicted the new `Usage` section; all three are
updated.

Test `05182_keeper_client_config_file_yaml_in_current_directory` covers the
`clickhouse-keeper-client` loader, which is separate from the shared
`BaseDaemon` path exercised by the other two tests.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…e utility docs

`clickhouse-keeper-client` resolves `zookeeper.password` and `zookeeper.identity`
from whichever configuration file was loaded, and `ConfigProcessor` reads both the
XML and the YAML forms, so the authentication bullets and the priority list must
not narrow this to "the XML config file specified by `--config-file`". Spell out
that the file is the one given by `--config-file` or, when it is omitted, the
first of `config.xml`, `config.yaml` and `config.yml` in the current directory.

In the `clickhouse-local` page the `Arguments` list still claimed that the
configuration is empty by default, contradicting the lookup documented in the
`Configuration files` section on the same page. Point the bullet at that section
instead.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (the branch was 3875 commits behind) and pushed the review fixes in 3624837ffa8b. Rebuilt clickhouse on the merge result and re-ran 05099_config_file_yaml_in_current_directory, 05100_server_config_file_yaml_in_current_directory and 05182_keeper_client_config_file_yaml_in_current_directory locally — all three pass.

Triage of the four reds on the previous head 3c887ba99c78 (all unrelated to a configuration-file lookup change):

@groeneai, the ThreadSanitizer race above is the only one without a merged fix — #118784 / #118486. Could you confirm whether that fix is on track, or provide one in a separate pull request?

Comment thread src/Daemon/BaseDaemon.cpp Resolved
@groeneai

Copy link
Copy Markdown
Collaborator

On track, and a second pull request is not needed: #118486 has been open since 2026-09-06 and covers exactly that pair. It removes the prepare callback that built the manifest filter sets on the producer thread DataFileEntriesStream spawns, and does that build in IcebergIterator's constructor instead, so both builds of the shared FutureSetFromSubquery run in order on the query thread.

Status: head 96d5f29de, no conflicts, the reds on that head triaged in a comment there, awaiting review. @ nickitat closed my sibling #118959 in its favour on 2026-09-11 and asked for the inplace_build_mutex removal to be paired with it, which I proposed on #118486.

It is still firing, so it is not only your branch: STID 3097-4413 on master on 2026-09-14 (Stress test (azure, amd_tsan)), and the read-side sibling STID 4806-4fd5 on #113099 and #119434 on 2026-09-12.

Its CI signal is from 2026-09-11 and the branch is now ~3950 commits behind master. Say the word and I will merge master and re-run it before anyone looks.

alexey-milovidov and others added 2 commits October 2, 2026 07:15
# Conflicts:
#	docs/concepts/features/tools-and-utilities/clickhouse-local.mdx
…Docker entrypoints

Both `clickhouse docker-init --keeper` (distroless image) and `docker/keeper/entrypoint.sh`
defaulted `KEEPER_CONFIG` to `/etc/clickhouse-keeper/keeper_config.xml` and passed
`--config-file` only when that file existed, so a `keeper_config.yaml` in the image was ignored
and Keeper started with the embedded configuration. Now, when `KEEPER_CONFIG` is not set, the
first existing of `keeper_config.xml`, `keeper_config.yaml` and `keeper_config.yml` is used.
An explicit `KEEPER_CONFIG` is still used as is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master. The only conflict was in docs/concepts/features/tools-and-utilities/clickhouse-local.mdx; I kept master's expanded --ignore-error description and this PR's --config-file description. I also addressed the Docker Keeper review thread in 24011199f4c. After the merge, 05099_config_file_yaml_in_current_directory, 05100_server_config_file_yaml_in_current_directory and 05182_keeper_client_config_file_yaml_in_current_directory pass locally.

The previous red, Upgrade check (amd_release) (Transactions require Keeper to advertise ... feature flags, SUPPORT_IS_DISABLED), is unrelated. Between 2026-09-18 and 2026-09-21 it failed on about 60 PRs. It was fixed by #120932, which this branch now contains.

std::string keeper_config = getEnv("KEEPER_CONFIG", "/etc/clickhouse-keeper/keeper_config.xml");
/// A path set explicitly with `KEEPER_CONFIG` is used as is. Otherwise, the configuration file can be
/// written in any of the supported formats, the same as the default one looked up by `clickhouse-keeper`.
std::string keeper_config = getEnv("KEEPER_CONFIG");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This says an explicit KEEPER_CONFIG is used as-is, but the function still only appends --config-file if fs::exists(keeper_config) after chdir(data_dir). That means a missing explicit path, or a relative path that only resolved before the chdir, is silently dropped and clickhouse-keeper falls back to auto-discovery / the embedded config. That violates the explicit-path contract from the PR description: we start Keeper from a different config instead of surfacing the bad path. Please track whether KEEPER_CONFIG was set and always pass --config-file in that case (resolving it to an absolute path before chdir if relative paths should keep their original meaning). The shell entrypoint has the same problem and should stay in sync.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Docker is out of scope of this PR.


KEEPER_CONFIG="${KEEPER_CONFIG:-/etc/clickhouse-keeper/keeper_config.xml}"
# The configuration file can be written in any of the supported formats.
if [ -z "$KEEPER_CONFIG" ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new auto-discovery is fine, but an explicit KEEPER_CONFIG still is not really "use as is": later, after cd "${DATA_DIR}", the final -f "$KEEPER_CONFIG" gate means a relative path (or a missing path that should error) is silently ignored and the entrypoint falls back to embedded/default config. That is the same bad substitution the PR description explicitly avoids for --config-file. Please remember whether the env var was set and always exec clickhouse-keeper --config-file="$KEEPER_CONFIG" in that case, instead of re-probing after cd.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a low concern.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 2, 2026
Merged via the queue into master with commit abd6a6d Oct 2, 2026
150 checks passed
@alexey-milovidov
alexey-milovidov deleted the default-config-file-yaml branch October 2, 2026 17:22
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 2, 2026

This branch was successfully deployed

1 active deployment
staging - docs — 24011199 Deployed Oct 2, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-config Server configuration infrastructure: XML/YAML config parsing, preprocessor (includes, substitutio... pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The default configuration file is only looked up as config.xml, so config.yaml in the current directory is silently ignored

3 participants