Skip to content

Cherry pick #86422 to 25.7: Fix leaking of MergesMutationsMemoryTracking and fix query_views_log for streaming#86465

Merged
robot-clickhouse merged 3 commits intobackport/25.7/86422from
cherrypick/25.7/86422
Sep 1, 2025
Merged

Cherry pick #86422 to 25.7: Fix leaking of MergesMutationsMemoryTracking and fix query_views_log for streaming#86465
robot-clickhouse merged 3 commits intobackport/25.7/86422from
cherrypick/25.7/86422

Conversation

@robot-clickhouse
Copy link
Copy Markdown
Member

Original pull-request #86422

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

azat added 3 commits August 29, 2025 23:27
This place forgot to call
background_memory_tracker.adjustOnBackgroundTaskEnd(), like we do for
merges/mutations and this may lead to significant drift in
MergesMutationsMemoryTracking, which later will lead to TOO_MANY_PARTS,
because merges will stop.

At first I actually added it (adjustOnBackgroundTaskEnd()) but later
decided that it is wrong, merges/mutations should not take care about
Buffer flushes.

Note, maybe it will be a good idea to have a RAII for return value of
createForBackgroundProcess() that will take care of
adjustOnBackgroundTaskEnd(), but but this is not can be tricky since you
need to make sure that there are no users of it (i.e.
ThreadGroupSwitcher already finished).
It has been removed in the previous patch from
StorageBuffer::backgroundFlush(), but, it is required for
query_views_log.

So let's get it back, but in a more generic fashion.
Fix leaking of MergesMutationsMemoryTracking and fix query_views_log for streaming
@robot-clickhouse robot-clickhouse added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Sep 1, 2025
@robot-clickhouse robot-clickhouse merged commit 63a105a into backport/25.7/86422 Sep 1, 2025
121 of 146 checks passed
@robot-clickhouse robot-clickhouse deleted the cherrypick/25.7/86422 branch September 1, 2025 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants