Skip to content

Fix the perf harness passing a cwd-relative user_files_path to its servers - #120964

Merged
egor-click merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-perf-harness-relative-user-files-path
Sep 19, 2026
Merged

egor-click merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-perf-harness-relative-user-files-path

Conversation

@groeneai

@groeneai groeneai commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

The performance comparison harness passes an absolute user_files_path to its servers.

Description

Asked for on #100394: #100394 (comment)
Failing report, amd_release, master_head, 4/6: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=100394&sha=feb6f069e538b9c1288e684f3c39e3583a57ac9e&name_0=PR

compare.sh started its servers with --path left/db and --user_files_path left/db/user_files. The server resolves path against the original working directory (Server.cpp:1747) and every secondary path setting against that resolved path (getCanonicalPath(value, path_str), :2015), so the containment root became <perf_wd>/left/db/left/db/user_files/, and the absolute IcebergLocal paths dataset_download.py writes fell outside it:

Code: 481. File path .../perf_wd/left/db/user_files/tpch_ice_sf10/partsupp/
is not inside .../perf_wd/left/db/left/db/user_files/. (PATH_ACCESS_DENIED)

That is deliberate ("All secondary path settings ... are resolved relative to the now-absolute main path", aa7578d2d00c6; #100173 keeps it), so the harness is the side to fix: it now passes the absolute path it already means, as its sibling launcher performance_tests.py:1169 always has. --path is unchanged.

The measured servers use absolute paths, so measurements were unaffected. The doubling belongs to compare.sh's own restart, used by confirm_changes to rerun flagged queries: since the Iceberg dataset landed (2026-09-08) no flagged Iceberg query could be rerun or demoted, the standalone entrypoint could not run the Iceberg suites, and the six tests reading the raw user_files_path string got a relative one.

Verified on a master server, relative vs absolute: the doubled directory disappears, file('probe.csv') resolves, system.server_settings reports the absolute path, and the ATTACH succeeds, while a path truly outside the root is still refused with 481.

Two adjacent sites have the same shape with no observable consequence today, so I left them out: compare.sh's --top_level_domains_path points at a per-side directory nothing creates, and ci/jobs/clickhouse_light.py's relative --workdir default doubles its user_files root the same way (nothing there reads user_files); tell me and I will fix either.

This does not fix the 10 errors there: they are one traceback truncated by head -10, for an iceberg_suite_tpch query over --max-query-seconds, owned by #120762.


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

Version info

  • Merged into: 26.10.1.180 (included in 26.10 and later)

…rvers

ci/jobs/scripts/perf/compare.sh started its servers with both

    --path left/db
    --user_files_path left/db/user_files

Server.cpp:1747 resolves the main `path` setting against the original working
directory, and every secondary path setting is then resolved against that
resolved `path`: getCanonicalPath(value, path_str) at :2015 for
user_files_path, and likewise for user_scripts_path, the dynamic UDF path,
top_level_domains_path, tmp_path, format_schema_path and
filesystem_caches_path. getCanonicalPath composes only when the value is
relative, so the containment root became

    <perf_wd>/left/db/ + left/db/user_files
  = <perf_wd>/left/db/left/db/user_files/

and the absolute ATTACH ... IcebergLocal('<perf_wd>/left/db/user_files/...')
statements written by ci/jobs/scripts/dataset_download.py fell outside it.
assertLocalPathCorrect then threw

    Code: 481. File path .../perf_wd/left/db/user_files/tpch_ice_sf10/partsupp/
    is not inside .../perf_wd/left/db/left/db/user_files/. (PATH_ACCESS_DENIED)

async table load failed, and compare.sh's own `select * from system.tables`
census returned Code: 722 ASYNC_LOAD_WAIT_FAILED.

That composition is the documented intent of aa7578d ("All secondary
path settings (like `user_files_path`, `tmp_path`, `format_schema_path`, etc.)
are resolved relative to the now-absolute main `path`"), and the open ClickHouse#100173
preserves it, so the harness is the side to correct rather than the server:
changing getCanonicalPath's base would re-open the bug that commit fixed, and
would move tmp_path, format_schema_path, filesystem_caches_path and
user_scripts_path for every installation that configures them relatively.

Capture the harness root once and use it for the one argument the server
composes against --path. pwd -P is physical, matching the Python side's
Utils.cwd(), because assertLocalPathCorrect compares the two textually after
canonicalization. --path itself stays relative: it is already resolved against
the original working directory. --keeper_server.storage_path is not composed
against `path` at all (KeeperContext.cpp:452-542 hands the string to
create_local_disk). --top_level_domains_path is left alone deliberately:
prefixing it would preserve a per-side suffix that nothing creates, since
performance_tests.py:1983 copies the lists to the shared
{perf_wd}/top_level_domains.

The measured servers (performance_tests.py:1168-1176) are launched with
absolute paths, so measurements were unaffected. The doubling belonged to
compare.sh's own restart, which confirm_changes uses to rerun and demote the
queries flagged changed_fail, so since the Iceberg perf dataset landed in
ac21da0 no flagged Iceberg query could be rerun, the standalone
entrypoint could not run the Iceberg suites or json_file_query.xml, and the six
perf test files that build their path from the raw user_files_path string got a
relative path.

Verified on a master server, relative vs absolute: the doubled directory is no
longer created, file('probe.csv') resolves, system.server_settings reports the
absolute path, and the IcebergLocal ATTACH succeeds while a path genuinely
outside the root is still refused with 481.

Related: ClickHouse#100394
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Sep 19, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold read
of the diff and its callers. No blockers and no majors from either pass, so nothing was bounced.

# Sev Finding Verdict Evidence / action
1 💡 Nothing in the tree reddens if the three --user_files_path values go back to cwd-relative DISAGREE The only assertion that would redden on a revert is a text assertion over compare.sh's argv arrays (they are local inside restart/configure), which is the class removed in #114675, #115650 and #117138. The behavioural alternative, starting a server with a relative --user_files_path, would pin server behaviour aa7578d2d00c6 established deliberately and this PR does not change, so it would not redden either. Validation is the A/B below instead.
2 💡 compare.sh now mixes absolute and relative server arguments DISAGREE Measured each untouched option: --path is resolved against BaseDaemon's original working directory (BaseDaemon.cpp:133, Server.cpp:1747), so relative is already correct; --keeper_server.storage_path is never composed against path (KeeperContext.cpp hands the string to a local create_local_disk); --top_level_domains_path is read only by TLDListsHolder::parseConfig, and the perf config declares no top_level_domains_lists, so it is never opened. Prefixing any of them changes no behaviour.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

Validation, for the record, since no test file changes: a master server was started twice with only
--user_files_path differing. Relative: the doubled left/db/left/db/user_files directory is
created, file('probe.csv') fails naming it, system.server_settings reports the relative string,
and the IcebergLocal ATTACH returns Code: 481. Absolute: the doubled directory is absent, the
file() read returns its row, the setting reports the absolute path, and the ATTACH succeeds, while
a path genuinely outside the root is still refused with Code: 481, so the containment check is
intact and only its root changed. Reverting just --user_files_path on the same rig brings all
three failures back.

Session id: cron:clickhouse-review-slot-10:20260919-031600

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Sep 19, 2026
@clickhouse-gh clickhouse-gh Bot closed this Sep 19, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 19, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [19af905]

Summary: ✅


AI Review

Summary

This PR fixes compare.sh so its setup and restart servers pass an absolute user_files_path rooted in the perf workspace instead of a cwd-relative path that ClickHouse re-resolves under --path. That matches the already-correct server startup in ci/jobs/performance_tests.py, addresses the path-composition failure described in the PR, and I did not find a remaining correctness issue in the current diff or prior discussion.

Final Verdict

✅ No findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai manual approve Manual approve required to run CI pr-ci 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.

3 participants