Skip to content

Backport #113224 to 26.5: Do not read the internal database of temporary tables in Merge - #113881

Merged
alexey-milovidov merged 2 commits into
26.5from
backport/26.5/113224
Aug 9, 2026
Merged

alexey-milovidov merged 2 commits into
26.5from
backport/26.5/113224

Conversation

@robot-ch-test-poll

@robot-ch-test-poll robot-ch-test-poll commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #113224

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

@robot-ch-test-poll robot-ch-test-poll added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-critical-bugfix labels Aug 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [0a2eac1]

Summary: ✅

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Both CI failures are unrelated to this backport:

@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Investigated. This one is already fixed on master; what the release branches are missing is the backport, not a new fix.

Root cause. StorageKafka snapshots its dependent views when the streaming loop starts. The test creates _data and _errors in one multi-statement query, so the loop can start after _data exists but before _errors does. That batch is routed to _data only, the offset is committed, and the messages are never re-consumed, so _errors stays permanently short. The 54 == 64 shape is exactly one kafka_max_block_size=100 chunk (10 error rows) lost this way; 0 == 64 is the same race losing the first batch.

The artifact confirms the mechanism rather than flush latency: in that job _data reached 640 on its first query, while _errors exhausted all 20 query_with_retry attempts still reading 54. Waiting longer cannot help, because the rows were never produced.

The fix already exists: #107025 (@antaljanosbenjamin, merged 2026-06-24) detaches and re-attaches the Kafka table after both views exist, forcing dependency re-resolution.

It was never backported. Checking the test file content per branch, DETACH TABLE/ATTACH TABLE is present on master and 26.7 and absent on 26.6, 26.5, 26.3, 25.8, and absent at this PR's head. That predicts the failure distribution exactly. Counting both this test and its test_kafka_engine_put_errors_to_stream sibling over 90 days, all 22 failures recorded after the fix merged are on unfixed branches (26.5 and its backport PRs, plus one 26.4 backport PR); master and 26.7 have none. The cleanest comparison is this test alone over the last 14 days, where the two branches run it about equally often:

branch has fix OK FAIL
26.7 yes 402 0
26.5 no 339 3

Suggested action. v26.5-must-backport on #107025 expands to 26.7/26.6/26.5, which covers every active branch with an observed failure. v26.3-must-backport also picks up 26.3, which carries the same defective test shape though it has not failed yet. I confirmed the patch cherry-picks cleanly onto 26.6, 26.5 and 26.3, and that the automation's 90-day window still admits #107025. 25.8 is worth excluding: it still has the older un-refactored test shape, the patch does not apply there, and it has no failures in the window.

I have not applied a label or opened a release-branch PR, since backports are yours to decide. If you would rather have something from me instead, say which and I will send it.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Thanks @groeneai — confirmed. I added the v26.3-must-backport label to #107025, which covers 26.3/26.5/26.6 (26.7 already has the fix), so the backport automation will pull the DETACH/ATTACH fix onto the affected release branches and this Kafka flake should stop recurring there. 25.8 is excluded as suggested, since the patch does not apply to the older test shape and there are no failures there.

With that, both previously red checks are addressed and the latest CI run on this backport is fully green.

@alexey-milovidov
alexey-milovidov merged commit c3a3f07 into 26.5 Aug 9, 2026
35 checks passed
@alexey-milovidov
alexey-milovidov deleted the backport/26.5/113224 branch August 9, 2026 17:34
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-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants