Repository navigation
Isolate test_dictionaries_all_layouts_separate_sources dictionary configs per worker - #103837
Merged
Merged
Conversation
…figs per worker
When `Integration tests (..., targeted)` or flaky-check jobs run, the integration
test runner uses `--dist=each`, which makes every pytest-xdist worker execute
the same test module concurrently with its own isolated `ClickHouseCluster`.
Cluster project names and instance directories already include the worker id
(e.g. `-gw0`), but `BaseLayoutTester.get_dict_directory` returned a single
worker-shared path:
tests/integration/test_dictionaries_all_layouts_separate_sources/
configs/dictionaries/<test_name>/
Multiple workers therefore raced on `cleanup`, `create_dictionaries`, and
`list_dictionaries` for the same on-disk directory. A typical losing
interleaving:
1. Worker A writes its dictionary XMLs.
2. Worker B's `simple_tester.cleanup` calls `shutil.rmtree` on the same dir.
3. Worker A's `started_cluster` calls `simple_tester.list_dictionaries`,
which now sees only Worker B's partially-written files (or none at all).
4. Worker A's cluster starts without the expected dictionaries, and
`dictGet('MongoDB_<layout>_', ...)` later fails server-side with
`Code: 36. DB::Exception: Dictionary (MongoDB_direct_) not found.`
CIDB shows this pattern across `test_mongo.py::test_simple_ssl[*-True]`
(direct/cache/hashed/flat) failing together in `Integration tests
(amd_asan_ubsan, targeted)` runs.
Fix: append `PYTEST_XDIST_WORKER` to the dictionary directory name (mirroring
how `ClickHouseCluster` already isolates its `project_name` and
`instances_dir_name`), so each worker writes to its own directory and the
race goes away. When the env var is unset (single-worker local runs), the
path is unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [e25922f] Summary: ✅ AI ReviewSummaryThis PR isolates dictionary config directories per ClickHouse Rules
Final VerdictStatus: ✅ Approve |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
Integration tests (..., targeted)and flaky-check jobs, every pytest-xdist worker runs the same test module concurrently with its own isolatedClickHouseCluster. Cluster project names and instance directories already include the worker id (e.g.-gw0), butBaseLayoutTester.get_dict_directoryreturned a single worker-shared path:Multiple workers therefore raced on
cleanup,create_dictionaries, andlist_dictionariesfor the same on-disk directory. A typical losing interleaving:simple_tester.cleanupcallsshutil.rmtreeon the same directory.started_clustercallssimple_tester.list_dictionaries, which now sees only Worker B's partially-written files (or none at all).dictGet('MongoDB_<layout>_', ...)later fails server-side withCode: 36. DB::Exception: Dictionary (MongoDB_direct_) not found.CIDB shows this pattern across
test_mongo.py::test_simple_ssl[*-True](direct/cache/hashed/flat) failing together inIntegration tests (amd_asan_ubsan, targeted)runs — characteristic of a shared-setup race, not a per-test bug.Fix: append
PYTEST_XDIST_WORKERto the dictionary directory name (mirroring howClickHouseClusteralready isolates itsproject_nameandinstances_dir_name), so each worker writes to its own directory and the race goes away. When the env var is unset (single-worker local runs), the path is unchanged.Follow-up to #102734.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Version info
26.5.1.238