Repository navigation
Conversation
|
Workflow [PR], commit [2e19d3e] Summary: ✅
AI ReviewSummaryThis PR correctly defers most Findings
Final VerdictNeeds changes before merge. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 228/230 (99.13%) · Uncovered code |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 207/211 (98.10%) · Uncovered code |
…parent-limit-rollback
azat
left a comment
There was a problem hiding this comment.
Looks way cleaner now, thanks. Take a look at some comments
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units364 translation units recompiled, 3347 s compile time in total, 364 of them have a recent master baseline. |
…parent-limit-rollback # Conflicts: # src/Common/MemoryTracker.cpp
9b26803
|
@seva-potapov @azat Is it possible to backport to 26.2 as well? If yes, please add label |
Backport #110784 to 26.7: Fix memory tracker leak when a parent tracker throws MEMORY_LIMIT_EXCEEDED
…er throws MEMORY_LIMIT_EXCEEDED
…rent tracker throws MEMORY_LIMIT_EXCEEDED
Backport #110784 to 26.3: Fix memory tracker leak when a parent tracker throws MEMORY_LIMIT_EXCEEDED
MemoryTracker::allocImplincrementsamountoptimistically at each level and then recurses into the parent tracker. When some ancestor (typically the total server tracker) threwMEMORY_LIMIT_EXCEEDED, only the throwing tracker reverted its own counter. All descendant trackers that had already incremented (thread, query, user) kept the rejected amount forever, together with the already-appliedCurrentMetricsupdates. Under sustained memory pressure this driftsMemoryTrackingand the query/user accounting upward and can produce spuriousMEMORY_LIMIT_EXCEEDEDerrors for queries that use little memory.Now every level undoes its own increment when the allocation fails anywhere in the chain, and the side effects (peak update, memory profiler trace, metric update) are committed only after the whole parent chain has accepted the allocation. As a consequence, rejected allocations no longer emit
TraceType::Memoryprofiler events, no longer advance the profiler step, and no longer raisepeak_memory_usage. Concurrent speculative charges may still affect these values.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix an accounting leak in memory tracking: when an allocation was rejected by a parent memory tracker (for example, the server-wide memory limit), the thread, query, and user level trackers kept the rejected amount. The error accumulated over time, inflating
MemoryTrackingand per-query/per-user memory usage, and could lead to spuriousMEMORY_LIMIT_EXCEEDEDerrors.Version info
26.7.14.29,26.3.33.143