Fix `03315_query_log_privileges_backup_restore` and `test_dictionaries_dependency_xml/test.py::test_get_data` tests by PedroTadim · Pull Request #102195 · ClickHouse/ClickHouse · GitHub
Skip to content

Fix 03315_query_log_privileges_backup_restore and test_dictionaries_dependency_xml/test.py::test_get_data tests#102195

Merged
PedroTadim merged 3 commits into
masterfrom
fix-test5
Apr 11, 2026
Merged

Fix 03315_query_log_privileges_backup_restore and test_dictionaries_dependency_xml/test.py::test_get_data tests#102195
PedroTadim merged 3 commits into
masterfrom
fix-test5

Conversation

@PedroTadim

@PedroTadim PedroTadim commented Apr 9, 2026

Copy link
Copy Markdown
Member

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

...

Documentation entry for user-facing changes

Fixes 03315_query_log_privileges_backup_restore:

With enable_parallel_replicas = 1 injected by CI, the backup operation spawns sub-queries on the parallel replica. These sub-queries are logged in system.query_log with:

The same current_database as the parent backup query
The same query text (inheriting the initial query), so the ILIKE filter matches them
A later event_time than the parent
So ORDER BY event_time DESC LIMIT 1 picked up a sub-query — one that happened to access system.delta_lake_metadata_log_sender — instead of the top-level backup query. The fix adds AND is_initial_query to exclude sub-queries.

Fixes test_dictionaries_dependency_xml/test.py::test_get_data

Where the flake lives: between the dictHas retry and the second INSERT, dep_z's lifetime could fire again while it's still in the "cached=0" state (if the dictHas retry happened to catch dep_x having key 3 right after dep_z's final reload, but dep_z's invalidation epoch wasn't fully committed). In that window, dep_z still has cached=0, and after the second INSERT it sees intDiv(5,4)=1 ≠ 0 → unexpected reload → picks up key 4='ether' → assertion at line 123 fails.

Closes #102034
Closes #101944

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.832

@clickhouse-gh

clickhouse-gh Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Apr 9, 2026
@PedroTadim PedroTadim changed the title Fix flaky tests Fix 03315_query_log_privileges_backup_restore and test_dictionaries_dependency_xml/test.py::test_get_data tests Apr 9, 2026
@PedroTadim PedroTadim enabled auto-merge April 9, 2026 10:34
@alexey-milovidov

Copy link
Copy Markdown
Member

@PedroTadim PedroTadim added this pull request to the merge queue Apr 11, 2026
Merged via the queue into master with commit 22aa124 Apr 11, 2026
161 of 163 checks passed
@PedroTadim PedroTadim deleted the fix-test5 branch April 11, 2026 13:41
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 11, 2026
nihalzp pushed a commit to nihalzp/ClickHouse that referenced this pull request May 17, 2026
The five SELECT/GROUP BY queries (sort × 2, agg × 3) each carried
per-query `SETTINGS` clauses re-pinning
`max_bytes_before_external_sort`,
`max_bytes_ratio_before_external_sort`,
`max_bytes_before_external_group_by`, and
`max_bytes_ratio_before_external_group_by` to the exact same values
that are already pinned at session level by the `SET` statements at
the top of the file.

Session `SET` already overrides the test runner's randomization, so
the per-query `SETTINGS` were redundant noise. Removing them keeps
the session-level pins (the authoritative ones) and leaves only
query-specific settings (`log_comment`, `temporary_files_codec`) on
each query.

Verified by running the test 30 times with randomization
(`-- Tags: long` temporarily removed to allow more iterations):
30/30 passed. `long` tag restored before commit.

Follow-up to ClickHouse#101995 and
ClickHouse#102195, addressing
@azat's request to clean up the test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Flaky test: 03315_query_log_privileges_backup_restore Flaky test: test_dictionaries_dependency_xml/test.py::test_get_data

3 participants