Repository navigation
Look up the default configuration file with all supported extensions (config.yaml, config.yml) - #118422
Conversation
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
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Workflow [PR], commit [2401119] Summary: ✅
AI ReviewSummaryThis PR correctly extends default config-file auto-discovery to YAML/YML for Findings
Tests
Final Verdict
LLVM Coverage ReportMeasured on commit 2401119.
Changed lines: Changed C/C++ lines covered: 54/56 (96.43%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes10 object files changed (+18.91 KiB total), 1 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units14 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. |
…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.
|
🕵 Merged Triage of the four reds on the previous head
@groeneai, the |
|
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 Status: head It is still firing, so it is not only your branch: STID 3097-4413 on master on 2026-09-14 ( 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. |
# 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]>
|
🕵 Merged The previous red, |
| 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"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
This is a low concern.
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 aconfig.yamlorconfig.ymlin the current directory was silently ignored:clickhouse-serverfell back to the configuration embedded into the binary and started up with a configuration the user did not write;clickhouse-localbehaved as if there were no configuration file at all;clickhouse-keeper(keeper_config.xml),clickhouse-keeper-clientandclickhouse-disks.This was inconsistent with the other lookup paths, which already probe all three extensions:
~/.clickhouse-local/config.yamlworked, while./config.yamldid not.Now the default configuration file is looked up as
config.xml,config.yamlandconfig.yml, in this order, and the first one that exists is used. The extension probing is factored intotryGetConfigPath/getConfigPathForAnySupportedFormatinsrc/Common/Config/getConfigPath.h, whichgetLocalConfigPathandgetClientConfigPathnow use as well.The Keeper Docker entrypoints (
clickhouse docker-init --keeperanddocker/keeper/entrypoint.sh) likewise use the first existing of/etc/clickhouse-keeper/keeper_config.{xml,yaml,yml}whenKEEPER_CONFIGis not set.A file requested explicitly with
--config-file/-Cis 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):
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.xmlwas looked up as the default configuration file. Nowclickhouse-server,clickhouse-keeper,clickhouse-local,clickhouse-keeper-clientandclickhouse-disksalso findconfig.yamlandconfig.yml(keeper_config.yamlandkeeper_config.ymlfor Keeper). Previously,clickhouse-serversilently started with the configuration embedded into the binary when only aconfig.yamlwas present.Workflow [PR]
Sync PR [sync-upstream/pr/118422]
Version info
26.10.1.1306-master(included in26.10and later)