Skip to content

Do not merge over a gap containing an outdated part with a higher mutation version - #113941

Merged
Michicosun merged 8 commits into
ClickHouse:masterfrom
groeneai:fix-merge-over-gap-with-mutated-part
Sep 4, 2026
Merged

Michicosun merged 8 commits into
ClickHouse:masterfrom
groeneai:fix-merge-over-gap-with-mutated-part

Conversation

@groeneai

@groeneai groeneai commented Aug 8, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix a LOGICAL_ERROR (Part ... intersects previous part ... It is a bug or a result of manual intervention) that makes a MergeTree table impossible to load: attaching it, and every later attempt to load it, fails with that exception (a server abort in debug and sanitizer builds). A merge could span a block gap holding an outdated part whose mutation version is higher than the merge result's, producing a pair of parts on disk that neither contain nor are disjoint from each other. Closes #113864.

Description

A merge is refused when the block gap it spans holds an outdated part the merge result would not cover. That check compared only the part level, while MergeTreePartInfo::contains requires both level >= and mutation >=. An outdated part left by a mutation has level 0, so the check could not see it and the merge produced an intersecting, mutually non-containing pair. Every later part load (ATTACH TABLE, or a server restart) then throws, and in debug and sanitizer builds that exception aborts the server.

Such a gap appears when parts owe different mutation stacks: in the reported case a mutation succeeded on one part (version 59) and threw on its neighbour (left at 45), and the surrounding parts then merged into a part that does not contain the intervening all_57_57_0_59.

getMaxLevelInBetween now also accumulates the maximum mutation version over the gap and is renamed getMaxLevelMutationInBetween; canMergeParts refuses when that version exceeds max(left.mutation, right.mutation). The bound is pairwise rather than the exact result version, which is only known later in FutureMergedMutatedPart::assign, and since that version is a maximum over a superset of any adjacent pair it can refuse early but never admits a merge it should refuse. Refusing is not fatal: the merge waits until the outdated part is removed.

The same walk now also skips a gap part whose creation was rolled back, on both terms: part loading resolves an intersecting pair in favour of the committed side, so such a part never fails to load and refusing over it only postponed the merge. When it carries exactly the block range and level the merge result would get, that merge now fails at rename with PART_IS_TEMPORARILY_LOCKED rather than being deferred here, which a pairwise predicate cannot distinguish.

The replicated predicate has no such hole; it probes the gap at MAX_LEVEL/MAX_BLOCK_NUMBER.

Validation: each new test fails on its parent commit and passes here; 02521_merge_over_gap and 01168_mutations_isolation stay green, and 261 merge/optimize/mutation tests show no regressions.


Workflow [PR]
Sync PR [sync-upstream/pr/113941]

Version info

  • Merged into: 26.9.1.664 (included in 26.9 and later)

A merge is refused when the block gap it spans holds an outdated part that
the merge result would not cover, because such a pair cannot be loaded
afterwards: it is neither containing nor disjoint, and `PartLoadingTree::add`
throws the `LOGICAL_ERROR` "Part A intersects previous part B. It is a bug or
a result of manual intervention", which aborts the server in debug and
sanitizer builds.

That refusal only compared the part level, while `MergeTreePartInfo::contains`
requires both level >= and mutation >=. An outdated part produced by a
mutation has level 0, so the level-only test could not see it, and the merge
committed a part intersecting it. The table then failed to load on every
subsequent `ATTACH` or server start.

Such a gap arises when neighbouring parts owe different mutation stacks: a
mutation that succeeds on one part and throws on the next leaves them at
different versions, and once it is killed the surrounding parts can be
merged into a result whose mutation version is below the one in the gap.

`getMaxLevelInBetween` now also accumulates the maximum mutation version over
the gap and is renamed `getMaxPropertiesInBetween` accordingly. The new test
compares against `max(left.mutation, right.mutation)` rather than the exact
result version, which is not available in a pairwise predicate: it is
computed later in `FutureMergedMutatedPart::assign`, over a range that is
itself chosen afterwards, and patch parts can raise it further. Because the
exact version is a maximum over a superset of any adjacent pair, comparing
against the pairwise maximum can only refuse a merge earlier than strictly
necessary, never admit one it should refuse. The level test beside it
already uses the same conservatism.

The refusal is not fatal: the selector picks another range and the merge
proceeds once `old_parts_lifetime` removes the outdated part. Only an explicit
`OPTIMIZE` with `optimize_throw_if_noop` surfaces `CANNOT_ASSIGN_OPTIMIZE`.

The replicated merge predicate does not share this hole. It probes the gap
with a synthetic part at `MAX_LEVEL` and `MAX_BLOCK_NUMBER` and asks
`getPartsCoveredBy`, which uses `contains`; that probe dominates on both
terms, so a part in the gap is reported whatever its mutation version.

The test builds the gap with one row-dependent mutation that empties the
middle part and throws on its neighbour, and then kills it. It waits for the
empty result to be committed before the `KILL`: mutation work is per part and
its outcomes are published independently, so a non-empty `latest_fail_reason`
can become visible first, and the `KILL` would then cancel the still pending
task through `MergeList::cancelPartMutations`, leaving no gap part at all.

Closes ClickHouse#113864.
@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (click to expand)

Two independent cold reviews plus three adversarial second-model passes over this change. Findings
and their dispositions:

# Finding Verdict
❌ The scenario assertion ... AND active OR rows = 0 was unparenthesised, so OR rows = 0 escaped the table/database scope and could match any zero-row part on the server. Agreed, fixed. Parenthesised; 0 occurrences of the unscoped form remain, and the sibling query added by the next item was checked for the same precedence class.
❌ The test killed the mutation after observing the failing part but without waiting for the successful empty result to be committed, so the KILL could cancel the still pending task and leave no gap part at all. Agreed, fixed. The poll now requires both a non-empty latest_fail_reason and the committed empty part. Measured on the server log, that part commits ~624 ms before the KILL, so the added condition cannot hang.
❌ The change stated that this logical error aborts the server unconditionally, which is false for a release build. Agreed, fixed in all four places it appeared. Exception::handleErrorCode aborts only when debug_or_sanitizer_build (a compile-time fold) or the abort_on_logical_error setting is set; both are false in a release build, where the throw is an ordinary Code: 49. The permanent harm - the table cannot be loaded, and every later ATTACH or restart fails again - is real in every build, and that wording was deliberately kept.
❌ The changelog entry used the past tense. Agreed, fixed. docs/changelog_entry_guidelines.md prescribes the present tense; the entry now opens with Fix, which is also the most common form in the two most recent release sections (357 of 1335 entries, against 308 past-tense and 6 Fixes).
⚠️ Literal class, function, setting and error-code names were left outside inline code blocks in source comments and in the commit message. Agreed, fixed for both. 0 bare Class::method remain in the added src/ comments, and every literal in the commit message is backticked.
💡 The same backticking was also asked for the shell test's comments. Not applied. In stateless .sh comments the bare form is dominant: 216 bare against 51 backticked across the suite, and only 20 of 3122 files contain any backticked comment literal. Restricting to files added after that instruction was introduced, so the sample is not merely historical: 153 bare against 46 backticked over 1127 files. The sibling this test is modelled on, 02521_merge_over_gap.sh, is entirely bare. LOGICAL_ERROR is backticked, since it is quoted as a literal.
💡 Move the Closes: line out of the template's HTML comment because auto-close would not fire from inside it. Not applied, on measurement. Over the 250 most recently merged pull requests, 5 keep the full line inside the comment and 6 place it outside; probing every linked issue, all 5 of the former and all 6 of the latter closed at merge. The upstream template itself places the line there, and the changelog entry carries Closes #113864 as well.
💡 The body named all_43_62_1_45 while the reported message names all_43_62_5_45. Agreed, clarified. Both are in the carrier's log: the gap-spanning merge produced all_43_62_1_45, and four later single-part merges carried it to all_43_62_5_45, which is what the loader tripped over 13 minutes later. The first is the part this change prevents, so it is the one the body leads with; the descendant is now named too.

Verification recorded for this change: a deterministic standalone reproduction (3 of 3) and the
committed test both abort the pre-fix binary and pass the post-fix one, with build IDs asserted on
each arm; removing only the added mutation term reddens the new test while 02521_merge_over_gap
and 04007_truncate_empty_parts_detach_attach stay green; a slice of 261 merge, optimize and
mutation tests shows no regressions; and the new test passes 50 of 50 runs under randomized
settings.

Session id: cron:clickhouse-review-slot-9:20260808-105200

@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. On a debug build, tests/queries/0_stateless/04812_merge_over_gap_with_mutated_part.sh aborts the server on the current code, 2 of 2 runs via clickhouse-test (Reason: server died 32), and a standalone script reproduced 3 of 3. Not a low-rate flake.
b Root cause explained? A merge is admitted across a block gap holding an outdated part whose mutation version exceeds the prospective merge result's. canMergeParts refused such a merge only on part level, while MergeTreePartInfo::contains requires both level >= and mutation >=. A mutation result has level 0, so the level-only test could not see it. The merge then commits a part that neither contains nor is disjoint from the outdated one, and the next part load throws the LOGICAL_ERROR in PartLoadingTree::add, which aborts the server in debug and sanitizer builds.
c Fix matches root cause? Yes. The guard that already exists for this exact invariant was missing one of the two terms contains requires; the missing term is added. The producer is fixed, so the loader keeps its strict invariant. No widened bound, no no-random-* tag, no data reduction, no defensive check at the throw site.
d Test intent preserved / new tests added? 02521_merge_over_gap is unchanged and still passes; it pins the level shape, whose gap comes from ALTER TABLE ... DROP PART (the tombstone gets level+1). The mutation shape was never covered, so a new test is added for it.
e Both directions demonstrated? Yes, on Build-ID-asserted debug binaries. Pre-fix 3ca195b2...: OPTIMIZE merges across the gap, then ATTACH fails with Part all_2_2_0_3 intersects previous part all_1_4_1. It is a bug or a result of manual intervention, which on this debug build aborts the server. Post-fix 8856884b...: OPTIMIZE ... optimize_throw_if_noop=1 is refused with the new message, ATTACH loads cleanly and count() returns 2. Both halves are asserted; the refusal alone would not prove the table loads.
f Fix is general across code paths? The gap check has exactly one call site in the tree, so the unreplicated path is fully covered. The distributed/replicated predicate was inspected and does not have this hole: it probes the gap with a synthetic MergeTreePartInfo at MAX_LEVEL / MAX_BLOCK_NUMBER and asks getPartsCoveredBy, which uses contains; that probe dominates on both level and mutation, so any part in the gap is reported regardless of its mutation version. Reported here, not changed.
g Fix generalizes across inputs (params/datatypes/wrappers)? The compared values are the part-name integers, so column types and wrappers are not involved. mutation is Int64 in MergeTreePartInfo and Int64 in the new struct (no narrowing, no signedness change); level stays UInt32. An empty gap yields zeroes, so 0 > max(left, right) is false and behaviour is unchanged when there is no gap part. Patch parts only ever raise the result's mutation version (FutureMergedMutatedPart::assign), so they cannot turn the conservative comparison into an under-refusal.
h Backward compatible? Yes. No setting, no serialization format and no on-disk change, so no SettingsChangesHistory.cpp entry is owed. The only behavioural change is that a merge which would have produced an unloadable pair is deferred. The refusal is a normal non-fatal outcome; only an explicit OPTIMIZE ... SETTINGS optimize_throw_if_noop = 1 surfaces CANNOT_ASSIGN_OPTIMIZE, and the deferral ends once old_parts_lifetime removes the outdated part.
i Invariants and contracts preserved? The changed function keeps the same readLockParts() scope, the same iteration bounds and the same three LOGICAL_ERROR guards; only the accumulator widened, so no lock ordering, atomicity or early-return path changed. The invariant restored is the one the function's own comment states: a merge must not produce a result that fails to contain an on-disk part in the gap it spans.

Session id: cron:clickhouse-impl-slot-40:20260808-033700

@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

cc @Michicosun @CheSema, could you review this? The gap guard in canMergeParts compared only the part level, but MergeTreePartInfo::contains needs both level and mutation version, so a merge could span a gap holding an outdated mutation result (level 0) and commit a part that neither contains nor is disjoint from it, after which the table no longer loads.

@Michicosun Michicosun self-assigned this Aug 8, 2026
@Michicosun

Copy link
Copy Markdown
Member

@groeneai It is most likely an incorrect fix. This algorithm has been working for more than 10 years. What query produced covering parts? Give me a link to the CI. If there is no link, close this pr.

Remember, it is very unlikely you need to change the Compaction folder of the merge tree.

@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

@Michicosun CI links, both test_status = FAIL rows in CIDB:

The parts are not covering, they intersect: MergeTreePartInfo::contains requires mutation >= as well as level >=, and all_43_62_5_45 has the lower mutation version of the pair.

Producing sequence for default.t116, from that run's clickhouse-server.err.log:

  1. DELETE FROM t116 IN PARTITION tuple() WHERE TRUE allocates mutation 59. It mutates all_57_57_0 into all_57_57_0_59, 0 rows (11:51:47.065988), and throws Code: 43 ... First argument for function tupleElement must be Tuple on all_43_43_0 and all_44_44_0, which stay at version 45.
  2. clearEmptyParts: Will drop empty part all_57_57_0_59 (11:51:48.049898). Outdated, directory still on disk under old_parts_lifetime.
  3. KILL MUTATION removes mutation_58.txt and mutation_59.txt (11:53:08.624940), so the neighbours keep version 45 permanently.
  4. OPTIMIZE TABLE t116 FINAL DEDUPLICATE (11:54:13.053178): Selected 3 parts from all_43_43_0_45 to all_62_62_0, block 57 skipped, then Merged 3 parts: [all_43_43_0_45, all_62_62_0] -> all_43_62_1_45 (11:54:13.066086). This is the step the merge predicate should have refused: the gap holds mutation version 59, the result carries 45.
  5. Three no-op merges carry it to all_43_62_4_45, then TRUNCATE covers it with an empty all_43_62_5_45 (11:56:45.449963), the name in the reported message.
  6. ATTACH TABLE t116 AS REPLICATED (12:07:23.746747) reaches Loading data parts and throws. The conversion is incidental: Removed 0 transaction metadata files on that line, and a plain ATTACH throws identically, which is what the new test does.

On the age: the gap guard is c51f4d7be1e0eaa5cae63d7791ddd690725e5ec0 (2023-01-05), and it has compared only level since it was written, while contains has required both terms since before then. ReplicatedMergeTree does not have this hole, its predicate probes the gap with a synthetic part at MAX_LEVEL/MAX_BLOCK_NUMBER (DistributedMergePredicate.h:105-115), which dominates on both terms, so the non-replicated path is the odd one out. 02521_merge_over_gap passes today only because DROP PART writes its tombstone at level + 1; a mutation result has level 0, so the level test cannot see it and that shape was never covered.

If you would rather the missing term were checked somewhere other than the merge predicate, tell me where and I will move it. The disposition of this PR is yours.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Aug 8, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b5b6401]

Summary: ✅


AI Review

Summary

This PR fixes the original load-time LOGICAL_ERROR by teaching the gap guard to look at mutation versions as well as merge levels, and it also excludes rolled-back gap parts from that guard. The original bug is addressed, but the current implementation still leaves two user-visible regressions in merge selection/commit, so it is not ready to merge as-is.

Findings

⚠️ Majors

  • [src/Storages/MergeTree/Compaction/MergePredicates/MergeTreeMergePredicate.cpp:159-177; src/Storages/MergeTree/MergeTreeDataMergerMutator.cpp:77-90; src/Storages/MergeTree/FutureMergedMutatedPart.cpp:60-77] [dismissed by author -- https://github.com/Do not merge over a gap containing an outdated part with a higher mutation version #113941#discussion_r3741845088] The new mutation-gap check still validates only max(left.info.mutation, right.info.mutation), but mergeable ranges are built greedily from adjacent pairs and stop at the first rejection. A later source part or applied patch can still raise the actual result mutation above the gap part, so a whole-range-safe merge is now split/rejected before that later maximum is visible. That makes the regression broader than OPTIMIZE FINAL: ordinary background ranges are fragmented by splitByMergePredicate too.
    Suggested fix: validate the gap against the eventual range result mutation (or pass the whole selected range / patch maximum into the check) instead of the current adjacent-pair maximum.

  • [src/Storages/StorageMergeTree.cpp:2113-2125; src/Storages/MergeTree/FutureMergedMutatedPart.cpp:72-77; src/Storages/MergeTree/MergeTreeData.cpp:6617-6623; src/Storages/StorageMergeTree.cpp:1856-1861; src/Storages/MergeTree/MergePlainMergeTreeTask.cpp:154-160] [dismissed by author -- https://github.com/Do not merge over a gap containing an outdated part with a higher mutation version #113941#discussion_r3903749560] Skipping every gap part with creation_csn == Tx::RolledBackCSN also skips the rolled-back part whose name exactly matches the would-be merge result. In that shape the predicate now admits the merge, FutureMergedMutatedPart::assign still produces the same part name, and checkPartDuplicate throws PART_IS_TEMPORARILY_LOCKED on the outdated duplicate during rename. OPTIMIZE runs MergePlainMergeTreeTask synchronously via executeHere, so this becomes a client-visible exception where the old behavior was a temporary deferral.
    Suggested fix: keep refusing the exact-duplicate rolled-back shape until cleanup removes the old part, or add a retry/cleanup path for regular merge commits before surfacing PART_IS_TEMPORARILY_LOCKED.

Final Verdict

Changes requested. The original corruption fix is correct, but the remaining pairwise over-refusal and exact-duplicate rolled-back path are still real regressions in the current code.

LLVM Coverage Report

Measured on commit b5b6401.

Metric Baseline Current Δ
Lines 88.70% 88.70% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 81.00% 81.00% +0.00%

Changed lines: Changed C/C++ lines covered: 26/26 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Aug 8, 2026
/// Compared against the pairwise max, not the exact result mutation version, which is only
/// known later in `FutureMergedMutatedPart::assign`. The exact version is a max over a
/// superset of this pair, so this test may over-refuse but never under-refuse.
if (max_possible.mutation > std::max(left.info.mutation, right.info.mutation))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "may over-refuse" caveat becomes user-visible in OPTIMIZE FINAL. selectAllPartsToMergeWithinPartition validates the whole partition with canMergeAllParts and aborts on the first rejected adjacent pair (MergeTreeDataMergerMutator.cpp:389-395), but the final part's mutation is computed later from the maximum across the whole range plus applied patch parts (FutureMergedMutatedPart.cpp:56-76 and MergeTreeDataMergerMutator.cpp:426-430).

That means a partition can be mergeable as a whole even though some adjacent pair is not. For example, active parts with mutations 45, 45, 100 and an outdated gap part at 59 between the first two parts should be valid for one final merge, because the result mutation is 100 and contains the gap part. This pairwise check still rejects the first pair and surfaces CANNOT_ASSIGN_OPTIMIZE before the range-level max is visible.

This needs a range-level gap check for OPTIMIZE FINAL, or the exact future mutation version passed into the whole-range validation, rather than treating the pairwise bound as harmlessly conservative.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed: the shape is real and I reproduced it. Correcting my own "may over-refuse" comment, which implied it was not observable.

Fixture (debug binaries, Build IDs asserted): all_1_1_0 at mutation 0, outdated all_2_2_0_5 at 5, all_3_3_0 at 0, all_4_4_0_6 at 6. It needs a prerequisite the report does not mention: two KILLed partially-failed mutations, so the registry is empty and the pre-existing different-mutation-version check at MergeTreeMergePredicate.cpp:50-56 does not reject the pair first.

  • pristine master 3ca195b2: OPTIMIZE FINAL succeeds, produces all_1_4_1_6, reattach loads 3 rows. The result does contain all_2_2_0_5, so the merge is safe.
  • this branch 8856884b: refused, "with mutation version 5 higher than these active parts have".
  • control, same fixture without the gap part, this branch: OPTIMIZE FINAL succeeds.

The two claims about the code are also correct: canMergeAllParts returns on the first rejected adjacent pair, and FutureMergedMutatedPart::assign takes the max over the whole range plus applied patch versions.

I am not changing the predicate, for two measured reasons.

The conservatism is not introduced here. The same over-refusal exists on pristine master in the level dimension, with every part at mutation 0 so this term is irrelevant: all_1_5_2, all_6_6_0, outdated all_7_7_1, all_8_8_0. The whole-range result all_1_8_3 contains all_7_7_1, yet master refuses with "with merge level 1 higher than these active parts have". The pairwise-versus-range-max approximation belongs to the original gap guard (c51f4d7be1e0eaa, 2023-01-05); this change adds the second term MergeTreePartInfo::contains already requires.

At default settings nothing surfaces. optimize_throw_if_noop defaults to false, and StorageMergeTree.cpp:2381-2389 logs and returns false unless it is set, so OPTIMIZE TABLE t FINAL is a silent no-op; the server log confirms the term fired. Merging still progresses: a plain OPTIMIZE compacted the other sub-range to all_3_4_1_6, 3 active parts down to 2. And it clears itself once the outdated directory is removed after old_parts_lifetime, after which OPTIMIZE FINAL succeeds.

So the residual is a pre-existing conservatism in both terms whose effect at defaults is a temporary skipped merge, against a LOGICAL_ERROR on reattach in the non-contained case. Threading the exact future mutation version into whole-range validation is the more principled shape, but it is a redesign of the 2023 guard in a folder the code owner has asked me not to change, so it does not belong in this bugfix.

I am also not adding the suggested test: pinning the over-refusal would lock in behaviour a future range-level fix should be free to change.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed bb93a2eb: the mutation term now skips outdated parts whose creation was rolled back.

01168_mutations_isolation failed deterministically on cf5afe5b (16/16: 7/7 with randomized
settings, 9/9 without, per the randomization diagnosis, on amd_debug and arm_binary). The
term fired exactly once in the whole job, inside that test:

{...01168_mutations_isolation_..._tx7_...} test_....mt: Cannot OPTIMIZE table: There is an
outdated part in a gap between two active parts (all_1_1_0_13, all_7_7_0_13) with mutation
version 15 higher than these active parts have

mutation is the last component of the data_parts_by_info sort key
(MergeTreePartInfo::toTuple), so a higher mutation version of an endpoint sorts between the
endpoints and was scanned as if it lay in the block gap. all_1_1_0_15 got there because
tx 8 starts a mutation that is then killed, leaving it Outdated with creation_csn set to
Tx::RolledBackCSN while the active endpoints are still at 13.

Refusing over such a part is pointless: MergeTreeData::loadDataPart deactivates a part whose
creation was rolled back, so it never enters the set PartLoadingTree::add checks for
intersections, and add skips it again on its rolled-back branch. It cannot produce the
intersects previous part error this predicate exists to prevent.

Three arms, each Build ID asserted (readelf -n == buildId()), on the rolled-back shape:
pristine master accepts, cf5afe5b refuses via the mutation term, bb93a2eb accepts. The
guard is not weakened: 04812_merge_over_gap_with_mutated_part and 02521_merge_over_gap both
pass, and pristine master still aborts 04812 with
Part all_2_2_0_3 intersects previous part all_1_4_1.

On the earlier over-refusal point: unchanged and still pre-existing. It reproduces in the level
dimension on pristine master with every part at mutation 0, so it belongs to the 2023 guard
rather than to this change.

The mutation term added to the gap predicate walks `data_parts_by_info` between the
two active endpoints. `mutation` is the last component of that index's sort key
(`MergeTreePartInfo::toTuple`), so every higher mutation version of an endpoint sorts
between the endpoints and is scanned as if it were a part in the block gap.

`01168_mutations_isolation` hits exactly that: a transactional mutation is started and
then killed, which leaves `all_1_1_0_15` Outdated with `creation_csn` set to
`Tx::RolledBackCSN`, while the active endpoints are still at mutation version 13. The
following `OPTIMIZE TABLE mt FINAL` was refused with `There is an outdated part in a
gap between two active parts (all_1_1_0_13, all_7_7_0_13) with mutation version 15
higher than these active parts have`.

Refusing there is pointless: `MergeTreeData::loadDataPart` deactivates a part whose
creation was rolled back, so such a part is never in the loaded set the intersection
check in `PartLoadingTree::add` runs over, and it cannot produce the
`intersects previous part` logical error the gap predicate exists to prevent.
`PartLoadingTree::add` skips it a second time on the rolled back branch.

Verified on Build ID asserted debug binaries: the PR head refuses the rolled back
shape while both pristine master and this change accept it, and both
`04812_merge_over_gap_with_mutated_part` and `02521_merge_over_gap` still pass, so
neither the level term nor the committed part case is weakened.
@clickhouse-gh

clickhouse-gh Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing b5b6401a6 with master dfde23932 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

20 translation units recompiled, 140 s compile time in total, 20 of them have a recent master baseline.

Job report

@groeneai

groeneai commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - bb93a2e

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stress test (amd_msan) / Logical error: Bad cast from type DB::ColumnString to DB::ColumnNullable (STID 3520-4525) trunk bug, not caused by this PR: 35 unrelated PRs plus master (pull_request_number = 0) carry it in the last 30 days, onset 2026-08-07. The stack is fillMissingColumns -> collectOffsetsColumns -> SerializationArray::enumerateStreams -> SerializationNullable::enumerateStreams (SerializationNullable.cpp:47 assert_cast<const ColumnNullable &>), which is the signature this PR does not touch #113925 (mine, open)

Report for the failing check: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113941&sha=bb93a2ebd5e4fb14fe38c39f0ec1f8244c991d67&name_0=PR&name_1=Stress%20test%20%28amd_msan%29

157 checks succeeded, 17 skipped, 1 failed. Config Workflow and Finish Workflow both succeeded, so the matrix did run.

Session id: cron:our-pr-ci-monitor:20260809-063000

@groeneai groeneai added the groeneai-origin-request PR origin: a maintainer pinged or directed groeneai label Aug 19, 2026

@Michicosun Michicosun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Remove comments
  2. GapPartProperties should not be in the part properties file, just return std::pair from getMaxLevelMutationInBetween

Comment thread src/Storages/StorageMergeTree.cpp Outdated
Comment on lines +2039 to +2042
/// A part left behind by a rolled back transaction is skipped when loading parts, so it can
/// never intersect the merge result and must not hold the merge back.
if ((*it)->version->getInfo().creation_csn == Tx::RolledBackCSN)
continue;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check was not here and has no relation to the problem. Why have you introduced it? If it is a separate fix, remove it from this pr.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right that it should not have been there in that form, and I have narrowed it.

The check was aimed at the mutation term this PR adds, but I applied it to the whole loop, so it also changed the pre-existing level term. That was wrong. It now guards only the mutation accumulation, and the level term is byte-identical to master, so the diff of this function is purely additive.

Why the remaining guard is not a separate fix: without it my own new term produces a false refusal. 01168_mutations_isolation failed deterministically on cf5afe5b (16/16), and the term fired exactly once in the whole job, inside that test, on all_1_1_0_15 in a gap between endpoints at version 13. mutation is the last component of the data_parts_by_info sort key, so a higher mutation version of an endpoint sorts between the endpoints and is scanned as if it lay in the block gap. That part exists because a mutation was killed, leaving creation_csn at Tx::RolledBackCSN.

Such a part can never be the one that fails to load: at MergeTreeData.cpp:2262 and :2273 an intersecting pair where either side has a rolled back creation is resolved in favour of the committed side, before the LOGICAL_ERROR at :2301. So refusing over it only postpones the merge, with no defect prevented.

If you would still rather see the two apart, I will drop the exclusion here and send it separately, but then this PR breaks 01168 on its own.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to introduce the same guard for the level?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, why does the collector not handle this case using a proper filter of parts in active txs?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the level: yes, it has the same exposure, and it is already broken on master without this PR. I reproduced it rather than reasoning about it.

Four single-row inserts, then OPTIMIZE ... FINAL inside an explicit transaction, then ROLLBACK. The rollback leaves an outdated all_1_4_1 at level 1 with creation_csn = 18446744073709551615, which is Tx::RolledBackCSN (TransactionID.h:45). A plain OPTIMIZE ... FINAL after that, with no transaction in scope, is refused on pristine master:

Code: 388. Cannot OPTIMIZE table: There is an outdated part in a gap between two active
parts (all_1_1_0, all_2_2_0) with merge level 1 higher than these active parts have.

Refused 3 times out of 3, so it is not a transient. Control: the same table built without the transaction merges normally, so the check is not simply always refusing. DETACH + ATTACH + SYSTEM WAIT LOADING PARTS then loads all 4 rows, so nothing real is being prevented here either. It needs cleanup_delay_period raised to hold the window open, otherwise clearOldParts removes the gap part and the refusal clears itself.

So the level term wants the same exclusion, but it is a pre-existing defect rather than something this PR introduces, and per your own point at the top of this thread I would rather send it separately than widen this diff. I will open that PR unless you prefer it here.

On the collector: it cannot express this property, for two reasons.

collectInitial does all of its transaction work only when tx is non-null; with no transaction it just returns the active parts. StorageMergeTree::optimize takes txn from local_context->getCurrentTransaction() (StorageMergeTree.cpp:2401), so the refusal above happened with txn == nullptr and that filter never ran at all.

More fundamentally, the collector's output is the set of merge candidates, built by buildPartProperties over the already filtered ranges (PartsCollectors/Common.cpp:22-23). The parts this guard is about are by construction not in that set: they are outdated parts strictly between two active endpoints. That is why getMaxLevelMutationInBetween re-reads data_parts_by_info under readLockParts instead of using what it was handed. Filtering the collector harder removes more information; it cannot add the gap back.

For what it is worth, @ alexey-milovidov reached the same conclusion from the other direction on #115064 yesterday: parts_visible_for_merge, the collector superset, is not a sound source either, because once a replacing patch merge commits, the replaced part has a committed removal_csn and drops out of the superset while its replacement is filtered out as not visible. A complete fix there has to derive from snapshot visibility over both Active and Outdated parts, independent of the collector.

No change pushed for either question; I wanted your call on the level PR first.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand correctly that if we do not include the txs logic in the current fix, the problem we already have with the level will be the same for mutations? That means we can, after that, open a follow-up PR to fix both level and mutation problems?

If so, do it this way - txs logic must be reviewed by other people, not me.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes on the mechanism, and I measured it both ways rather than reasoning about it. Without those four lines the mutation term accumulates over rolled-back parts exactly like the level term already does, so the two become symmetric.

One consequence changes the order, though: the level version is latent, the mutation version is not. 01168_mutations_isolation fails deterministically without the guard, 5 of 5 runs, at tx 7 "optimize table mt final":

Cannot OPTIMIZE table: There is an outdated part in a gap between two active parts
(all_1_1_0_13, all_7_7_0_13) with mutation version 15 higher than these active parts have

Version 15 is tx 8's mutation_15, left outdated by tx_sync 8 "rollback". With the guard the same test is 5 of 5 green and the server logs no gap refusal at all. The test I added passes either way, 3 of 3 without the guard, so the fix itself does not depend on those lines. Neither run produced the level form; the level repro above needed part cleanup disabled to keep the gap part around.

So this PR cannot merge with the txs logic removed and the follow-up landing after it. Two orders do work:

  1. The follow-up goes first, covering level and mutation together, reviewed by whoever owns the transaction code. I then drop the four lines here, and this PR carries no txs logic at all.
  2. The four lines stay here, and the follow-up covers only the level term.

Option 1 is what you asked for and leaves nothing red at any point, so it is my preference. Say which you want and I will do that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add fix for the level in this pr

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in ca3e192f: the rolled back skip now covers the level maximum as well, so both terms of getMaxLevelMutationInBetween share one rule and neither needs a follow-up PR.

Measured both directions on Build ID asserted debug builds, with the fixture the level exposure needs (two parts, OPTIMIZE FINAL inside a transaction, ROLLBACK, two more parts, then OPTIMIZE FINAL inside a transaction):

  • parent commit: Code: 388 CANNOT_ASSIGN_OPTIMIZE, with merge level 1 higher than these active parts have
  • with the fix: the merge commits all_1_4_1, and detach, attach, SYSTEM WAIT LOADING PARTS loads all four rows with the rolled back part dropped at load, and no intersects previous part in the log

The new 04813_merge_over_rolled_back_gap_part fails 5 of 5 on the parent commit and passes 20 of 20 here. 02521_merge_over_gap, 04812_merge_over_gap_with_mutated_part and the 01168_mutations_isolation family stay green. Parts created outside a transaction carry Tx::NonTransactionalCSN, so on a table that never ran one the walk is unchanged.

One consequence I would rather name than bury. When the rolled back part carries exactly the block range and level the merge result would get, the predicate no longer defers the merge, and it fails at rename instead with Code: 384 PART_IS_TEMPORARILY_LOCKED, already exists, but it will be deleted soon, where before it was a silent no-op. The predicate is pairwise while the result range is only known to the whole range selection, so it cannot tell that case from the safe one. I left the behaviour as measured rather than special casing it, and did not pin it in a test since a later fix should be free to change it. Say so if you would rather I keep the level term as it was for that reason.

Last thing: you said the transaction logic should be reviewed by someone other than you. It now applies to both terms rather than one, so that ask still stands. Name whoever should look at it and I will ping them.

Review feedback on the gap merge predicate:

1. Remove comments. Trimmed the fix-referential and self-evident ones from
   both the source and the test, keeping only the setup constraints a reader
   cannot infer at the call site.

2. GapPartProperties should not live in the part properties file. The struct
   is gone; getMaxLevelMutationInBetween returns std::pair<UInt32, Int64> and
   PartProperties.h is untouched by this PR again.

3. The rolled back part check had no relation to the problem. It was applied
   to the whole loop, so it also changed the pre-existing level term. It now
   guards only the new mutation term, leaving that term byte-identical to
   master: the diff of this function is purely additive.

A part whose creation was rolled back is deactivated by MergeTreeData::loadDataPart
before PartLoadingTree::add sees it, so it can never be the part that fails to
load, and refusing a merge over it only postpones the merge.
The skip is not `MergeTreeData::loadDataPart` deactivating the part. It happens
inside the intersection handling itself: `MergeTreeData.cpp:2262` and `:2273`
resolve an intersecting pair in favour of the committed side when either side
has a rolled back creation, before the `LOGICAL_ERROR` at `:2301`.

Also state in the header that the level maximum covers all outdated parts while
the mutation maximum covers only those whose creation was not rolled back,
rather than implying both terms share one filter.
@groeneai

Copy link
Copy Markdown
Collaborator Author

Both done in c215e5f, plus the third point in the thread above.

  1. Comments removed. Kept only the setup constraints in the test that are not inferable at the call site, and one invariant next to the rolled back exclusion. The source diff is now one comment line.

  2. GapPartProperties is gone. getMaxLevelMutationInBetween returns std::pair<UInt32, Int64> and PartProperties.h is untouched by this PR again. I used your name for the function.

Re-verified on a debug build (Build ID 9a9bb025, asserted against buildId()): 04812_merge_over_gap_with_mutated_part and 02521_merge_over_gap both pass, and the pristine master binary still aborts 04812 on reattach with Part all_2_2_0_3 intersects previous part all_1_4_1.

Master reflowed the level refusal in canMergeParts with clang-format and
added a transaction-aware parts set to the merge predicate. The mutation
term keeps its own refusal in the same reflowed style; the predicate now
receives the transaction, and getMaxLevelMutationInBetween is unaffected
by that change because it reads data_parts_by_info under the parts lock.
@groeneai

Copy link
Copy Markdown
Collaborator Author

Merged master to clear the conflict. Head is now aa4259cd; mergeable is back to true.

The conflict was in canMergeParts: master reflowed the level refusal with clang-format and my
mutation refusal sat in the same block. I kept master's formatting and wrote the mutation term in
the same style, so the resolution is formatting only. Master also gave the predicate the
transaction and a transaction-aware parts set; getMaxLevelMutationInBetween is unaffected by
that, since it reads data_parts_by_info under the parts lock rather than the collected set.

Validated on the merged tree, both arms with Build IDs asserted against SELECT lower(buildId()):

  • Fix arm 1c15e8d5: 04812_merge_over_gap_with_mutated_part and 02521_merge_over_gap pass, and
    all three 01168_mutations_isolation parts pass.
  • Base arm 64daa5e2, the same merged tree with only my three source changes reverted: 04812
    aborts with Logical error: 'Part all_2_2_0_3 intersects previous part all_1_4_1. It is a bug or a result of manual intervention'. So the guard still fires after the merge.

01168_mutations_isolation is the one I could not run locally last round. The gap was on my side:
that test is listed in tests/async_insert_blacklist.txt and my server had async_insert on, which
turned every insert in it into NOT_IMPLEMENTED. With async_insert = 0 it passes on the merged
fix arm.

No submodule pins moved: the index gitlinks are identical to master for all of contrib/.

@groeneai

Copy link
Copy Markdown
Collaborator Author

Hi @Michicosun, gentle ping - any update on the two review threads? I answered both on 2026-08-25 (discussion_r3851765574) and deliberately pushed no change pending your call on whether the level guard belongs in this PR, so it is blocked on that decision.

`getMaxLevelMutationInBetween` skipped a gap part whose creation was rolled back
only while accumulating the mutation maximum. The level maximum still counted
it, so the level term kept refusing merges over such a part.

Nothing in the reason for that skip depends on which component made the pair
non-containing. `MergeTreeData::PartLoadingTree::add` resolves an intersecting
pair in favour of the committed side whenever either side has a rolled back
creation (MergeTreeData.cpp:2323, :2334, :2387, :2396) instead of reaching the
`intersects previous part` logical error at :2362, so a rolled back part is
never the one that fails to load. The skip belongs to the whole walk, and both
maxima now share it.

Measured on Build ID asserted debug binaries with transactions enabled through
the CI config tree. Fixture: two single row parts, `OPTIMIZE FINAL` inside a
transaction, `ROLLBACK` (which leaves `all_1_2_1` Outdated with `creation_csn` =
`Tx::RolledBackCSN`), two more single row parts, then `OPTIMIZE FINAL` inside a
transaction. Before: `Code: 388 CANNOT_ASSIGN_OPTIMIZE`, `with merge level 1
higher than these active parts have`. After: the merge commits `all_1_4_1`, and
a detach, attach, `SYSTEM WAIT LOADING PARTS` cycle loads all four rows with the
rolled back part dropped at load, with no `intersects previous part` in the log.

Parts created outside a transaction carry `Tx::NonTransactionalCSN`, so on a
table that never ran one the walk is unchanged.

One consequence is worth naming. When the rolled back part has exactly the block
range and level that the merge output would get, the predicate no longer
refuses, and the merge instead fails at rename with
`PART_IS_TEMPORARILY_LOCKED`, `already exists, but it will be deleted soon`,
where before it was a silent no-op. The predicate is pairwise while the output
range is only known to the whole range selection, so those two shapes cannot be
told apart there.

The test pins `remove_rolled_back_parts_immediately = 0` and a large
`merge_tree_clear_old_parts_interval_seconds`: a rolled back part is removable
as soon as it appears, independently of `old_parts_lifetime`
(MergeTreeData.cpp:4105-4106), and the parts cleanup runs once a second by
default, so without those pins the fixture could be deleted before the merge.

04813_merge_over_rolled_back_gap_part covers the shape above. It fails on the
parent commit with the level refusal and passes here. 02521_merge_over_gap,
04812_merge_over_gap_with_mutated_part and the 01168_mutations_isolation family
all still pass.

# Merges the two parts inside a transaction and rolls it back, which leaves all_1_2_1 Outdated
# with creation_csn = Tx::RolledBackCSN. Two more parts are added afterwards, so the merge below
# spans a wider range than the rolled back part and gets a different name.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixture deliberately sidesteps the remaining failing shape by making the second merge wider than the rolled-back all_1_2_1. If the same two active parts are merged again, getMaxLevelMutationInBetween now skips that rolled-back gap part, FutureMergedMutatedPart::assign still names the result all_1_2_1, and checkPartDuplicate then throws PART_IS_TEMPORARILY_LOCKED because the outdated rolled-back part is still in data_parts_by_info. So the PR still turns that case from a temporary deferral into a commit-time failure in OPTIMIZE FINAL or a background merge until cleanup runs. Please either cover and fix the exact-duplicate shape here, or keep the predicate refusing it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mechanism confirmed, and it is the residual I described 21 minutes before this review, in the thread above: #113941 (comment). The throw site you name is the one I measured, MergeTreeData::checkPartDuplicate at MergeTreeData.cpp:6591-6593, and the naming holds: FutureMergedMutatedPart::assign takes the block range from the ends of the range and sets level = max_level + 1 (FutureMergedMutatedPart.cpp:74-76), so the same two parts do produce all_1_2_1 again.

Neither of the two options is mine to take.

Refusing the exact duplicate in the predicate also refuses the shape this PR fixes. canMergeAllParts validates adjacent pairs (MergeTreeDataMergerMutator.cpp:597-602), so in this fixture the first validated pair is (all_1_1_0, all_2_2_0), whose pairwise result name is all_1_2_1, the rolled back part, while the merge that actually runs is all_1_4_1. A rule keyed on the pairwise result name refuses both shapes, so it reverts the fix instead of narrowing it. Telling them apart needs the whole range result name, which only selectAllPartsToMergeWithinPartition has.

Keeping the old level accumulation is that same revert, and @ Michicosun asked for the level fix in this PR earlier today. I offered him that revert in the comment linked above, so it is his call.

Two bounds on what is left. checkPartDuplicate picks PART_IS_TEMPORARILY_LOCKED for an Outdated duplicate on purpose, and StorageMergeTree::renameAndCommitEmptyParts already treats that code by running clearOldPartsFromFilesystem and retrying. And rollback makes the part removable at once, so grabOldParts deletes it regardless of old_parts_lifetime when remove_rolled_back_parts_immediately is set (MergeTreeData.cpp:4104-4106), which is the default, on a cleanup task whose default interval is 1 second; the fixture has to turn both off to keep the part around. No table fails to load in either state, which is the failure this PR removes.

@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - ca3e192f079ddf4ee6c42aad49637c871a1216e9

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6) / Container memory budget exceeded (/docker) the shard's nested containers breach the /docker cgroup leaf, the kernel OOM-kills processes inside it and the job errors with no test attributed #117412 (external, merged 2026-09-01T11:31:33Z)
Docs examples / Documentation examples the documented output of Function/toYYYYMM#0 was pinned to 202608, so the example self-broke at the month boundary #117459 (mine, merged 2026-09-01T13:55:50Z)
Bugfix validation (functional tests, amd64 / aarch64), Finish Workflow / Post Hooks both per-arch jobs abort on assert build_urls, "Could not find master builds in S3", so nothing could validate and new_tests_check.py then reds the post hook #117433 (mine, open)
Stress test (amd_debug) / Logical error: Not-ready Set is passed as the second argument for function 'globalIn' (STID 0250-4e52) pre-existing trunk defect in set readiness, not caused by this diff #102308 (external, open)

The /docker breach is a job-level condition, not a test result. I measured #117412 ABSENT from the tree that ran, from the job's own environment rather than from git ancestry: this job was launched with CI_DIND_INIT_RESERVE=17179869184 (the 16 GiB share #117412 replaces), and so were all ten failing legs I read this tick. The probe discriminates, with a positive control: two shards launched at 14:53Z and 14:59Z carry CI_DIND_INIT_RESERVE=8589934592 (the flat 8 GiB reserve #117412 introduces) and both passed. So this is rule 3c and not rule 3d, and #117411 is not a co-owner: it was closed unmerged at 11:11:48Z in favour of #117412, whose own diff comment states the causal link.

The docs example is a trunk-wide, date-dependent break, not something specific to this PR: 226 distinct pull requests and 10 true-master runs carry it. I measured #117459 ABSENT from the tree that ran, from the failure text itself: the reported query is still the old toYYYYMM(now(), ...) form, and the string the fix introduces appears in 0 of the 164 Docs examples failure rows recorded in the last day. The control is master's own line - Docs examples is FAIL at d8aa6cab7800, which is 4 commits behind the fix and has 0 occurrences of the new string, and OK at 8627fa22f015, which is the fix's own merge commit.

I have not merged master to pick those fixes up yet. It would not clear Mergeable Check on this head, because the Stress test (amd_debug) logical error and the Bugfix validation abort both remain, and neither fix is merged, so a merge now would cost a full CI cycle and leave the head red on the same count. One master merge picks everything up once the remaining fixes land.

Mergeable Check reports Failed: 4 at this head, which counts only the jobs it gates on. The table above is the complete non-OK, non-SKIPPED node set of the head's praktika report, so it also covers the rows Mergeable Check does not gate.

CH Inc sync was success at this head.

Session id: cron:our-pr-ci-monitor:20260901-163000

Comment thread src/Storages/StorageMergeTree.cpp Resolved
@Michicosun
Michicosun enabled auto-merge September 1, 2026 17:37
@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 26433dfe33d0eb34ee9e2df8f831e9004e77fe07

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
AST fuzzer (amd_debug, targeted) / Logical error: Not-ready Set is passed as the second argument for function 'globalIn' (STID 0250-4e52), Failures: 1/2 not PR-caused, pre-existing trunk defect in subquery-set readiness. The aborting query is recorded verbatim in fatal.log as SELECT ... FROM merge('.+.+.+.+') PREWHERE globalIn(database, (SELECT DISTINCT currentUser())) ..., and the abort frames are MergeTreeRangeReader::executePrewhereActionsAndFilterColumns into ExpressionActions::execute into FunctionIn::executeImpl (src/Functions/in.cpp:128): the globalIn subquery set was never built. Breadth over 30 days: 738 rows across 485 pull requests and 45 true-master trees. This diff touches only MergeTreeMergePredicate.cpp and StorageMergeTree.cpp, neither of which is on a set-building or read path #102308 (external, open)
Bugfix validation (functional tests, amd64), Bugfix validation (functional tests, aarch64), Finish Workflow / new_tests_check.py harness abort before any test ran: assert build_urls, "Could not find master builds in S3" at ci/jobs/functional_tests.py:734. Master build artifacts moved under a normalized workflow-name prefix, so find_master_builds probes the old key and matches nothing, and new_tests_check.py then reds the post hook because no per-arch job reported OK or XFAIL. This diff touches no ci/ file #117580 (external, merged 2026-09-01T22:06:23Z). Both jobs started 21:10Z, about 56 minutes before that merge, so the fix is absent from the tree that ran (checked against the pre-fix and post-fix trees). I am not merging master to pick it up: the current head is the reviewer's own commit and the PR is approved, so the next update to this branch collects the fix without an extra cycle

Style check and CH Inc sync are green on this head.

Session id: cron:our-pr-ci-monitor:20260901-233000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI crash] Logical error: "Part all_57_57_0_59 intersects previous part all_43_62_5_45" in PartLoadingTree::add during ATTACH TABLE ... AS REPLICATED

4 participants