Skip to content

Split 03814_system_unload_dictionary into parallel-safe and no-parallel tests - #111773

Merged
alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
groeneai:groeneai-03814-drop-no-parallel
Jul 28, 2026
Merged

alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
groeneai:groeneai-03814-drop-no-parallel

Conversation

@groeneai

Copy link
Copy Markdown
Collaborator

Related: #109639

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

...

Description

SYSTEM UNLOAD DICTIONARIES (plural) is server-global: it unloads dictionaries of other concurrently-running tests, so 03814_system_unload_dictionary needed no-parallel. The singular SYSTEM UNLOAD DICTIONARY name is database-scoped and parallel-safe.

Split the test so most of it can run in parallel:

  • 03814_system_unload_dictionary keeps the database-scoped singular commands (load / unload / lazy reload / explicit reload / idempotent unload / error case) and drops no-parallel.
  • 03814_system_unload_dictionaries (new) holds the two server-global SYSTEM UNLOAD DICTIONARIES cases and keeps no-parallel.

Verified on a debug build: the parallel part passes 50/50 with randomization and 0/480 under 12-way self-parallel stress; without the split, dropping no-parallel flakes ~10% (a sibling copy's global unload clears this copy's dictionary between the lazy load and the status check).

groeneai and others added 2 commits July 24, 2026 10:51
…el tests

SYSTEM UNLOAD DICTIONARIES (plural) is server-global: it unloads
dictionaries owned by other concurrently-running tests, which is why
03814_system_unload_dictionary required the no-parallel tag. The singular
SYSTEM UNLOAD DICTIONARY name is database-scoped and parallel-safe.

Move the two server-global SYSTEM UNLOAD DICTIONARIES cases into a new
03814_system_unload_dictionaries test that keeps no-parallel, and drop
no-parallel from 03814_system_unload_dictionary, which now exercises only
the database-scoped singular commands and runs in parallel. All existing
coverage is preserved: the parallel test keeps its LOADED/NOT_LOADED status
transitions because, once the global command is split out, no parallel-batch
test issues a global unload.

Related: ClickHouse#109639

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@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; 3 findings; bounded: 1 full pass + 1 fix round + 1 delta recheck; delta recheck: 0 new findings).

# Sev Finding Verdict Evidence / action
1 ⚠️ Parallel-safety claim needs reproducible both-direction stress evidence (SQL oracle can't detect tag restoration) AGREE — evidence provided Both directions on a debug build: naive no-split (plural kept + no-parallel dropped) = 24/240 (~10%) self-parallel FLAKE (LOADED->NOT_LOADED); split parallel test = 0/480 (12-way x 40). Runner, randomization ON: parallel test 50/50, no-parallel test 50/50 (runs in the sequential runner). Negative control is the naive-no-split run itself.
2 💡 New test reuses prefix 03814 instead of a fresh number from add-test DISAGREE Shared numeric prefixes are the norm, not a violation: 03814 already had 6 distinct tests; 04033 has 114, 02346 102. add-test only computes LAST_TEST_NO+1 as a convenience and is not enforced. Keeping ..._dictionary (singular) and ..._dictionaries (plural) under one prefix intentionally groups the split pair.
3 💡 PR body used abbreviated Related: #109639 instead of the full GitHub URL required by the template AGREE — fixed PR body now uses the full URL https://github.com/ClickHouse/ClickHouse/pull/109639 (still renders as a visible cross-reference link).

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

Session id: cron:clickhouse-author-slot-1:20260724-102200

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. self_parallel_stress.sh runs N concurrent copies (each in its own random DB) and diffs each against the reference. Naive no-split (plural kept, no-parallel dropped) reproduces the flake on demand (24/240, ~10%).
b Root cause explained? SYSTEM UNLOAD DICTIONARIES (plural) -> ExternalDictionariesLoader::unloadAllDictionaries() -> ExternalLoader::unloadAll() iterates ALL loader infos with no database filter (server-global). A sibling copy's plural unload clears this copy's db-scoped dict between its lazy dictGet load and the following status SELECT, so a LOADED assertion reads back NOT_LOADED. The singular SYSTEM UNLOAD DICTIONARY name is database-scoped and safe.
c Fix matches root cause? Yes. Split the server-global plural command into its own no-parallel test; leave only db-scoped singular commands in the parallel test. Targets the exact mechanism (the global command), not a symptom. This is the PR author's chosen approach (#109639).
d Test intent preserved / new tests added? Yes. No coverage lost: the parallel test keeps all LOADED/NOT_LOADED transitions, dictGet values, lazy reload, explicit reload, idempotent double-unload, and the BAD_ARGUMENTS error; the new no-parallel test covers both plural server-global cases.
e Both directions demonstrated? Yes. Naive no-split = 24/240 (~10%) FLAKE; split parallel test = 0/480 under 12-way self-parallel; both tests 50/50 via the real runner with randomization ON.
f Fix is general across code paths? N/A — test-only change, no source code bug. Both existing plural cases were moved (none left behind in the parallel test).
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A — test-only change, no type-gating source code.
h Backward compatible? (maintainer-approved exception only) N/A — test-only change, no setting/format/behavior change.
i Invariants and contracts preserved? Yes. No source touched. The parallel test is parallel-safe by construction (only db-scoped commands, each run in its own DB); the new test keeps no-parallel for the unavoidable server-global command, matching the codebase convention for every stateless test issuing a global dictionary command (00950, 01036, 01501, 02179, 03835, 04117).

Session id: cron:clickhouse-author-slot-1:20260724-102200

@groeneai

Copy link
Copy Markdown
Collaborator Author

@Manerone this is the split you asked for: 03814_system_unload_dictionary keeps the database-scoped singular SYSTEM UNLOAD DICTIONARY cases and runs in parallel, and the new 03814_system_unload_dictionaries holds the two server-global SYSTEM UNLOAD DICTIONARIES cases with no-parallel. Could you review?

@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Jul 24, 2026
@Manerone Manerone self-assigned this Jul 24, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ee7d5e7]

Summary: ✅


AI Review

Summary

This PR splits 03814_system_unload_dictionary into a parallel-safe test for the database-scoped SYSTEM UNLOAD DICTIONARY path and a new no-parallel test for the server-global SYSTEM UNLOAD DICTIONARIES path. I reviewed the current diff, prior discussion, and the implementation path in InterpreterSystemQuery / ExternalDictionariesLoader; the split preserves the original assertions, keeps the bot-raised mixed global-then-singular unload check, and matches the actual scope difference between the singular and plural commands. I found no remaining correctness or coverage regressions in the current version.

Final Verdict

✅ No new findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 24, 2026
Manerone asked to turn the section-header comments into SELECT queries so the
reference file reads cleanly; apply that to both split tests.

The clickhouse-gh bot noted the split dropped the mixed
SYSTEM UNLOAD DICTIONARIES -> SYSTEM UNLOAD DICTIONARY assertion (verifying a
dictionary already unloaded server-wide is still idempotently unloadable via the
singular path). Restore that assertion at the end of the second global-unload
block in the no-parallel test.

Related: ClickHouse#109639

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

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

Pre-publication review of commit eaf8d3b (review-fix delta) by an independent model (engine: codex; delta re-review over the whole PR change): 0 findings.

# Sev Finding Verdict Evidence / action
— — (none) — Delta review returned 0 findings.

Change: turned section-header comments into SELECT queries in both split tests (@Manerone), and restored the mixed SYSTEM UNLOAD DICTIONARIES -> SYSTEM UNLOAD DICTIONARY idempotent-unload assertion in the no-parallel test (clickhouse-gh bot). Diff = 4 test files, no source/config/submodule drift.

@Manerone Manerone removed their assignment Jul 24, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — eaf8d3b

Every failure below has an owner. This PR only splits 03814_system_unload_dictionary into a parallel-safe half and a no-parallel half; it touches no other test.

Check / test Reason Owner
Stateless tests (amd_asan_ubsan, distributed plan, parallel) / 02477_single_value_data_string_regression chronic trunk flaky (48 unrelated PRs / 51 hits / 2 master, 30d); not touched by this PR's dict-unload test split a fix task is created (investigating at full effort — fixing-PR link to follow here)
CH Inc sync — CH Inc sync (private, not actionable)

Mergeable Check / PR are aggregators reflecting the single sub-check above.

Session id: cron:our-pr-ci-monitor:20260724-180000

@Manerone

Copy link
Copy Markdown
Contributor

@groeneai merge master into the PR

@groeneai

Copy link
Copy Markdown
Collaborator Author

@Manerone done - merged current master into the PR (ee7d5e75a7a222d12ffe022f55b4e35f549b531a, 748 commits picked up). Thanks for the approval.

The merge is content-preserving: the four test files are byte-identical to the approved state (03814_system_unload_dictionary.{sql,reference}, 03814_system_unload_dictionaries.{sql,reference}), the diff against master is still only those four files, and the submodule pins now match master exactly. CI is re-running.

@groeneai

Copy link
Copy Markdown
Collaborator Author

Discharging the open owner line from my CI finish ledger above (02477_single_value_data_string_regression).

Fixing PR: #110632 (@ alexey-milovidov, open) - it relaxes exactly the assertion that fails here.

Correcting my own ledger's reason column while I am at it: I wrote "chronic trunk flaky", which understates it. The failure is deterministic under memory pressure, not random. The failing statement is

SELECT '2^31-1', maxMerge(x) FROM (SELECT CAST(unhex('ffffff7f') || randomString(100500), 'AggregateFunction(max, String)') AS x); -- { serverError CANNOT_READ_ALL_DATA }

ffffff7f little-endian is 0x7fffffff, so the state declares a ~2 GiB string while carrying ~100 KB. SingleValueDataString::read (src/AggregateFunctions/SingleValueData.cpp) allocates the declared size before discovering the data is short, so on a memory-capped shard with co-scheduled aggregates the allocation trips the memory tracker and the query returns MEMORY_LIMIT_EXCEEDED (241) instead of CANNOT_READ_ALL_DATA (33). Both outcomes reject the corrupted state correctly; only the error code differs. That is why CI's own diagnosis reports it failing with randomization both on and off rather than as a random flake.

#110632 accepts either error code, since the property under test is that a corrupted state is rejected. The preallocation itself stays on master by the maintainer's explicit decision when he closed the read-path variant #110630 ("not worth complicating the hot read path"). Still unmerged as of now, so recurrences on this PR are expected until it lands.

Unrelated to this PR's diff, which only splits 03814_system_unload_dictionary into a parallel-safe half and a no-parallel half.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — ee7d5e7

CI is fully finished on the post-master-merge head and it is green: 174 check-runs, none
queued or running, Finish Workflow successful at 13:16:39Z, and result_pr.json reports a
top-level status of OK with zero non-OK leaves. CIDB shows no FAIL/ERROR subtest rows on
this commit.

So there is nothing to own on this head: the 02477_single_value_data_string_regression line
from the earlier eaf8d3bd5d1f ledger did not recur (its owner remains #110632).

Session id: cron:our-pr-ci-monitor:20260727-143000

Merged via the queue into ClickHouse:master with commit 6da869e Jul 28, 2026
178 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 28, 2026
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 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.

5 participants