Repository navigation
Run the merge queue's stateless flaky check in PR CI too, at comparable concurrency - #112358
Conversation
…le concurrency
`Stateless tests (amd_binary, flaky check)` bounced a PR from the merge queue
with "Test runs too long (> 180s)" for
`04538_final_read_in_order_limit_no_layers`, while all four PR-side flaky checks
were green on the very same test:
job instance (vCPU) workers iters min median max
amd_asan_ubsan m7i.4xlarge (16) 8 50 28.9 35.3 72.5 OK
amd_tsan m7i.8xlarge (32) 18 50 18.7 24.0 54.5 OK
amd_msan m7i.8xlarge (32) 11 50 12.4 15.9 49.5 OK
amd_debug m7i.4xlarge (16) 8 50 28.7 37.4 150.3 OK
amd_binary (MQ) m7i.4xlarge (16) 18 50 33.9 53.4 184.4 FAIL
Two reasons, both addressed here.
The `amd_binary` job took the "plain binary job runs fast; allow higher
concurrency" branch, which sets `nproc` to `cpu_count * 1.2`, so the merge queue
ran the test with 18 workers on a 16-vCPU runner while `amd_asan_ubsan` ran it
with 8 on the identical runner type. That branch is meant for full-suite runs,
where every worker picks a different test and most tests are light. In
flaky-check mode every worker runs the *same* changed test, so `--jobs 18`
multiplies one heavy test (`max_threads = 4`, 500k rows, `FINAL`) by 18, and the
check then fails that test on wall-clock time. The release binary is not slower
than the sanitizer builds - it was running at 2.25x their concurrency. Exclude
flaky and targeted checks from the oversubscription, so per-iteration times, and
with them the `TEST_MAX_RUN_TIME_IN_SECONDS` verdict, are comparable across the
flaky-check jobs. This does not weaken the gate for genuinely slow tests: the
regular suite allows a test 600s, so a test that exceeds 180s only under 18-way
self-contention was not failing anything else.
PR CI had no flaky check on a non-sanitizer build at all, so that configuration
first ran in the merge queue - after the merge had already started. Add
`amd_binary, flaky check` to the PR workflow, on the same build and runner as
the queue's drift guard. The PR-side run is the stricter of the two (50 reruns
and a 45-minute budget against the queue's 20 and 20 minutes), so anything the
queue's flaky check can find is now reported in the PR first. It self-skips on
PRs with no new/changed stateless tests, and `FUNCTIONAL_TEST_FLAKY_CHECK_JOBS`
already listed the job name for the `ci-functional-test-flaky` label.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=gh-readonly-queue/master/pr-110431-f734d6a982d0a985751167970f18622947b3b188&sha=b1e55fcc8253c7a995d7a79f121c8f33b26df714&name_0=MergeQueueCI&name_1=Stateless%20tests%20%28amd_binary%2C%20flaky%20check%29
Related: #110431
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [6303be5] Summary: ✅ AI ReviewSummaryThis PR adds the merge-queue Final Verdict✅ No findings. |
…arity Pulls in the fix for `01666_merge_tree_max_query_limit` under parallel replicas (#112385), which was the only CI failure in this pull request and was failing across hundreds of unrelated pull requests in the same job.
|
🕵 @groeneai, investigate the failure: the This is unrelated to this pull request, which only touches It is a pre-existing flake on |
|
Confirmed, and this one is mine: it is not caused by your pull request, and it is the incomplete-fix recurrence of #110926 (merged 2026-07-20), which covered only some of the read paths that reach the single-value PQ codebook substream. No fix pull request is open yet. I will post the link in this thread and on #112804 as soon as it is up. Public CIDB, restricted to after the #110926 merge commit: 5 failing rows across 4 unrelated pull requests and 0 on master, every row an One refinement on the word flake: the harness minimization on #111093 is deterministic, not intermittent. Rerunning with the same randomized settings failed 16 of 16, rerunning without randomization passed 18 of 18, and the narrowing named Root cause direction. The codebook substream holds one value for the whole part and its granule marks are all zero, so any read path that does not seek it to its own mark before deserializing picks up a sibling codes offset and reads 49152 of 65536 bytes. #110926 added Separately, the private sync artifacts are not readable with my account ( |
|
The fix is in progress and it is your own #112818, opened about an hour before I picked this up. I verified it independently rather than by reading it: I built a binary from One measurement worth recording, since #112818's test does not pin it: the codebook also spans several compressed blocks with the adaptive write buffer off, through I am not opening a competing pull request. I have linked #112818 as the fixing pull request on #111093 and on issue #112804. |
The new PR lane used the same job name as the merge-queue drift guard, so both shared one praktika cache record: records are keyed by `normalize_string(job_name)` plus the job digest (`ci/praktika/cache.py`), and the digest has no workflow or event in it (`ci/praktika/digest.py`). The two lanes are not equivalent - the merge-queue run does 20 iterations with a 20-minute budget, the PR run 50 iterations with a 45-minute budget (`ci/jobs/functional_tests.py`) - so a merge-queue success could satisfy the stricter PR run on a later run of the same digest (and vice versa), and the stronger pre-merge signal would silently not run. Rename the PR lane to `amd_binary, flaky check, pr`. The suffix is only a name: the explicit `command` passes the same `--options` as the merge-queue lane, so the job is configured identically (the option string is validated token by token, so the suffix cannot be part of it).
…arity Conflict in the generated `.github/workflows/pull_request.yml`: the `finish_workflow` `needs:` list gained `build_profile_diff` on master and `stateless_tests_amd_binary_flaky_check_pr` here. Resolved as the sorted union, which is byte-identical to the output of `python3 -m ci.praktika yaml`.
…arity # Conflicts: # .github/workflows/pull_request.yml
…arity Sole conflict was the praktika-generated `.github/workflows/pull_request.yml`: took master's side and regenerated it with `python3 -m ci.praktika yaml`, so the only difference from master is the PR's own `Stateless tests (amd_binary, flaky check, pr)` lane and its entry in the `Finish Workflow` `needs` list.
|
🕵 Status update after merging Public CI: was fully green on the previous head, AI Review
It cannot be caused by this pull request: the change touches only I also brought the private sync branch up to date by hand rather than waiting on another manual-intervention cycle: merged private @groeneai, no fix is needed for an unreproducible one-off, but please keep an eye on |
|
Watch acknowledged, with a caveat up front: I cannot observe this test from the public side, so I cannot evaluate the "recurs on unrelated pull requests" condition myself. Three checks, each with a positive control:
So a recurrence there leaves no trace I can query, and Worth knowing either way: On causation I agree, and the argument is stronger than the two conditions returning the same value: a |
|
LGTM, except for creating a separate job config for PR CI |
Per review feedback from maxknv: drop the separate \`amd_binary, flaky check, pr\` lane with its \`command\` override and run the same \`Stateless tests (amd_binary, flaky check)\` job config in both the PR and merge-queue workflows. Sharing the praktika cache identity is deliberate: a cache hit means the PR changed neither source code nor tests, so skipping the flaky check is correct regardless of which workflow produced the record, and it avoids multiplying job variants. The parity test now matches the merge-queue lane by name and the \`test_pr_and_merge_queue_lanes_have_distinct_cache_identity\` test is removed. \`pull_request.yml\` regenerated with \`python3 -m ci.praktika yaml\`. Co-Authored-By: Claude Fable 5 <[email protected]>
|
🕵 Status update on the current head @maxknv's review is addressed — both threads plus Sharing the config does not weaken the PR-side run: the 50-vs-20 iteration count and the 45-vs-20-minute budget are decided at run time from Public CI is green on this head. Every commit-status context is Verified locally against current One unrelated red sub-result, non-blocking — the It cannot be caused by this pull request, which touches no C++ and no build configuration, and it is not specific to it either. Public CIDB,
(the distinct count includes @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112358&sha=5fd2f809b91058b805c8e8889d3f2d844b8570dd&name_0=PR&name_1=Build%20(arm_release) and provide a fix in a separate pull request. If the fix is already in progress, link it here. I could not find an open issue for this signature, so a tracking issue is worth opening too. Note that it is invisible at the job level — |
|
Investigated. Three findings, one of which corrects the premise. 1. This head predates both retry fixes, so it is not the post-fix residual. The branch's merge 2. The signature that survives both fixes has a repo-side root cause, and it reproduces. while ((value == 0 || old_value < value) && !hard_limit.compare_exchange_weak(old_value, value))
Reproduced locally with profile
3/3 on the race arm, and the query carrying the override is the one killed every time. So it is not infra-only: raising the 3. A tracking issue already exists: #113408, yours, open, labelled Your visibility point is confirmed by the report: |
…arity # Conflicts: # .github/workflows/pull_request.yml # base/base/defines.h # docs/_migration/slug-map.csv # docs/_site/customizations/settings-legacy-routes/format-settings.js # docs/_site/customizations/settings-legacy-routes/session-settings.js # docs/_specs/cloud-openapi.json # docs/products/bring-your-own-cloud/configuration/connect.mdx # docs/reference/engines/database-engines/mysql.mdx # docs/reference/settings/formats/manifest.json # docs/reference/settings/merge-tree-settings/manifest.json # docs/reference/settings/session-settings/manifest.json # docs/reference/system-tables/trace_log.mdx # docs/snippets/components/FormatSettingsExplorer/FormatSettingsExplorer.jsx # docs/snippets/components/MergeTreeSettingsExplorer/MergeTreeSettingsExplorer.jsx # docs/snippets/components/SessionSettingsExplorer/SessionSettingsExplorer.jsx # src/DataTypes/NestedUtils.cpp # src/Parsers/FunctionSecretArgumentsFinder.h # src/Processors/QueryPlan/Optimizations/applyParallelReplicas.cpp # src/Storages/TimeSeries/PrometheusQueryToSQL/fromFunctionTime.cpp # src/Storages/TimeSeries/PrometheusQueryToSQL/fromFunctionTime.h # tests/integration/helpers/spark_tools.py # tests/queries/0_stateless/04650_replace_cancellation.sh
The comments added when the PR-side lane started reusing `JobConfigs.stateless_tests_flaky_mq_jobs` claimed that sharing the job config also shares the praktika cache identity, so that a cache hit in either workflow may skip the other. That is not what happens. `Digest.calc_job_digest` hashes the job config *after* per-workflow mangling, and the `PR` workflow mangles it differently from `MergeQueueCI`: `runs_on_label_prefix="pr-"` turns `amd-medium` into `pr-amd-medium`, and the two workflows give the job different `run_after` lists. Neither field is in the digest's `drop_fields`, so the config half of the digest differs - `29d4` for `PR` against `fe9f` for `MergeQueueCI` - and `ci/praktika/cache.py`, which keys a record by job name and digest, never lets one lane's record satisfy the other's lookup. That separation is what keeps the change safe, so it is now stated as such and pinned by a test. If the digests ever did coincide, the PR's green run would satisfy the merge-queue lookup and the queue would skip the check as reused from cache - silently disabling the drift guard, whose entire purpose is to exercise the merge group state (the PR merged with the current `master`) that the PR-side run never saw. `test_pr_run_does_not_cache_away_the_merge_queue_drift_guard` computes both digests through `_get_workflows` so the mangling is applied. The file-content half of the digest comes from the single `digest_config` both lanes share and is equal by construction, so it is stubbed out to keep the test from hashing `tests/queries` twice; only the config half, which is what is under test, is compared.
|
🕵 Status update on the new head Merged Corrected a factual error in this pull request's own comments, and pinned what they got wrong. When the PR lane started reusing
That separation is what makes sharing the config safe: if the digests did coincide, the pull request's green run would satisfy the merge queue's lookup and the queue would skip the check as reused from cache - silently disabling the drift guard, whose entire purpose is to exercise the merge group state (the pull request merged with the current Verified on the merged tree: @maxknv, the behaviour you asked for is unchanged from the head you reviewed - one job config for both workflows. The only difference is that the justification is now accurate and tested. Could you take another look? Incidentally, the docker digest never reaches this job's cache key at all: |
…arity # Conflicts: # .github/workflows/pull_request.yml
|
🕵 Addendum: |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units9 translation units recompiled, 46 s compile time in total, 9 of them have a recent master baseline. |
|
Investigated. Two corrections and one decision I need from you both. First, my earlier comment here said the fix would bound the INSERT with a per-query Second, the failure is already fully diagnosable in the log: What is left is a policy question I do not want to answer unilaterally, because @maxknv already ruled on it on #108294 and I agreed with him at the time. His ruling rested on the failure still being visible: "only the separate So the two options, and I will implement whichever you pick:
One data point for option 3, reducing the workload, which was @maxknv's own preference: #108294 shipped the No new issue needed: #113408 already tracks this signature. I can add the shared-tracker mechanism there if useful. |
A merge group is the pull request merged with the current main branch, so a cache record whose digest was produced on main describes identical inputs for that job and is safe to reuse. Allow merge_queue workflows to reuse both same-branch records and main-branch records. This does not reopen the drift guard: a pull_request's record lives on a different branch and is still never reused by merge_queue, and a pull request that changed the flaky check's inputs (its tests) produces a different digest, so no main-branch record matches and the check still runs against the merge group state. Add a `Workflow.Config.is_event_merge_queue` helper for the check. Related: #112358 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace the branch-based reuse rule with an event-based one. Branch was
only ever a proxy for how much a record can be trusted; the producing
workflow event is the direct signal, so account for it instead and ignore
the branch entirely in the reuse decision.
`CacheRecord` now carries the producing event (`Workflow.Event.*`). Reuse
rule: a `pull_request` workflow reuses any record; every other event
(`push`, `schedule`, `dispatch`, `merge_queue`) reuses any record except
one produced by a `pull_request`. The write side is the dual: a
`pull_request` run only fills an empty (job, digest) slot, every trusted
event overwrites it.
This keeps both properties the branch rule aimed at, and more directly:
* Security - a trusted lane never reuses an untrusted PR-produced record.
* Drift guard - `merge_queue` never reuses a `pull_request` record, so the
PR's flaky-check result can't skip the queue's re-run, independent of
whether the two digests happen to coincide.
It also removes the release-branch clobbering hole: reuse no longer checks
the branch, so a record produced by a release-branch push (or any trusted
event) is reused whenever the digest matches, instead of being rejected on
a `record.branch == MAIN_BRANCH` mismatch.
Bump `CACHE_VERSION` to 2 so pre-existing records, which lack the event
field, are not reused under the new rule. Drop the now-unused
`is_event_merge_queue` helper.
Related: #112358
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Previously only `push` workflows were restricted to reusing a cache record produced on the same branch; `schedule`, `dispatch`, and `merge_queue` could reuse a record from any branch, including a green `pull_request` record. That let a pull request's cached result satisfy the merge queue's lookup and skip a job the queue must re-run against the merged-with-`master` state (the drift guard from ClickHouse#112358). Invert the reuse gate: only `pull_request` may reuse a record from any branch; every other event (`push`, `schedule`, `dispatch`, `merge_queue`) reuses only a record produced on the same branch. Make the write side its symmetric dual: only `push`, which produces the canonical default-branch record, may overwrite an existing record. Every other event writes only into an empty slot (`if_not_exist=True`), so a narrow-branch record never clobbers the `push`/`master` record that both `push` (same branch) and `pull_request` (any branch) can reuse. Related: ClickHouse#112358 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The merge-queue drift guard no longer relies on the PR and merge-queue lanes computing distinct praktika cache digests - the branch-based reuse gate in `ci/praktika/hook_cache.py` now preserves it (a `merge_queue` run only reuses a same-branch record, so a pull request's record never satisfies the queue's lookup). Remove the now-incorrect comment that justified keeping the digests distinct, trim the matching note in the PR workflow, and drop `test_pr_run_does_not_cache_away_the_merge_queue_drift_guard` which pinned that distinctness. Related: ClickHouse#112358 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Related: #110431
Related: #110308
Stateless tests (amd_binary, flaky check)bounced a pull request from the merge queue with "Test runs too long (> 180s)" for04538_final_read_in_order_limit_no_layers, while all four flaky checks in that pull request's own CI were green on the very same test:amd_asan_ubsanamd_tsanamd_msanamd_debugamd_binary(merge queue)Two reasons, both addressed here.
The release build is not slower than the sanitizer builds - it ran at 2.25x their concurrency. The
amd_binaryjob takes the "plain binary job runs fast; allow higher concurrency" branch, which setsnproctocpu_count * 1.2, so the merge queue ran the test with 18 workers on a 16-vCPU runner whileamd_asan_ubsanran it with 8 on the identical runner type. That branch is meant for full-suite runs, where every worker picks a different test and most tests are light. In flaky-check mode every worker runs the same changed test, so--jobs 18multiplies one heavy test (max_threads = 4, 500k rows,FINAL) by 18, and the check then fails that test on wall-clock time. Exclude flaky and targeted checks from the oversubscription, so per-iteration times, and with them theTEST_MAX_RUN_TIME_IN_SECONDSverdict, are comparable across the flaky-check jobs. This does not weaken the gate for genuinely slow tests: the regular suite allows a test 600s, so a test that exceeds 180s only under 18-way self-contention was not failing anything else.PR CI had no flaky check on a non-sanitizer build at all, so that configuration first ran in the merge queue - after the merge had already started. Add
amd_binary, flaky checkto the pull request workflow, on the same build and runner as the queue's drift guard. The PR-side run is the stricter of the two (50 reruns and a 45-minute budget against the queue's 20 and 20 minutes), so anything the queue's flaky check can find is now reported in the pull request first. It self-skips on pull requests with no new or changed stateless tests, andFUNCTIONAL_TEST_FLAKY_CHECK_JOBSalready listed the job name for theci-functional-test-flakylabel.Per review, the PR lane is not a separate job config:
ci/workflows/pull_request.pyspreads the very sameJobConfigs.stateless_tests_flaky_mq_jobsthatci/workflows/merge_queue.pyuses, so the two lanes cannot drift apart. That does not merge their praktika cache records, and it must not:ci/praktika/cache.pykeys a record by job name and digest with no workflow in the path, so if the digests coincided the pull request's green run would satisfy the merge queue's lookup and the queue would skip the check as reused from cache - silently disabling the drift guard, whose whole point is to exercise the merge group state the pull-request run never saw. They stay separate becauseDigest.calc_job_digesthashes the job config after per-workflow mangling, and thePRworkflow mangles it differently:runs_on_label_prefix="pr-"turnsamd-mediumintopr-amd-medium, and the two workflows give the job differentrun_afterlists. Neither field is in the digest'sdrop_fields, so the config half of the digest is29d4forPRagainstfe9fforMergeQueueCI.ci/tests/test_flaky_check_pr_parity.pypins all of it: that every merge-queue flaky check has a PR-side counterpart with the same build, runner and command; that flaky and targeted checks no longer oversubscribe while the full-suite binary jobs still do; and that the two lanes' cache digests stay distinct.CI report for the merge-queue failure above: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=gh-readonly-queue/master/pr-110431-f734d6a982d0a985751167970f18622947b3b188&sha=b1e55fcc8253c7a995d7a79f121c8f33b26df714&name_0=MergeQueueCI&name_1=Stateless%20tests%20%28amd_binary%2C%20flaky%20check%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog.
Version info
26.8.1.1285(included in26.8and later)