Skip to content

Stabilize storage memory profiler many-parts scenario - #119706

Merged
qoega merged 1 commit into
ClickHouse:masterfrom
qoega:codex/stabilize-storage-memory-many-parts
Sep 13, 2026
Merged

qoega merged 1 commit into
ClickHouse:masterfrom
qoega:codex/stabilize-storage-memory-many-parts

Conversation

@qoega

@qoega qoega commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Stops background merge selection in the storage memory profiler's many-parts scenario before inserting the parts. This prevents temporary background allocations from crossing heap-profile checkpoints and producing equal and opposite false differences in adjacent scenarios.

Related: #119480

CI report: https://s3.amazonaws.com/clickhouse-test-reports/PRs/119480/5d231d28a46818502ba21e1aea90437e3c99586e/pr/storage_memory_check/storage_memory_report.html

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

Prevent spurious storage memory profiler differences caused by background merge selection.


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

Version info

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

@clickhouse-gh

clickhouse-gh Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d634e66]

Summary: ✅


AI Review

Summary

Stops background merge selection for the storage-memory profiler's 07_many_parts.sql scenario before inserting the 1000 one-row parts. The linked storage-memory report shows the false diff came from StorageMergeTree::selectPartsToMerge allocations that then canceled out in 08_parts_analysis.sql, so the added SYSTEM STOP MERGES matches the observed failure mode and I did not find a correctness or lifecycle issue in the updated scenario sequence.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Sep 12, 2026
@qoega
qoega added this pull request to the merge queue Sep 13, 2026
Merged via the queue into ClickHouse:master with commit 00260f9 Sep 13, 2026
176 checks passed
@qoega
qoega deleted the codex/stabilize-storage-memory-many-parts branch September 13, 2026 09:14
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 13, 2026
aparajita31pandey pushed a commit to aparajita31pandey/ClickHouse that referenced this pull request Sep 27, 2026
…scenario

Every MergeTree table's BackgroundJobsAssignee keeps running
StorageMergeTree::scheduleDataProcessingJob on the schedule pool, and a pass
with nothing to merge still builds a merge predicate, a parts collector and
ranges (~1.3 KB in the release profiler binary) that it frees on return. The
storage profiler dumps the heap as soon as a scenario file returns, so a pass
running at that dump on one arm is charged to that scenario and credited back
at the next one: a conserved adjacent pair. `06_dictionary.sql` has an 80 KB
baseline, so one pass clears both the 1,024-byte and the 1 % bar. Production
reports on trees that already contain ClickHouse#120487 and ClickHouse#121364: ClickHouse#122127 `06`
+1,296 and ClickHouse#120444 `06` +1,184, each exactly the rows of one selection pass,
with `07` the same rows negated.

Stop merges on each scenario table once nothing merges or mutates it any
more, as ClickHouse#119706 did for `test_many_parts`: on `test_mt` after its last
mutation at the end of `04`, and on `test_mt_2` / `test_mt_3` right after
their CREATE in `05`. With the blocker set, scheduleDataProcessingJob returns
before selectPartsToMerge. After `mutations_sync = 2` returns, the mutation
task is in NEED_FINISH, which has no cancellation check, so the STOP in `04`
aborts nothing. Both arms of a run read this checkout's scenario files, so the
change is symmetric from the first run. `test_mt` stays exposed in `01`..`03`,
where it must merge and mutate.

Validated locally with one Debug build (no C++ in the diff): a clickhouse
local probe of `01`..`05` counts 26-30 selection ranges in a 6 s idle window
without the change, 0 with it, and 9-10 with any one STOP removed; with a
1,000-partition probe table, profiler dumps catch a selection pass in flight
in 10 of 20 dumps without its STOP and 0 of 20 with it; a real +64 KiB
allocation in `06` still FAILs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-dev-tooling Developer and operator tooling that is not part of the server: the standalone utilities in utils/... and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-dev-tooling Developer and operator tooling that is not part of the server: the standalone utilities in utils/... pr-ci 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.

2 participants