Skip to content

Backport #107693 to 25.8: Length-encode the info field of the MySQL OK packet - #107889

Merged
alexey-milovidov merged 4 commits into
25.8from
backport/25.8/107693
Jul 2, 2026
Merged

alexey-milovidov merged 4 commits into
25.8from
backport/25.8/107693

Conversation

@robot-ch-test-poll4

@robot-ch-test-poll4 robot-ch-test-poll4 commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #107693
Cherry-pick pull-request #107819

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

  • Merged into: 25.8.26.10

@robot-ch-test-poll4 robot-ch-test-poll4 added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default labels Jun 18, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [074bd32]

@alexey-milovidov

Copy link
Copy Markdown
Member

Refreshed this backport: merged the current 25.8 into the branch (it was ~12 days / 28 commits behind the base) and pushed. The net diff versus 25.8 is byte-identical to the original #107693 — only src/Core/MySQL/PacketsGeneric.cpp (always length-encode the info field of the OK packet) and ci/docker/integration/mysql_java_client/Dockerfile (bump Connector/J to 9.7.0); the merge did not touch either file.

The previous red checks Dockers Build (amd) / Dockers Build (arm) were not caused by this PR. Both failed while resolving the unchanged base image at FROM openjdk:8-jdk-alpine:

#3 ERROR: unexpected status from HEAD request to
http://dockerhub-proxy.dockerhub-proxy-zone:5000/v2/library/openjdk/manifests/8-jdk-alpine?ns=docker.io: 500 Internal Server Error

This is a transient dockerhub-proxy 5xx fetching a base image on a line the PR does not modify (the PR only changes ARG ver). The mysql-java-client image was rebuilt at all only because the Dockerfile change altered its digest. Pushing the base merge re-runs BackportPR on a fresh SHA, which should clear the transient failure.

…eclipse-temurin:21-jdk-alpine`

The `Dockers Build (amd)`/`Dockers Build (arm)` jobs failed because the
`clickhouse/mysql-java-client` image (rebuilt here due to the `Connector/J`
bump) still used the deprecated `openjdk:8-jdk-alpine` base, which the CI
`dockerhub-proxy` can no longer serve:

    failed to resolve source metadata for docker.io/library/openjdk:8-jdk-alpine:
    unexpected status from HEAD request to .../openjdk/manifests/8-jdk-alpine: 500 Internal Server Error

The failure is deterministic (it reproduced identically on a re-run ~2.5h
later), not a transient flake.

On `master` the base image had already been migrated to
`eclipse-temurin:21-jdk-alpine` (and `CLASSPATH` set to `.:`) in an earlier
commit that was never backported to `25.8`; #107693 was developed and verified
on top of that. The cherry-pick brought only the `Connector/J` 9.7.0 bump,
leaving `25.8` on the broken base image, so its image could not be rebuilt.

Align the `25.8` Dockerfile with the verified `master` configuration. Verified
locally: the image builds, the `Connector/J` 9.7.0 jar downloads, and
`MySQLJavaClientTest.java` (identical to `master`) compiles under JDK 21.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=107889&sha=29e01838604f8a31671c7090e7ebcfa725b2a192&name_0=BackportPR&name_1=Dockers%20Build%20%28amd%29

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

Pushed a fix for the Dockers Build (amd) / Dockers Build (arm) failures (commit 0cc91d3e60e).

Correction to my earlier comment: the failure is not a transient dockerhub-proxy flake. I re-ran both jobs ~2.5h later and they failed identically — the proxy consistently returns 500 Internal Server Error for the deprecated openjdk:8-jdk-alpine base image, which Docker Hub no longer serves reliably:

failed to resolve source metadata for docker.io/library/openjdk:8-jdk-alpine:
unexpected status from HEAD request to .../openjdk/manifests/8-jdk-alpine: 500 Internal Server Error

Root cause: on master the mysql-java-client base image was migrated from openjdk:8-jdk-alpine to eclipse-temurin:21-jdk-alpine (with CLASSPATH set to .:) in an earlier commit that was never backported to 25.8. #107693 was developed and verified on top of that migration. The cherry-pick here brought only the Connector/J 9.7.0 bump, leaving 25.8 on the broken base image. Because the Connector/J bump changes the image digest, CI must rebuild the image — and the rebuild hits the unservable base.

Fix: align the 25.8 Dockerfile with the verified master configuration — FROM eclipse-temurin:21-jdk-alpine and CLASSPATH=.:/mysql-connector-j-${ver}.jar. The net diff versus master is now only the cosmetic SBOM-attestation comment (which references build-infra changes not present in 25.8).

Verified locally: the image builds, the Connector/J 9.7.0 jar downloads, and MySQLJavaClientTest.java (byte-identical to master) compiles under JDK 21. The source change (src/Core/MySQL/PacketsGeneric.cpp, always length-encode info) is unchanged and byte-identical to the original #107693.

@alexey-milovidov

Copy link
Copy Markdown
Member

Backport status — ready; both red checks are pre-existing flakes unrelated to this change

The net diff versus 25.8 is byte-identical to the original #107693: only src/Core/MySQL/PacketsGeneric.cpp (always length-encode the info field of the OK packet) and ci/docker/integration/mysql_java_client/Dockerfile (base image + Connector/J 9.7.0). The branch is now 0 commits behind 25.8, mergeable, has no unresolved review threads, and Dockers Build (amd)/(arm) are green after the base-image fix in 0cc91d3e60e.

Both failing checks on commit 0cc91d3e are unrelated to the OKPacket change, which only runs on the MySQL wire protocol (port 9004):

  1. Install packages (amd_debug) → Run server init.d. This smoke test starts the server via init.d and then runs SELECT version() over the native protocol (port 9000):

    Server started
    + clickhouse-client -q 'SELECT version()'
    Code: 210. DB::NetException: Connection refused (localhost:9000). (NETWORK_ERROR)
    

    The server reported "Server started" (PID is up) but the native TCP listener was not yet accepting connections — a debug-build startup timing race in the smoke test. This path does not touch the MySQL OK packet. Needs a rerun.

  2. Integration tests (amd_tsan, 4/6) → test_async_load_databases/test.py::test_materialized_views_cascaded_multiple and ::test_materialized_views_replicated. Known master-wide flake: per the CI database, each failed 18 times across 12 PRs in the last 21 days, including 7 times on master itself (2026-06-09 … 2026-06-30), with no open tracking issue. Needs a rerun.

@groeneai, the test_async_load_databases materialized-view tests (test_materialized_views_cascaded_multiple / test_materialized_views_replicated) are flaking master-wide (18 fails each / 12 PRs / 7 on master in 21d, no open issue). Could you investigate and provide a fix in a separate PR, or open a tracking issue? It fails here too: https://github.com/ClickHouse/ClickHouse/actions/runs/28427228761/job/84235734468

Recommend re-running the two failed jobs once the BackportPR workflow finishes; no code change is required.

@groeneai

Copy link
Copy Markdown
Collaborator

Thanks @alexey-milovidov. Investigated: these two are not a master flake, they are a missing 25.8 backport.

I fixed this family on master in #107119 (merged 2026-06-18, commit 6166517). Splitting the CIDB pull_request_number = 0 rows by head_ref (it conflates master and release branches):

  • master, since the fix merged: 1879 OK / 0 FAIL across every sanitizer (asan, tsan, msan, coverage, arm). The fix worked.
  • 25.8: 59 OK / 7 FAIL. The fix is absent there (test.py:405 is still disconnect_event.wait(90)).

All 7 "master" failures in the 21d window are actually head_ref = '25.8', and 9 of the 11 PR-run failures are backport/25.8/* PRs built on the un-fixed 25.8 base (this PR among them). True master has been clean since 06-18.

Root cause (fixed by #107119, test-only): disconnect_event.wait(90) ignored its return value, so a restart slower than 90s (the stop+start budget alone is ~120s, worse under TSan/ASan) let the main thread race ahead; and the INSERT loops had no per-query timeout, so a query to a half-restarted server could block up to 600s and exhaust the 900s session timeout. #107119 uses wait(180) + asserts it, adds timeout=60 to the INSERTs, and catches QueryTimeoutExceedException.

Recommendation: backport #107119 to 25.8 (it carries no backport label today). I cannot create release-branch backports myself, so this needs the pr-must-backport label on #107119 or a cherry-pick of 6166517. Once 25.8 has it, the 25.8 CI and the backport/25.8/* PR flakes (including this one) should clear.

Opened a tracking issue with the full CIDB breakdown: #108914.

This does not block #107889: the OK-packet change only touches the MySQL wire protocol (port 9004), unrelated to these integration tests. A rerun should make it green.

@alexey-milovidov

Copy link
Copy Markdown
Member

Thanks @groeneai — confirmed. I created the missing backport: #108917 cherry-picks #107119 (6166517952c1) to 25.8. Once it merges, the test_async_load_databases materialized-view failures should clear on the 25.8 base and on the backport/25.8/* PRs (including this one).

For #107889 itself nothing further is needed: the net diff versus 25.8 is byte-identical to the original #107693 (only src/Core/MySQL/PacketsGeneric.cpp and ci/docker/integration/mysql_java_client/Dockerfile), the branch is mergeable with no unresolved threads, and both red checks are unrelated to the OK-packet change (MySQL wire protocol, port 9004):

@alexey-milovidov

Copy link
Copy Markdown
Member

Merged the current 25.8 into this branch (0cc91d3e60e → 074bd32da54, fast-forward, no conflicts).

The only failing job that was specific to 25.8 was Integration tests (amd_tsan, 4/6) → test_async_load_databases::test_materialized_views_replicated/_cascaded_multiple, which was not a generic flake but the missing 25.8 backport of #107119 (tracked in #108914). That backport, #108917, has now merged into 25.8 (da1d7402de0, containing 3e51fbdaf51), so this branch now carries the fix — the fresh CI run should clear that job.

The other red job, Install packages (amd_debug) → Run server init.d, was an unrelated native-protocol (port 9000) startup race in the debug-build smoke test — structurally impossible to be affected by the MySQL OK-packet change (MySQL wire, port 9004); it gets a fresh run here.

The net diff is unchanged (only src/Core/MySQL/PacketsGeneric.cpp and ci/docker/integration/mysql_java_client/Dockerfile).

@alexey-milovidov
alexey-milovidov merged commit fc51ba3 into 25.8 Jul 2, 2026
33 checks passed
@alexey-milovidov
alexey-milovidov deleted the backport/25.8/107693 branch July 2, 2026 03:17
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Aug 24, 2026
…es::test_materialized_views_replicated

Cherry-pick of the test-only fix merged to `master` in ClickHouse#107119
(commit `6166517952c1`, change `e5479ff4869`). The fix is absent on
`25.8`, where `test_materialized_views_replicated` still uses
`disconnect_event.wait(90)` and un-timed INSERTs.

Under sanitizers the server stop+start budget alone is ~120s, so a
restart slower than the ignored 90s wait let the main thread race
ahead, and an INSERT to a half-restarted server could block up to 600s
and exhaust the 900s pytest session timeout. The fix waits 180s and
asserts it, bounds each INSERT with `timeout=60`, catches
`QueryTimeoutExceedException`, and stops the warm-up INSERT loop once
the restart finishes or its budget elapses.

This clears the `test_async_load_databases` failures observed on the
`25.8` base and on `backport/25.8/*` PRs (e.g. ClickHouse#107889). True `master`
has been clean since ClickHouse#107119 merged (2026-06-18).

Closes: ClickHouse#108914

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants