Skip to content

Use a private home directory in tests that run clickhouse as clickhouse-local - #128197

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix/clickhouse-local-default-path-tests
Oct 30, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix/clickhouse-local-default-path-tests

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Tests 03536_ch_as_client_and_local and 03134_positional_arguments invoke the clickhouse binary in local mode without --path or --tmp, so it locks the persistent data directory ~/.local/share/clickhouse-local. When two such invocations run concurrently, one fails with Cannot lock file .../clickhouse-local/status. Another server instance in same directory is already running. This change points HOME and XDG_DATA_HOME at a per-test directory, as 05038_clickhouse_local_default_path and other tests already do.

Failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=127774&sha=af134d26ecffd69a4d3aea84773369f50b35be87&name_0=PR&name_1=Fast%20test
Related: #127774

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):

...

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.909-master (included in 26.11 and later)

…house-local`

Tests `03536_ch_as_client_and_local` and `03134_positional_arguments` invoke
the `clickhouse` binary in local mode without `--path` or `--tmp`, so it locks
the persistent data directory `~/.local/share/clickhouse-local`. When two such
invocations run concurrently, one of them fails with `Cannot lock file
.../clickhouse-local/status. Another server instance in same directory is
already running`. Point `HOME` and `XDG_DATA_HOME` at a per-test directory,
as tests `05038_clickhouse_local_default_path` and others already do.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=127774&sha=af134d26ecffd69a4d3aea84773369f50b35be87&name_0=PR&name_1=Fast%20test
#127774

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [eec7df1]

Summary: ✅


AI Review

Summary

PR #128197 gives 03134_positional_arguments and 03536_ch_as_client_and_local separate home directories and clears XDG_DATA_HOME, preventing concurrent tests from locking the same persistent data directory. Reviewed commit eec7df11eaa2db365fb517d885cf2f60ed1730b3; no actionable findings.

Final Verdict

Status: ✅ Approve.

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Oct 29, 2026

@alexey-milovidov alexey-milovidov left a comment

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.

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Oct 30, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 30, 2026
Merged via the queue into master with commit 8929c7c Oct 30, 2026
179 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix/clickhouse-local-default-path-tests branch October 30, 2026 08:30
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 30, 2026
huldarchen pushed a commit to huldarchen/ClickHouse that referenced this pull request Oct 30, 2026
The test writes a script whose first line is
`#!<path>/clickhouse-local --queries-file` and executes it. That run has
no `--tmp` and no `--path`, so since ClickHouse#116042 it uses the default data
directory in the home (`~/.local/share/clickhouse-local`, or
`$XDG_DATA_HOME/clickhouse-local`) and holds the `status` lock there.
Any other run using the same directory at that moment makes one of them
fail with `Code: 76 ... Cannot lock file .../status` (CANNOT_OPEN_FILE).
Seen on master in `Stateless tests (amd_tsan, parallel)`.

`--tmp` cannot be added to the shebang line: Linux passes everything
after the interpreter path as a single argument. The environment is the
only channel into that process, so the test gets a private HOME and an
empty XDG_DATA_HOME, the same block ClickHouse#128197 added to 03134 and 03536.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 12, 2026
…ir-bare-binary-tests

Take master's version of 03134_positional_arguments.sh and
03536_ch_as_client_and_local.sh: ClickHouse#128197 already gives both a private home.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 12, 2026
ClickHouse#128197 isolated 03134 and 03536 with an exported per-test `HOME` and
an empty `XDG_DATA_HOME`. Use the same block in 03267 instead of the
per-command prefixes, so the five bare-binary `clickhouse-local` calls
keep their argv and the three tests read the same.

03267 is the last stateless test that runs `clickhouse` as
`clickhouse-local` in the shared default data directory. On master
587508f, a flaky-check style run (`--test-runs 30 --jobs 8`) of
the master version fails 30/30 with `Code: 76 ... Cannot lock file
.../clickhouse-local/status`; with this change it passes 30/30 and the
shared directory is never created.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-local clickhouse-local / embedded modes (incl. local file processing). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-local clickhouse-local / embedded modes (incl. local file processing). 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.

2 participants