Repository navigation
Unite ready subquery Sets in batched row-mask mutations - #133454
skuznetsov-clickhouse wants to merge 17 commits into
Conversation
Issue: ClickHouse#132056 Repeated `_row_exists` updates on Wide/Full parts evaluate prepared predicates separately, making large mutation batches CPU bound. Preserve the original mutation commands, IDs, order, Set preparation, and affected-row semantics while batching compatible actions. Unite compatible literal or ready subquery integer Sets within fixed budgets. Keep both new settings experimental and disabled by default; retain the original actions when the union admission checks decline. Verification: private Cloud build passed; 20 adjacent stateless tests passed with the typed union both OFF and ON; the ready-subquery test passed under ASan/UBSan. On a disposable SharedAggregatingMergeTree 10M-row fixture, two 4096-key OFF/ON pairs were 1.890x and 1.914x faster with unchanged task-memory peaks; 4097 keys took the original path. A 1B-row pair was 26.68x faster, with task peaks 31,802,223 B OFF and 31,600,662 B ON. These are workload-specific measurements. Remaining risk: official CI, managed multi-replica Cloud, and a confirmed cross-part cached-Set overlap remain untested. The feature does not enable any new behavior by default.
Repeated `_row_exists` mutations on large Wide/Full parts were CPU bound. The batching change must continue to respect upstream per-stage `Set` preparation, including when two stages reuse the same cached `Set`. Resolve the `MutationsInterpreter` merge around the stage-local `CreatingSets` gate, declare the upstream subquery index-limit setting, and add a two-stage cached-`Set` regression test. The original mutation commands, IDs, order, and fallback semantics remain intact. Verification on pinned upstream b166891: Release Clang 21.1.8 `ninja clickhouse` passed; eight focused stateless tests passed; finite `max_rows_in_set=128` OFF/ON control kept both union dispatch counts at zero with identical exact results. On a disposable OSS 10M-row, 64-mutation, 4096-key fixture, paired task medians were 17,707 ms OFF vs 1,376.5 ms ON (12.86x); task memory peaks were 69,300,619 B OFF vs 54,541,600 B ON (21.3% lower). Remaining risk: full CI, managed Shared/Cloud multi-replica validation, adaptive-spill runtime, and sanitizer coverage on this new base remain open. The benchmark has two samples per mode and does not measure RSS. Issue: ClickHouse#132056
The positive row-mask test used one `Tuple` column, which selects the hashed `Set` layout. The two-column fixed-width `keys256` union path had no positive SQL test. Add OFF/ON checks for the `keys256` path, both original mutation IDs, and exact physical and visible aggregate results. Verified: `bash -n`; official stateless runner 1/1 OK on the pinned 26.12.1.1 OSS build; independent test-log audit passed. Remaining risk: Cloud multi-replica and CI runs are pending. Related: ClickHouse#132056
Classic lightweight `DELETE` mutations on large `AggregatingMergeTree` parts can retain many separate membership checks during one rewrite. The first ready-subquery union path admitted only a narrow predicate shape and fixed limits. Extend the ordered row-mask batch to compatible scalar and tuple `Set` groups, preserve each original stage's build gate and mutation ID, and decline the optimization before the rewrite when a source is empty, spilling, incompatible or over a user-configured row, key-byte or group budget. Poll cancellation during large `Set` copies. Cover inserts between deletes, changing RHS snapshots, select-source variants, limits, and memory limit cleanup. Verification: focused stateless and ASan/UBSan integration checks passed; the new empty-RHS-between-stages case passed 1/1 and the focused `Code 241` cleanup/retry test passed 1/1. A two-replica disposable Shared fixture matched OFF/ON physical and visible results. Local benchmarks showed a workload-specific speedup and a 25.3 MiB higher task peak at 1,048,576 RHS keys. Official CI, TSan, managed Cloud and a fresh-master build remain open. Related: ClickHouse#132056
|
Workflow [PR], commit [63a090c] Summary: ❌
AI ReviewSummaryAdds optional, experimental batching and bounded union of compatible row-mask Findings
Tests
Final VerdictStatus: Validate the union/spill overlap under matched hard-limit headroom, or exclude spill-capable sources from union admission. LLVM Coverage ReportMeasured on commit 63a090c.
Changed lines: Changed C/C++ lines covered: 1108/1257 (88.15%) · Uncovered code |
CI exposed that ready subquery `Set` union stayed disabled under finite background limits, while several new tests depended on that path. The original gate covered both eager literal and deferred subquery unions. Keep the eager gate, then check the deferred union against row, byte and temporary-column limits after the original `Set`s and actions are prepared. Permit resident spill-capable `Set`s while holding their shared locks. Track intermediate action allocations and fix the test tag and Keeper path reported by CI. Verification: ASan/UBSan build, the 05816 stateless case, two focused `SetMemoryLimit` tests and five targeted integration cases passed on ch-vm. Full CI and spill-overlap memory stress remain to be checked. Related: ClickHouse#132056
Individually valid ready subquery `Set`s can produce a union that exceeds finite background row or byte limits. The previous path copied all keys before checking the resulting `Set`, so a tight memory limit could raise an exception before the original mutation actions were used. Pass the finite result limits into the union helper. Reject an excessive source row sum before allocating the destination, and reject estimated peak hash-table growth before copying keys. Keep the final exact checks. The preflight may conservatively skip an overlapping union that fits. Verification: x86_64 ASan/UBSan Release `clickhouse` and `unit_tests_dbms` builds; focused `SetMemoryLimit` tests (2/2); official `05816` with finite background limits (1/1); three targeted integration cases for finite row, byte and temporary-column limits. The 18 old Fast-test failures passed separately on the preceding build. Remaining risk: the current diff still needs official CI, TSan, and a hard-limit stress case for otherwise eligible spill-capable sources. Related: ClickHouse#132056
The finite `Set` byte and temporary-column limits added to the shared background profile caused the expanded-AST test to bypass the AST guard. Restore its AST-only profile and give the finite-limit tests a separate background fixture. The four affected integration selectors passed on the ASan/UBSan build (4/4); the focused `SetMemoryLimit` tests and `05816` also passed on that build. New official CI and current-`master` integration remain open. Related: ClickHouse#132056
The new `arm_tidy` report rejects two uninitialized `bool` variables in `Set::tryUniteReadyFixedWidthSets`. Initialize both to `false`. The rebuilt ASan/UBSan `clickhouse` and `unit_tests_dbms` targets passed, as did both focused `SetMemoryLimit` tests. The two-replica `05851` scenario took 15.53 s in Fast test against a 15 s limit. Tag it `no-fasttest`; its local functional run and reference comparison passed. The normal stateless CI run and a new exact-head CI pass remain open. Related: ClickHouse#132056 PR: ClickHouse#133454 CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=133454&sha=b8f815d69fc4dd84f46fc5699d4632c87ecbf7b2&name_0=PR&name_1=Build%20%28arm_tidy%2C%203%2F4%29 CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=133454&sha=b8f815d69fc4dd84f46fc5699d4632c87ecbf7b2&name_0=PR&name_1=Fast%20test
Build profile diff (arm_release)Comparing Binary sizes
The official master build is compiled with Object file sizes
|
| Object file | Master | PR | Δ |
|---|---|---|---|
src/CMakeFiles/dbms.dir/Interpreters/MutationsInterpreter.cpp.o |
1.07 MiB | 1.48 MiB | +416.39 KiB (+37.99%) |
src/CMakeFiles/dbms.dir/Processors/QueryPlan/RowMaskActionsBatchStep.cpp.o |
new | 162.07 KiB | +162.07 KiB |
src/CMakeFiles/dbms.dir/Interpreters/Set.cpp.o |
781.02 KiB | 816.02 KiB | +35.01 KiB (+4.48%) |
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.
Compile time of recompiled translation units
417 translation units recompiled, 3208 s compile time in total, 416 of them have a recent master baseline.
Symbol sizes
| Binary | Symbol | Master | PR | Δ |
|---|---|---|---|---|
programs/clickhouse |
ProfileEvents::global_counters_storage |
14.69 MiB | 14.75 MiB | +64.00 KiB (+0.43%) |
`05814` and `05815` intentionally combine `UPDATE`, `DROP COLUMN`, and `UPDATE` in one `ALTER` to test a mutation barrier. `Replicated` databases reject this mixed command before the mutation code runs (Code 392), so the DBReplicated CI variant fails deterministically. Tag only these two tests `no-replicated-database`. They keep testing the single-query barrier in supported database variants; other row-mask tests continue to run under DBReplicated. Checked: `bash -n` for `05815`, `git diff --check`, and the runner's `no-replicated-database` skip rule. Exact-head CI is pending. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=133454&sha=3209fc8cc96fb7bdc948aeba8427b6cbbbe43880&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F2%29 PR: ClickHouse#133454
The `DBReplicated` stateless job rejects the mixed `UPDATE`, `DROP COLUMN`, `UPDATE` in one `ALTER` in 05814/05815 (Code 392). The previous whole-test tag also skipped their core batching assertions in Cloud and Shared Catalog. Move only the mixed `ALTER` checks into 05854/05855 with `no-replicated-database`. Keep the off/on results and `part_log` dispatch checks in 05814/05815 for all database variants. Give the separated `part_log` assertion its own table UUID and start-time window. Verification: `bash -n` on both shell tests; three disposable `Atomic` ASan/UBSan runs passed all four cases (12/12, no skips). The test binary predates the `Set.cpp` bool initialization. Exact-head `DBReplicated` and Cloud CI remain pending. The mixed `ALTER` checks ordered results, not a same-task grouping barrier. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=133454&sha=3209fc8cc96fb7bdc948aeba8427b6cbbbe43880&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F2%29 PR: ClickHouse#133454
The split core tests use plain `MergeTree`-family engines and the standard Shared Catalog selector skips them. Add a `SharedAggregatingMergeTree` SQL test tagged `shared-catalog` so that this suite checks the mutation results with `enable_row_mask_typed_set_union` both off and on. The test covers overlapping `IN (SELECT ...)` predicates and fresh inserts at deleted keys. The private disposable Shared Catalog runner passed the exact test and reference: 1 passed, 0 skipped. The focused `Atomic` ASan/UBSan runs of the split cases passed 12/12; a `DBReplicated` preflight passed both core cases and skipped only the incompatible mixed-command barrier cases. Those ASan/UBSan runs used an earlier binary; the private Shared build is separate from the current OSS head. Exact-head CI and Cloud validation remain open. Related: ClickHouse#132056 Related: ClickHouse#133454 CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=133454&sha=3209fc8cc96fb7bdc948aeba8427b6cbbbe43880&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F2%29
`IDataType::equals` treats `Bool` and `UInt8` as equal, but a ready `Bool` `Set` converts `UInt8(2)` to true when `transform_null_in = 0`. Copying its raw key into a `UInt8` union `Set` left that row undeleted. Require the type name as well as equality before uniting keys, including tuple elements. An incompatible union declines and retains the original mutation actions. Add a stateless regression with physical row-mask and dispatch checks for `Bool` and mixed `Bool`/`UInt8` subquery sets. Tests: `05858` failed on the pre-fix ASan/UBSan binary and passed on the patched binary (one fixed-settings and three randomized-settings runs); `05839` passed on the patched binary and still dispatched valid unions. Exact-head CI and managed Cloud validation remain pending. Related: ClickHouse#132056 PR: ClickHouse#133454 Prior CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=133454&sha=3209fc8cc96fb7bdc948aeba8427b6cbbbe43880&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F2%29
The Shared Catalog result oracle could pass without exercising typed `Set` union. Assert the `MutatePart` counter for both feature modes across replicas, scoped by table UUID. Run `SYSTEM FLUSH LOGS ON CLUSTER` separately so its host-specific output does not enter the reference. Pin unrelated parallel replica modes so randomized settings do not require a missing cluster. Verification: official private two-replica `clickhouse-test --shared-catalog` passed `05857` 1/1 with fixed settings and 1/1 with randomized settings. The four parallel replica settings that caused the pre-fix fixture failure were replayed explicitly: 1/1 passed, OFF union=0, ON union=1. The pinned private binary differs from this OSS branch; exact-head CI is pending. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=133454&sha=3209fc8cc96fb7bdc948aeba8427b6cbbbe43880&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F2%29 PR: ClickHouse#133454
The temporary-column integration case expected the non-constant limit to reject a ready `Set` union, but its background profile also set `max_rows_in_set=1`. The two source rows exceeded that limit before the replacement actions could reach the column check. An existing alternative profile also rejected the query at its AST limit. Add a dedicated background profile with only `max_temporary_non_const_columns=12`. Keep the total-column case and the unlimited positive control in the same test. Verification: the official targeted amd ASan/UBSan integration run passed 1/1 with no skips on the pinned binary. Source restoration and scoped Docker cleanup passed. The full module and exact-head CI remain to be checked. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=133454&sha=3209fc8cc96fb7bdc948aeba8427b6cbbbe43880&name_0=PR PR: ClickHouse#133454
The wide negative case could report zero union batches if the original-action precheck rejected the mutation before the replacement-column check. Add a same-profile, same-schema narrow positive control that dispatches one union under `max_temporary_non_const_columns = 12`. Together with the existing four-group zero-dispatch case, this distinguishes replacement width from original-action rejection. The official targeted amd ASan/UBSan integration run passed the new control 1/1 with no skips; the prior five-node module passed 29/29 on the same binary. The exact new-head CI and managed Cloud validation remain pending. Related: ClickHouse#133454 CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=133454&sha=3209fc8cc96fb7bdc948aeba8427b6cbbbe43880&name_0=PR
| const auto is_ready_in_memory = [](const Set & set) | ||
| { | ||
| /// The caller holds the shared lock. A spill can start concurrently, but it cannot replace | ||
| /// the table until the lock is released. | ||
| return set.isCreated() && !set.isTruncated() && set.data && !set.data->empty() | ||
| && !set.disk_set && !set.spill_after_build_started.load(); |
There was a problem hiding this comment.
[Major] Validate spill-capable unions under hard memory pressure
This admits resident sources configured to spill, while the destination created below has no spill settings. The original actions retain the source sets, and copying holds a source shared lock while allocating and rehashing the destination. A concurrent after-build spill can therefore allocate its disk-set state before it can release the original table. The destination's max_result_bytes check does not account for this overlap or the remaining query hard-limit headroom.
ReadyUnionReleasesMemoryAfterLimitException checks cleanup after an expected allocation failure, and ReadyUnionCopiesSpillCapableSetUntilItSpills spills only after the copy completes. Neither validates the overlap. The PR description also says the lower-cap OFF/ON runs had different effective headroom.
Please add a focused overlap test or controlled same-build mutation run with a matched effective hard limit, positive union dispatch and actual spill pressure, checking exact masks/aggregate results and cleanup/retry. Alternatively, keep spill-capable sources ineligible until this path is validated.
`mutations_sync` can finish before `MutatePart` is visible in `system.part_log`. The test's single flush could race with log publication. Poll for both UUID-scoped rows with a 60-second deadline, then retain the OFF/ON dispatch-counter checks. Verification: `bash -n` and `git diff --check` passed. The official private two-replica `clickhouse-test` passed 05857 twice (r29 and r30); r30 also passed the guarded controller and cleanup checks. Remaining risk: exact-head OSS CI has not completed. Related: ClickHouse#132056
Mutation completion can precede publication of its MutatePart entry. 05837 asserted after one log flush, while 05853 reused the mutation completion deadline for the log wait. Under load, either dispatch check could observe no entry even after a successful mutation. Poll the UUID-scoped entry for up to 60 seconds in 05837 and give the 05853 log wait its own 60 seconds. Keep the existing dispatch and result assertions and references unchanged. Verification: bash -n, git diff --check, and official clickhouse-test 05837 and 05853 (2/2) on x86_64 Release ASan/UBSan binary 089273428869471ec78c465768876c49eedc06ebb6551a49b884555d958b3495. Exact PR-head CI remains pending. Related: ClickHouse#132056
Classic lightweight
DELETEstatements on largeAggregatingMergeTreeparts can retain many separate row-mask predicates in one part mutation. This extends the existing ordered row-mask executor with an optional specialization for compatible, already-builtIN (SELECT ...)Setobjects. It unions the typed keys once for the main part scan while preserving the original mutation IDs, per-stageSetbuild gates, command order and fallback when a source is empty, already spilling, incompatible or over budget. The feature defaults to off. Table settings bound the admitted source rows, raw key bytes and number of groups. Under finite background limits, the deferred union first checks a conservative bound on result rows and peak hash-table growth, then checks the resultingSetand replacement actions against the row, byte and temporary-column limits.The specialization is limited to compatible positive
INpredicates and supported fixed-width integer or tuple keys. Arbitrary row-mask predicates,NOT IN, external, already spilled and actively spillingSetsources use the original actions. Existing tests cover interleaved inserts and changing subquery results; a combinedDELETE ... IN PARTITIONfallback test is still missing. This PR remains a draft pending integration with currentmasterand broader validation.The preceding ASan/UBSan build passed the full
test_mutation_row_mask_set_limitintegration module (29/29). A local replay of all 18 previously failing Fast-test cases passed on that build: 15/15 in the finite-limit batch, plus03999,05853and the Keeper-backed05851individually (1/1 each). The05851test and reference comparison passed, but its test controller reported a port still unavailable immediately after server shutdown; a later check found all owned ports free. The earlier exact-head Fast CI timed05851at 15.53 s, above its 15 s limit, so it is taggedno-fasttest. On the current ASan/UBSan build with the pre-copy finite-limit guard, two focusedSetMemoryLimittests passed (2/2), official05816passed under finite background limits (1/1), and the three targeted integration cases for row, byte and temporary-column limits passed (3/3). After restoring the expanded-AST-only background profile and separating finite byte/column limits into a new fixture, four affected integration cases passed (4/4) on that same binary. After initializing the two variables flagged by exact-headarm_tidy,clickhouseandunit_tests_dbmsrebuilt cleanly; both focusedSetMemoryLimittests passed (2/2) on the rebuilt ASan/UBSan binary. Earlier focused RHS-empty andCode 241cleanup/retry tests also passed. A private two-replicaSharedAggregatingMergeTreefixture passed the changing-RHS correctness oracle. On3209fc8, Style, Fast and all fourarm_tidyshards passed; Fast skipped05851as tagged. The ordinary targeted stateless CI then passed0585137/37 on arm ASan/UBSan and 39/39 on amd ASan/UBSan. Praktika run. The targeted ASan/UBSan, TSan and MSan integration jobs passed on that head.05814and05815failed inDBReplicatedCI because a mixedALTERis prohibited there. The earlier whole-test tag also skipped their core checks in Cloud and Shared Catalog. Commit98de305moves only the mixed-command cases to tagged05854/05855; the untagged core tests remain eligible underDBReplicatedand Cloud runner flags. The standard Shared Catalog selector still skips those tests because they use plainMergeTreeengines. A separateSharedAggregatingMergeTreetest,05857, checks result correctness and theRowMaskReadySubquerySetUnionBatchescounter across two replicas: OFF must remain zero and ON must be positive. Its final.shform suppresses host-specificSYSTEM FLUSH LOGS ON CLUSTERoutput and pins unrelated parallel replica modes. The official private two-replicaclickhouse-test --shared-catalogrunner passed the final file 1/1, zero skips, with randomized settings; a separate 1/1 replay forced the four parallel replica settings that had previously failed on the disposable fixture. Thepart_logrecorded OFF union=0 and ON union=1. The private binary is pinned but differs from this OSS branch. After commit9bc50f7added bounded waiting forpart_log, the official two-replica runner passed the updated05857twice (1/1 each, exact reference, OFF union=0 and ON union=1). The final guarded run returned success and removed its owned Docker resources; the preceding official test passed but its disposable controller rejected a stale script SHA. Exact-head OSS CI for9bc50f7was still running when the following test-only change was prepared. Three disposableAtomicASan/UBSan runs of the four split cases passed (12/12, no skips). A disposableDBReplicatedrun with the CI profile passed05814/05815and skipped05854/05855as tagged; its pinned ASan/UBSan binary predates the latest C++ commit. Exact-headDBReplicated, Cloud and Shared Catalog CI remain pending. The mixed-command cases check orderedALTERresults; they do not directly prove the same-task grouping barrier. A same-build ASan/UBSan regression reproduced aBool/UInt8mismatch: with typedSetunion enabled, a physical key 2 remained visible after aBoolsubquerySetdelete. Commitd078c31055dmakes incompatible key types decline the union and retain the original mutation actions. The focused05858test passed 1/1 with fixed settings and 3/3 with randomized settings on the patched ASan/UBSan binary;05839passed 1/1 and still dispatched compatible unions. One randomized disposable run initially stopped on a missingparallel_replicascluster before checking the result; the test now disables parallel replicas only for its verification queries. The separate04780allocation-oracle flake is addressed by the open PR linked below. Integration with currentmasterand managed Cloud Dev/Stage remain open.Commit
63a090cadds bounded waiting for the UUID-scopedMutatePartentry in05837and starts a separate log-publication deadline in05853; the dispatch assertions and reference output are unchanged. The official disposable x86_64 Release ASan/UBSan runner passed both updated cases 2/2, followed by five fresh cycles with 10/10 passes and no sanitizer or OOM findings. Exact-head Praktika passed05837in Fast, amd_debug and arm_binary parallel (1/1 each), then 50/50 times in arm ASan/UBSan;05853passed 5/5 in arm_binary sequential. Three more official private two-replica Shared Catalog cycles passed the updated058573/3, for five official passes including the two earlier cycles, with exact references and OFF/ON union counts of 0/1. The standard OSS CI route skips05857because it requires Shared Catalog. The pinned local and private binaries differ from the exact PR binary; broader exact-head CI remains in progress.A full-diff review found that the non-constant temporary-column test was not reaching its intended limit:
max_rows_in_set=1rejected the two source rows first. An initial test-only correction still failed because its reused profile had an expanded-AST cap, which raised aCode 36exception before the column check. Commit4a26611uses a dedicated background profile withmax_temporary_non_const_columns=12and no competing row or AST cap. The official targeted amd ASan/UBSan Praktika integration run passed 1/1 with no skips on the pinned binary, checking zero union dispatch for both temporary-column caps and positive dispatch on the unlimited control. The full five-node module then passed 29/29, without skips or sanitizer errors. A new same-profile, same-schema positive control passed 1/1 with union dispatch under the limit of 12; paired with the wide case's zero dispatch, this checks that the original actions fit and the wider replacement is rejected. The full-module run preceded that positive control; exact-head CI remains pending. These test-only changes have no new speed or peak-memory measurement.On earlier private candidate binaries, paired 10-million-row/8192-key runs had median
MutateParttimes of 6391 ms with the feature off and 1066.5 ms with it on (5.99x); median tracked mutation-task peaks were both about 40.4 MB. Two accepted opposite-order 1-billion-row/1024-key pairs observed about 22.27x lower task time with the feature on, with task peaks of roughly 33–34 MB in both modes. One OFF task overlapped delayed part cleanup, so that pair is less isolated. An earlier private binary's 2.1-million-row/1,048,576-key calibration took 1268 ms OFF and 365 ms ON (3.47x), while its tracked task peak rose from 81.1 MB to 107.6 MB (+25.3 MiB). These are local workload results, not a general latency distribution or a measurement of the latest finite-limit guard; large RHS unions have a measurable memory cost. A residentSetconfigured to spill may be copied before its spill starts, so hard-limit headroom during that overlap remains unverified. The cancellation-poll change was checked separately on ASan/UBSan: its paired 10-million-row time ranges overlapped, with a 0.56% median difference and effectively identical task peaks. A lower-cap pair passed in both modes, but effective memory headroom differed, so failure and retry close to the hard limit remain unresolved.A separate same-binary Release comparison isolated standalone action batching: typed
Setunion and singleton coalescing were both off, with one 64-commandALTERover each fresh 10-million-row Wide/FullAggregatingMergeTreepart and 4,096 RHS keys. The balanced OFF/ON/ON/OFF x2 run passed 8/8 exact mask and aggregate oracles; every sample built 64 subquerySetvalues, kept one mutation ID, and dispatched action batching only when enabled. MedianMutateParttime was 3805 ms OFF versus 3726 ms ON (2.08% lower); wall time 3.878 versus 3.825 s (1.37% lower); whole owned-server CPU 6.225 versus 6.110 s (1.85% lower); task peak memory 24,670,435 versus 24,670,499 bytes (effectively equal). All four ON task times were below all OFF task times, but the preregistered 10% task and wall criterion was not met, so a material standalone benefit is not established. The pinned Release binary (SHA-256215f5d3e9ac301144c79a76e33eaea1a7bee84dd7a3481167027e552644909a6) predates only the current branch'sBooltyped-union guard among changed C++ files; typed union was disabled in both arms. Cache was uncontrolled, there were four samples per arm, and the peak is task memory rather than RSS.Related: #132056
Related: #132825
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add an optional, bounded union of compatible ready subquery
Setobjects for classic lightweightDELETEmutations onMergeTree-family tables, includingAggregatingMergeTree, to reduce repeated membership checks while rewriting a part. The optimization is disabled by default.Workflow [PR]
Sync PR [sync-upstream/pr/133454]