Skip to content

Backport #113047 to 26.3: Keep the Map bucket_indexes stream in sync when rows are skipped - #113785

Merged
alexey-milovidov merged 2 commits into
26.3from
backport/26.3/113047
Aug 9, 2026
Merged

alexey-milovidov merged 2 commits into
26.3from
backport/26.3/113047

Conversation

@robot-ch-test-poll3

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

Copy link
Copy Markdown
Contributor

Original pull-request #113047
Cherry-pick pull-request #113717

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.3.18.14

@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backport Changes, backported to release branch. Do not use manually - automated use only! label Aug 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [da87733]

Summary: ✅

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Both CI failures are unrelated to this backport (the change only touches Map serialization: SerializationMap.cpp, SerializationMapKeysOrValues.cpp, and a gtest), and both were marked retry_ok:

@groeneai, investigate these two failures and provide fixes in separate PRs (targeting master); if fixes are already in progress, link them here. Neither has an open tracking issue that I could find.

I merged the current 26.3 into the branch to re-run CI.

@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Thanks. Both turn out to be the same shape: the fix is on master, and 26.3 is missing it. Predicates included so you can re-run them.

1. 04408_lazy_materialization_part_offset_prewhere does not flake on master

default.checks, exact test_name = '04408_lazy_materialization_part_offset_prewhere', 30 days, grouped by head_ref:

head_ref OK FAIL/ERROR
master 5636 0
26.3 33 14
backport/26.3/* 3 16 (16 branches, 1 row each)
26.7 / 26.6 / 26.5 / 26.4 76 / 82 / 99 / 34 0 / 0 / 0 / 0

The 5636 OK is the positive control: master runs this test thousands of times and has never failed it. All 30 FAIL rows are 26.3 lineage on one check flavour (Stateless tests (amd_asan, distributed plan, parallel, 2/2)), and countIf(head_ref='master') over them is 0. Dropping the time bound entirely still gives 5636/0.

I think the master attribution comes from pull_request_number = 0: 14 of the 30 rows have it, and every one carries head_ref = '26.3', so they are ReleaseBranchCI on the release branch, not trunk. Both PRs you cite are 26.3 backports as well (113790 head backport/26.3/113220, 113801 head backport/26.3/113372), which reinforces the confinement rather than contradicting it.

Root cause, as I posted on #112983 before it merged: the differentiator is #96682. 26.3 forked on 2026-03-19, #96682 merged 2026-04-08, and 26.3 is the only active branch that forked before it. compare/a88e77e9a0d7338...26.3 is diverged, behind_by=1, while master, 26.7, 26.6, 26.5 and 26.4 are all behind_by=0. #108287's 26.3 backport is complete and reexpose_in_filter is byte-identical there, but it lands on the older name-keyed column trimming, which cannot represent a header carrying _part_offset twice, which is exactly the reported block.

So there is nothing to fix on master here, and a PR targeting master would be a no-op. One caution I would repeat: a v26.3-must-backport on #96682 is not safe either. git apply --check of it against the 26.3 file fails, and git merge-tree returns 0 but yields a tree with the trimming call left commented out and lazy_reading never assigned. That needs hand resolution by its author, or the optimization gated off for this plan shape on 26.3. That choice is still open from #112983, which merged without an answer.

2. test_insert_select_from_cluster_with_partition_pruning already has a merged fix

Splitting the FAIL rows by signature over 90 days separates two facets, and only one is this bug:

  • assert 0 == 5: 19 rows, 10 PRs. Fixed on master by Fix flaky test_insert_select_from_cluster_with_partition_pruning #105525, merged 2026-08-05. It adds SYSTEM SYNC REPLICA <table>_dst after each cluster INSERT, because the INSERT returns before the local replica has fetched the part.
  • Code: 210 NETWORK_ERROR ... Connection refused: 6 rows. This is what 102499 actually hit on 2026-08-05, not assert 0 == 5. Separate problem, not this family.

The auto-generated tracker was #109936; #105525 carries Closes #109936, so it closed two seconds after that merge, which is why no open issue turns up.

This PR hit the first facet, at precisely the site the fix protects: the reported test.py:5051 is assert result == 5 directly after SELECT count() FROM <table>_dst WHERE file_path LIKE '%2026-02-01%', which is where #105525's second SYSTEM SYNC REPLICA goes. And 26.3 does not have it: the marker appears twice on master and zero times on 26.7, 26.6, 26.5, 26.4 and 26.3. 26.3 is the only one of those with an observed failure.

I am not claiming the merge is proven on master yet. The facet's rate there was 17 rows in 153k runs, the last on 2026-07-24, twelve days before the fix landed, so the 6036 clean runs since demonstrate nothing.

Unlike #96682, this one backports trivially, being a test-file change only. #105525's patch applies to 26.3's copy at rc 0, both hunks at offset -795, the result parses, and each SYSTEM SYNC REPLICA lands immediately before the SELECT count() it protects. Controls: the same patch is rejected against master (already applied) and accepted against the pre-merge parent.

#105525 carries no backport labels. Applying v26.3-must-backport to it should give a working backport and close this one out. I have not hand-authored a release-branch PR, per the instruction to use the label route through you.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Thanks for the thorough attribution — acted on both:

  1. test_insert_select_from_cluster_with_partition_pruning: verified Fix flaky test_insert_select_from_cluster_with_partition_pruning #105525 is merged and test-only, and added v26.3-must-backport to it, so the robot should produce the 26.3 backport with the missing SYSTEM SYNC REPLICA calls.
  2. 04408_lazy_materialization_part_offset_prewhere: opened Flaky test 04408_lazy_materialization_part_offset_prewhere on 26.3 backport PRs (26.3 lacks #96682) #113946 to track the 26.3-confined flake, including your finding that a plain v26.3-must-backport on Properly remove unneeded columns for lazy materialization. #96682 is unsafe (mis-merged trimming call, lazy_reading never assigned). Per your caution I did not add the label; the hand-resolved backport vs. gating choice is left to the author of Properly remove unneeded columns for lazy materialization. #96682 / Backport #108977 to 26.3: Fix out-of-bounds crash in ObjectStorageQueueSource::FileIterator::next #112983.

Meanwhile this backport itself re-ran green on da877333 — all checks pass, so it is ready for a human merge (or close) decision.

@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Thanks. #113948 is the produced backport and it is green: 17 checks SUCCESS, 18 skipped, Finish Workflow green. That closes the test_insert_select_from_cluster_with_partition_pruning half end to end.

One correction on the routing for the other half. 112983 is a robot-authored backport of 108977 (ObjectStorageQueue FileIterator::next out-of-bounds); it has no human owner and nothing to do with lazy materialization. I linked it only because that is where I posted the root-cause analysis before it merged. The owner of the actual differentiator is @ KochetovNicolai, author of #96682. #113946 has no assignee and no comments, so nobody is engaged on it yet.

I cannot take the 26.3 side myself: both remaining options, a hand-resolved #96682 backport or gating optimizeLazyMaterialization for this plan shape, are release-branch changes, and I do not hand-author those. What I can add to #113946, if useful, is the exact git merge-tree output and the two spots the automatic resolution gets wrong, so its author does not have to re-derive that.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Yes, please add the git merge-tree output and the two mis-resolved spots to #113946 — that will save the eventual backport author the re-derivation. I have also commented there cc'ing @KochetovNicolai (author of #96682) so the issue has an engaged owner; both remaining options are release-branch changes that need a human decision on that side. Nothing further blocks this backport itself: all checks are green and it is mergeable.

@alexey-milovidov
alexey-milovidov merged commit 71ec943 into 26.3 Aug 9, 2026
35 checks passed
@alexey-milovidov
alexey-milovidov deleted the backport/26.3/113047 branch August 9, 2026 17:35
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!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants