Repository navigation
Backport #109356 to 26.6: Fix data loss when a merge races ALTER RENAME COLUMN on a column without a default expression - #112625
Conversation
…ME COLUMN on a column without a default expression
|
Workflow [BackportPR], commit [7fd1d87] Summary: ✅ |
|
🕵 @groeneai, please investigate this infra failure: Integration tests (amd_asan_ubsan, db disk, old analyzer, 5/6) — it has now hung twice in a row on this PR, at the same point. Evidence that it is a runner-level wedge, not a test failure and not caused by this backport:
I have merged |
|
Thanks for the writeup. I investigated; three corrections and a likely mechanism. 1. It has now failed five times, including on the fresh run you triggered. All four attempts of run 30557613017 wedged on shard 5/6, each on a different instance, and so did the rerun after you merged
Five distinct on-demand instances, so it is not one bad machine, and different runners did not help. For the rerun I can so far only confirm the shape: GitHub marked the job failed at 51.1 min while its 2. The job is finalized about 50 minutes before the runner notices. For attempt 4 the API reports 3. The 60 minutes is not a constant. Measured silences are 59.7 min (attempt 4) and 39.5 min (attempt 3). What is constant is the 49 to 54 min above. Mechanism. All three xdist workers report Why this shard, deterministically: The backport is innocent independently of the sibling branches: What I could not measure: these runs never reach the reporting stage, so there is no dmesg dump and no host memory metrics, and the report node is I will send a PR giving the regular integration job the same host margin as Keeper stress. That also moves the cgroup toward the 33 GiB the harness already budgets, so an overrun becomes a visible container cgroup event the |
|
The PR is open: #112984. One correction to what I promised above. I said I would give the regular integration job the Two behaviour changes worth stating. Worker concurrency now derives from the containers' budget What this does not explain is the concentration on 26.6. The gap it closes is branch-invariant, |
|
Correcting the PR I linked above: #112984 does not work on the CI runners, and the reason is The runners boot with cgroup v1. From an integration job's So This is also why the equivalent block was left commented out in The measured escape I reported earlier stands (a nested child wrote 1900 MiB past a 1500 MiB I have asked on the PR whether the CI team would rather move the runner AMI to cgroup v2 or The 26.6 concentration of the original wedge remains unexplained, as before. |
The integration job runs under an outer `--memory` limit and starts a nested Docker daemon, but its containers were charged outside that limit: under `--cgroupns=host` dockerd parents them at the host's `/docker`, a sibling of the job's cgroup. Measured, a resource-limited child wrote 1900 MiB past a 1500 MiB cap with the job's cgroup at `oom_kill 0`. The limit bounded only the harness, while each test container defaults to 12g, so an overrun starved the host instead of failing the job. The job now asks for `--cgroupns=private`, making its own cgroup the namespace root, and `docker_in_docker.sh` caps three leaves there: `/init` for the harness, `/dockerd` for the daemons, `/docker` for the containers, their sum inside the job limit so a leaf OOMs first. A failed precondition refuses to start the daemon rather than running uncontained. Callers that do not request containment take a byte-identical path. Production is cgroup v1, which needs no `cgroup.subtree_control` but does need the harness migrated into `/init` explicitly, and needs swap limited per leaf or a leaf can exceed its cap by swapping. v2 has a separate `memory.swap.max` that defaults to unlimited, so both versions are limited, and a leaf that cannot be swap-limited refuses unless the host provably has no swap. `/init` holds more than pytest: `helpers/cluster.py` runs each node's `clickhouse-client` and `helpers/iceberg_utils.py` runs Spark's `local` driver on the host rather than in a container, so its cost tracks xdist concurrency. It is a third of the job limit, floored at 8 GiB and capped at 16, which leaves the 59.8 GiB carrier 40 GiB of container budget and costs no worker; at 17 GiB the `--dist=each` plan would drop from 2 to 1. Demand above a cap is never recorded, so each leaf's peak is printed against its cap and flagged when the two are equal. Two behavior changes. Worker concurrency derives from the nested budget rather than host memory, so `--dist=each` drops from 3 workers to 2 - it budgeted 3 x 20 = 60 GiB inside a 40 GiB budget. And an exhausted budget is now reported instead of turning a resource kill into a green job: the killed container's client raises `Connection reset by peer`, which `_mark_infrastructure_errors` relabels `SKIPPED`, and `SKIPPED` counts as successful. Reporting keys on the breached cgroup, so a container reaching its own module's `mem_limit` stays unreported. On v1 a collective `/docker` breach is only visible in dmesg, because the kill is charged to the container and by teardown that cgroup is gone; a run without dmesg says so rather than implying it checked. Related: ClickHouse#112625
The re-dump after the coverage merge used the return value of a best-effort Shell.check nowhere, then reopened ./ci/tmp/dmesg.log unconditionally. A shell redirect truncates the file when it OPENS it, so a command that merely exits non-zero leaves it empty - but a redirect that cannot open the file at all leaves the first scan's dump in place. Rereading that dates the evidence to before the merge, which is the only window this second scan exists to cover, so a /init kill during merge_profraw_files could still reach complete_job unreported. The stale buffer also refilled late_dmesg, which suppressed the dind_unreportable_leaves warning that keys on it being empty. Guarding the read on the command's success is fail-closed without discarding the report: on failure late_dmesg stays empty, so the counters remain the source and the undetectable-leaf warning fires. strict=True was rejected - the call sits before R.sort().complete_job(), which dumps the result and every test row, so raising there would lose the whole report on a transient dmesg failure. The property had no oracle: reverting the guard left all 175 tests green, because the existing late-scan test only pins where the call sits. Added an AST test binding the read to the success check in the job script (kills both a bare reread and a guard whose body does not contain the read) and a test running the real redirect and Shell.check contract over all three outcomes. Related: ClickHouse#112625
Original pull-request #109356
This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.
The PR source
The PR is created in the CI job
Version info
26.6.2.138