Repository navigation
Preserve the previous cluster incarnation's docker.log when an integration fixture restarts - #119766
Conversation
A package-scoped integration fixture that is torn down and re-set-up inside one pytest session constructs a new ClickHouseCluster, and the constructor removes instances_dir. docker.log lives there and is reopened "w+" at the end of every start(), so each rebuild destroys the previous incarnation's container output and the exit code each container took. On master 11f0dc8, Integration tests (amd_msan, 8/8) rebuilt gw0's cluster 8 times and reported 13 azure Iceberg FAILs from incarnation 1. logs.tar.gz shipped incarnation 8: its docker.log starts 36 minutes after the last failure, on a different azurite port, with nothing marking it as a different cluster. That job built 61 incarnations across 7 projects and deleted 54. The trigger itself was a general protection fault in the azurite emulator's musl loader, which docker.log would have named directly through its container exit code. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=11f0dc839f845a3b866eddfd16360061f8bdeb2c&name_0=MasterCI&name_1=Integration%20tests%20%28amd_msan%2C%208%2F8%29 Move docker.log into a sibling <instances_dir>-prev-logs/docker.<N>.log before both statements that delete instances_dir, the constructor and start()'s else branch. The retention directory is cleared once per process, never per rebuild, so a directory left behind by a previous process is discarded rather than filed as this session's. Both existing log collectors already match the sibling because its name still begins with _instances, and norecursedirs = _instances* already excludes it from collection. 7,945 bytes per incarnation. Co-Authored-By: Claude Opus 5 <[email protected]>
Two of the three rules the previous commit added were not actually exercised. Every start() in the first version of the test followed a construction that had just removed instances_dir, so start()'s existing-directory branch - the second place that deletes it - was never reached. The test now restarts one cluster object instead of only constructing new ones, which is also the shape that makes --dist=each rebuild a module-scoped fixture. The process-scoped clearing of the retention directory was equally unexercised: a clean checkout has nothing to clear, so the assertion held with the whole clearing branch deleted. The stale directory is now planted by the test itself, under ordinal 9, so that renaming it rather than discarding it cannot satisfy the ordinal assertions. The retained bytes are compared in binary mode over the whole captured content rather than as 200 decoded characters: two independent errors="replace" reads of a file that is still being appended to decode a split multi-byte sequence differently. The comparison stays startswith rather than equality because the log follower is SIGKILLed without a wait(), so an in-flight write can still land between the read and the move. Finally, the cluster name is now unique per invocation, because the retention directory is keyed by that name and pytest --count N repeats inside one process, where the clearing fires only for the first repeat. Deriving the retention path from get_instances_dir duplicates the naming in __init__, so the derivation is pinned against cluster.instances_dir right after the first construction. Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex). Round 1: 4 findings. Round 2, re-reviewing the fix round: 0 findings.
Also noticed and deliberately not changed: Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20260913-091400 |
|
Workflow [PR], commit [48d1771] Summary: ✅ AI ReviewSummaryThis PR preserves a previous cluster incarnation's Findings
Final Verdict
|
|
@groeneai, I've deleted tests for the test infrastructure. Remember this decision. |
|
Noted. I won't add tests for changes to the test infrastructure itself (integration test helpers, the test runner, CI scripts) from now on. |
… logs cluster outage When the read-only sub-service of the CI logs cluster stops answering, every `SELECT 1` readiness probe of `LogCluster.select` raises `requests.exceptions.ReadTimeout`. `is_ready` turned that into a bare False without a `probe_error`, so `select` raised `LogClusterNotReady`, which `build_profile_diff_job.main` does not catch, and the check went red on unrelated PRs (8 of them on 2026-11-06 between 00:00Z and 02:52Z, e.g. job 127646247697 of ClickHouse#129611). The same outage hitting a POST already ends `LogClusterUnavailable` (ClickHouse#121048), and so does a probe the server rejects with 241 (ClickHouse#128067). A probe that raises `ReadTimeout` now records `LogClusterUnavailable` in `probe_error`, and the tail added by ClickHouse#128067 reports the read green as "the endpoint never became ready: the readiness probe timed out: ...". The last probe decides, as there. A `ReadTimeout` (requests 2.33.0, the CI pin) is raised only after the name resolved and a server accepted the connection: a stalled TLS handshake or a stalled answer. Connection refused, an unresolvable name, no SYN-ACK and a certificate mismatch raise `ConnectionError` (`ConnectTimeout` and `SSLError` are subclasses), and the server itself rejects a rotated password with 516. All of those, a missing secret and a gateway answer still end `LogClusterNotReady`, as ruled on ClickHouse#120288. This is the `SELECT 1`-timeout leg left open on ClickHouse#121048. Validated with a throwaway harness against master (real sockets, mocked transport and `main()` end to end); only the probe-timeout cases change. No test is committed for the CI scripts (ClickHouse#119766). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Integration tests keep the
docker.logof a cluster incarnation replaced by a fixture restart.Description
CI report (no related open issue found):
Integration tests (amd_msan, 8/8), master11f0dc83.That job reported 13 FAILs, all
azureparametrizations oftest_storage_iceberg_with_spark, while 108 otherazureparametrizations in the same job passed. Worker gw0's azurite emulator took a general protection fault inside musl (dmesg:traps: node[97065] general protection fault ... in ld-musl-x86_64.so.1, and its veth went down), so those tests ran 20 minutes against a dead blob endpoint. The emulator is third party and out of scope; replacing it is settled (#95967, reverted by #100618).What is fixable here: the evidence was destroyed. A package-scoped fixture re-set-up inside one pytest session constructs a new
ClickHouseCluster, whose constructor removesinstances_dir, wheredocker.loglives. gw0's cluster was rebuilt 8 times, sologs.tar.gzshipped only the last incarnation: the collecteddocker.logstarts 36 minutes after the last failure, on a different azurite port. That job built 61 incarnations across 7 projects and deleted 54.docker.lognames the culprit: it carries every service prefix plus each container's exit code.So this moves
docker.logaside instead of deleting it, at both statements that deleteinstances_dir, into a sibling<instances_dir>-prev-logs/docker.<N>.log. The retention directory is cleared once per process, never per rebuild. Both log collectors already pick it up: the on-error hook by the_instancesprefix, the normal path because it sits inside the failing suite's directory.norecursedirs = _instances*already keeps it out of pytest discovery. Cost: 7,945 bytes per incarnation. Noci/scheduling or caching is touched, and no existing test changes. No dedicated test is added, because this changes the test infrastructure itself.Not addressed: the musl fault; mid-package support-container liveness; earlier incarnations' per-node server logs, still deleted (retaining them measures ~2.7 GB per job, so that is your call); and the
minio/kafka/rabbitmqfailure-path dumps, which log the same compose project and duplicate the preserved file.Workflow [PR]
Sync PR [sync-upstream/pr/119766]
Version info
26.10.1.2152-master(included in26.10and later)