Repository navigation
Make ColumnAggregateFunction::expand exception-safe - #131733
alexey-milovidov merged 2 commits into
Conversation
`expand` (used by the short-circuit evaluation of functions like `if`) resized `data` first and then created the states of the new rows one by one. If creating a state threw (for example, on a memory limit), the column held pointers to states that were never created, and its destructor destroyed them, which crashed the server. Build the expanded array aside, destroy the states created so far on exception, and publish it only when it is complete. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [d459ebb] Summary: ✅
AI ReviewSummary
Final Verdict✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units8 translation units recompiled, 12 s compile time in total, 8 of them have a recent master baseline. |
The previous test relied on `memory_tracker_fault_probability` hitting the `Arena` growth inside the state-creation loop, which almost never happens for `groupArray` states, so it passed on unfixed builds too. Add the `column_aggregate_function_expand_exception` failpoint that throws right after `expand` creates a missing state, and use it in the test to assert the expected exception and that the server stays alive. Address review: #131733 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Backport #131733 to 26.10: Make `ColumnAggregateFunction::expand` exception-safe
Backport #131733 to 26.9: Make `ColumnAggregateFunction::expand` exception-safe
Backport #131733 to 26.8: Make `ColumnAggregateFunction::expand` exception-safe
Resolve the conflict in `src/Common/FailPoint.cpp`: keep only the `column_aggregate_function_expand_exception` failpoint added by #131733; the other failpoints from the master side do not exist on 26.3. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cherry pick #131733 to 26.3: Make `ColumnAggregateFunction::expand` exception-safe
Backport #131733 to 26.3: Make `ColumnAggregateFunction::expand` exception-safe
…pand` exception-safe
expand(used by the short-circuit evaluation of functions likeif) resizeddatafirst and then created the states of the new rows one by one. If creating a state threw (for example, on a memory limit), the column held pointers to states that were never created, and its destructor destroyed them, which crashed the server. Build the expanded array aside, destroy the states created so far on exception, and publish it only when it is complete.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix a possible crash when an exception (for example, a memory limit) is thrown during the short-circuit evaluation of a function returning an
AggregateFunctionstate.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/131733]
Version info
26.11.1.2517-master(included in26.11and later)26.10.5.48,26.9.31.13,26.8.39.12,26.3.66.9