Skip to content

Show compression codec in system.parts_columns - #108775

Closed
mekilis wants to merge 20 commits into
ClickHouse:masterfrom
mekilis:smart/parts-columns-compression-codec
Closed

mekilis wants to merge 20 commits into
ClickHouse:masterfrom
mekilis:smart/parts-columns-compression-codec

Conversation

@mekilis

@mekilis mekilis commented Jun 28, 2026 •

Copy link
Copy Markdown

Add a compression_codec column to system.parts_columns so users can inspect the codec reported for each column of each data part.

The value is the column's own CODEC(...) from the table metadata when it has one, and the default compression codec of that data part (persisted per part in default_compression_codec.txt, and following the default_compression_codec setting or the <compression> configuration) otherwise. Since the codec a part was actually written with is not persisted per column, a part written before an ALTER TABLE ... MODIFY COLUMN ... CODEC and not yet rewritten by a merge or mutation still holds the previous codec on disk; the column reports the current definition for it.

An earlier revision persisted exact per-column codecs in a new column_compression_codecs.txt file in every part. That was dropped because it cost one extra file, one more object/PUT per part on object storage, about 100 bytes of metadata in every MergeTree part, and a replication protocol version bump. That is too much permanent write-path overhead for an observability column.

Closes: #37311

Changelog category (leave one):

  • Improvement

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

Added a compression_codec column to system.parts_columns, showing each column's declared CODEC(...) or the part's default compression codec. After ALTER TABLE ... MODIFY COLUMN ... CODEC, existing parts follow the current column definition until they are rewritten by a merge or mutation.

Documentation entry for user-facing changes

  • Documentation is written

@CLAassistant

CLAassistant commented Jun 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Jun 29, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2f94b2f]

Summary: ✅


AI Review

Summary

This PR adds system.parts_columns.compression_codec and documents it, but the current implementation resolves explicit codecs from current table metadata instead of the bytes stored in each part. Because the linked use case is tracking ALTER ... MODIFY COLUMN ... CODEC progress across old and new parts, I do not think the current behavior is ready to merge.

PR Metadata
  • Changelog category: Improvement matches the change.
  • Changelog entry: The current text overstates the feature because it omits the main caveat: after ALTER TABLE ... MODIFY COLUMN ... CODEC, existing parts are reported with the new definition before they are rewritten. Suggested replacement: Added a \compression_codec` column to `system.parts_columns`, showing each column's declared `CODEC(...)` or the part's default compression codec; after `ALTER TABLE ... MODIFY COLUMN ... CODEC`, existing parts follow the current definition until they are rewritten by a merge or mutation.`
Findings

❌ Blockers

  • [src/Storages/System/StorageSystemPartsColumns.cpp:29-48, src/Storages/System/StorageSystemPartsColumns.cpp:380, tests/queries/0_stateless/04416_system_parts_columns_compression_codec.sql:52-60, tests/queries/0_stateless/04416_system_parts_columns_compression_codec.reference:9] [dismissed by author -- https://github.com/Show compression codec in system.parts_columns #108775#discussion_r3491808592] The linked issue asks for system.parts_columns to show which codec each part column is actually stored with so users can watch ALTER ... MODIFY COLUMN ... CODEC progress. The new helper instead resolves any explicit CODEC(...) from current table metadata, and the new after_alter test locks in that an old part still stored with LZ4 is reported as ZSTD(3) immediately after the metadata-only ALTER. That makes pre-rewrite and post-rewrite parts indistinguishable, so the main use case is still broken. Suggested fix: either preserve exact per-part column codecs, or fail closed for parts whose metadata version predates a codec change instead of reporting the new definition as if it were on disk.
Final Verdict

Changes requested.

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Jun 29, 2026
mekilis added 2 commits June 29, 2026 09:06
Previous run passed the change-related checks, but failed on unrelated fuzz/stress failures:

- AST fuzzer: `Logical error: row < chunk.getNumRows()`

- Stress test `arm_msan`: `Block structure mismatch in A stream`

- BuzzHouse `arm_asan_ubsan`: `Distributed task iterator is not initialized`

- Stress test `amd_asan_ubsan`: ASan in `StringHashTable`/`PositionListBuilder`
Store per-column codec descriptions in part metadata and use them before falling back to compressed stream headers. Preserve the metadata during mutations and gate it behind a new replication protocol version.

Tested with: ninja -C build_local clickhouse

Tested with: build_local/programs/clickhouse local --multiquery < tests/queries/0_stateless/04416_system_parts_columns_compression_codec.sql
mekilis added 2 commits June 29, 2026 17:54
Read `system.parts_columns.compression_codec` from per-part `column_compression_codecs.txt` metadata when it is available, and leave the value empty for legacy parts without exact metadata.

During mutations, preserve existing sidecar entries and overlay codecs only for semantically changed columns. Also include `column_compression_codecs.txt` in fast part removal and add focused stateless coverage for legacy sidecars and materialized-column codec changes.
The new per-part `column_compression_codecs.txt` file is synced together with the rest of the inserted part files, so `02361_fsync_profile_events` should expect one additional `FileSync` event.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108775&sha=48ae9d3238e2d9ec3de6ba89f88a5f18e912dffb&name_0=PR&name_1=Fast%20test

PR: ClickHouse#108775
Collect codec metadata from vertical merge column streams before finalizing the part, and add a regression test for gathered columns.

Also make the codec stateless tests deterministic under random MergeTree settings and fix the arm_tidy warning in the mutation codec metadata helper.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108775&sha=99ada652d291796963b215add9314b66621b6769&name_0=PR&name_1=Build%20%28arm_tidy%29

Related: ClickHouse#108775
@scanhex12 scanhex12 self-assigned this Jun 29, 2026
Comment thread src/Storages/MergeTree/MutateTask.cpp Resolved
mekilis added 2 commits June 29, 2026 20:35
For compact and non-full mutations, preserve source column compression metadata first, then overlay the codecs reported by the writer for every column physically written into the new part. This keeps hardlinked wide columns on their source metadata while avoiding stale sidecar entries for compact streams rewritten as internal read columns.

Add a focused stateless regression for a compact part whose column codec changes from LZ4 to ZSTD(3) before mutating another column.

Related: ClickHouse#108775

Related: ClickHouse#108775 (comment)
Account for the `column_compression_codecs.txt` sidecar in S3/plain drop-table listings, filesystem-cache file counts, and S3 request counts.

Normalize trailing blank lines from `clickhouse-disks` in the `02980` S3 plain tests.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108775&sha=400e7a6b09c23a2e84f2a608af58925f892a0307&name_0=PR

Related: ClickHouse#108775
Comment thread src/Storages/MergeTree/MutateTask.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Dear @scanhex12, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

…-compression-codec

# Conflicts:
#	src/Storages/MergeTree/DataPartStorageOnDiskBase.cpp
#	src/Storages/MergeTree/DataPartsExchange.cpp
#	src/Storages/MergeTree/MutateTask.cpp
#	src/Storages/System/StorageSystemPartsColumns.cpp
#	tests/queries/0_stateless/02117_show_create_table_system.reference
`system.parts_columns.compression_codec` is served entirely by
`IMergeTreeDataPart::getColumnCompressionCodecDescription`, which reads the
exact codec descriptions from `column_compression_codecs.txt` and reports an
empty value when that file is absent.

The earlier iteration of this PR reconstructed a codec from the compressed
block header of the data stream. That path lost codec parameters (`ZSTD(3)`
was reported as `ZSTD(1)`, `LZ4HC(9)` as `LZ4`) and was superseded by the
metadata file, but the code was left behind with no callers:

* `IMergeTreeDataPart::getColumnCompressionCodec` and its
  `MergeTreeDataPartWide` / `MergeTreeDataPartCompact` overrides,
* `MergeTreeDataPartCompact::loadColumnCompressionCodecs` together with its
  per-part codec cache and mutex,
* the `offset_in_compressed_file` overload of `getCompressionCodecForFile`.

Removing them also removes a stale `MergeTreeMarksLoader` construction that no
longer matched the constructor after `use_streaming_compression_` was added on
master, which is what broke the build.
`MutationsInterpreter::getColumnsChangedByMutation` has no callers: the codecs
of a mutated part are collected from the writer itself in
`collectColumnCompressionCodecsForMutatedPart`, not from the interpreter's view
of which columns a mutation touches.

The `read_for_internal_compact_mutation` flag on `MutationCommand` existed only
to keep the internal `READ_COLUMN` commands that carry unchanged data through a
compact-part rewrite out of that set, so it goes away with it.
@alexey-milovidov
alexey-milovidov requested a review from a team as a code owner August 1, 2026 03:00
The column list in `parts_columns.md` was missing `estimates.default_count`,
which master added to `system.parts_columns` while this PR was open.
… part

Persisting the exact codec of every column of every part cost one extra file
(`column_compression_codecs.txt`) in every MergeTree part: one more object and
one more `PUT` per part on object storage, ~100 more bytes of part metadata, a
new replication protocol version, and matching entries in the fetch, hardlink
and directory-removal paths. That is a lot of permanent write-path overhead for
an observability column.

Report instead what the column resolves to now: its own `CODEC(...)` from the
table metadata when it has one, and the part's default compression codec
(already persisted in `default_compression_codec.txt`) otherwise. The value is
therefore exact for every part that has not survived a codec change, and
follows the current definition for the ones that have.

This reverts all of the write-path machinery, the replication protocol bump and
the test expectations that counted the extra file.
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Rebased on master (conflicts with INVALIDATED_SYSTEM_COLUMNS and estimates.default_count) and reworked the approach.

The build was failing because MergeTreeMarksLoader gained a use_streaming_compression_ parameter on master. Tracing that call site showed it belonged to a codec-reconstruction fallback that no longer had any callers, together with MutationsInterpreter::getColumnsChangedByMutation and the read_for_internal_compact_mutation flag — all leftovers from earlier revisions.

More importantly, the per-part column_compression_codecs.txt metadata file has been dropped. It cost one extra file in every MergeTree part — one more object and one more PUT per part on object storage, ~100 bytes more part metadata (visible in this PR's own test churn: test_http_limits had to raise its hard limit from 10 to 11, max_suspicious_broken_parts_bytes from 1000 to 1200, the filesystem-cache reference from 9 to 10 entries) — plus a replication protocol version bump. That is too much permanent write-path overhead for an observability column.

compression_codec is now derived: the column's own CODEC(...) from the table metadata when it has one, and the part's default compression codec (already persisted in default_compression_codec.txt) otherwise. The tradeoff is documented on the column and in parts_columns.md: a part written before an ALTER TABLE ... MODIFY COLUMN ... CODEC and not yet rewritten by a merge or mutation still holds the previous codec on disk, and the column reports the current definition for it.

The diff is now one file plus docs and a test. cc @mekilis

@mekilis

mekilis commented Aug 1, 2026

Copy link
Copy Markdown
Author

🕵 Rebased on master (conflicts with INVALIDATED_SYSTEM_COLUMNS and estimates.default_count) and reworked the approach.

The build was failing because MergeTreeMarksLoader gained a use_streaming_compression_ parameter on master. Tracing that call site showed it belonged to a codec-reconstruction fallback that no longer had any callers, together with MutationsInterpreter::getColumnsChangedByMutation and the read_for_internal_compact_mutation flag — all leftovers from earlier revisions.

More importantly, the per-part column_compression_codecs.txt metadata file has been dropped. It cost one extra file in every MergeTree part — one more object and one more PUT per part on object storage, ~100 bytes more part metadata (visible in this PR's own test churn: test_http_limits had to raise its hard limit from 10 to 11, max_suspicious_broken_parts_bytes from 1000 to 1200, the filesystem-cache reference from 9 to 10 entries) — plus a replication protocol version bump. That is too much permanent write-path overhead for an observability column.

compression_codec is now derived: the column's own CODEC(...) from the table metadata when it has one, and the part's default compression codec (already persisted in default_compression_codec.txt) otherwise. The tradeoff is documented on the column and in parts_columns.md: a part written before an ALTER TABLE ... MODIFY COLUMN ... CODEC and not yet rewritten by a merge or mutation still holds the previous codec on disk, and the column reports the current definition for it.

The diff is now one file plus docs and a test. cc @mekilis

Thanks @alexey-milovidov, this makes sense to me. The sidecar approach did solve the exact per-part tracking case, but I agree the extra file/object per part and protocol churn are too much overhead for this observability column.

I’m fine with this direction, thanks once again!

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 @groeneai, investigate the failure: https://github.com/ClickHouse/ClickHouse/actions/runs/30681635595/job/91333852497 and provide a fix in a separate PR. If the fix is already in progress, link it here.

AST fuzzer (arm_asan_ubsan) — Logical error: 'Not-ready Set is passed as the second argument for function 'globalIn'' (STID 0250-4e52), crashing in FunctionIn::executeImpl (src/Functions/in.cpp:116) on a fuzzed globalIn over system.part_log / system.columns.

Not a regression from this PR — the diff here is one system-table source file that adds a compression_codec column to system.parts_columns and cannot reach set preparation. CIDB shows this exact STID firing on unrelated PRs every couple of days for the last month, including pull_request_number = 0 (master) on 2026-07-20 and 2026-07-10:

SELECT toStartOfDay(check_start_time) AS day, count() AS n, groupUniqArray(pull_request_number) AS prs
FROM checks
WHERE check_start_time > now() - INTERVAL 30 DAY
  AND test_name LIKE '%0250-4e52%' AND test_status IN ('FAIL','ERROR')
GROUP BY day ORDER BY day DESC

Note that #102803 tracked this same STID and was closed on 2026-04-15, but it clearly still reproduces. The wider family is tracked by the open #107619, with open fix attempts in #109722 and #102192.

@clickhouse-gh

clickhouse-gh Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.50% 86.50% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 78.70% 78.70% +0.00%

Changed lines: Changed C/C++ lines covered: 23/24 (95.83%) · Uncovered code

Full report · Diff report

@groeneai

groeneai commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Thanks - investigated. The globalIn variant is a documented, intentional exclusion of your own merged #107924, not a residual that #109722 or #102192 reaches.

Excluded by design. FutureSetFromSubquery::buildOrderedSetInplace takes the non-destructive clone path only when set_and_key->external_table is null (src/Interpreters/PreparedSets.cpp:499). GLOBAL IN always has one, so it keeps the destructive build. That has its own commit, d3cc487ea467 ("Keep GLOBAL IN external table on the destructive in-place set build path"), and the source comment gives the reason: the external table must be streamed during the pipeline run to enforce max_rows_to_transfer and to materialize the rows actually sent to shards, which is not the same as replaying set elements once use_index_for_in_with_subqueries_max_values is exceeded.

Neither open PR covers it. #102192 does not touch PreparedSets.cpp at all (44 files, 0 occurrences of external_table or GLOBAL); its 11 new clone() overrides cannot reach a branch that never attempts a clone. #109722 is branched off your #107924 head and carries the same exclusion (it is also redundant now that #107924 merged; happy for you to close it).

Reproduced deterministically on a fix-containing build - master a3d543df3e11, served buildId() asserted equal to the binary's build id, using your failpoint prepared_sets_build_ordered_set_inplace_fail over a two-shard Distributed table:

arm result oracle
local IN, failpoint off / on 500 / 500 500 (#107924 recovers it)
GLOBAL IN, failpoint off 1000 1000
GLOBAL IN, failpoint on, analyzer 1000 1000
GLOBAL IN, failpoint on, enable_analyzer = 0 0 1000

So the excluded branch has two faces: silently wrong results on the old analyzer, and the LOGICAL_ERROR the fuzzer reaches. MATERIALIZED CTEs and system-table subqueries, the other non-clonable shapes, were clean in every arm.

Correction 1: both hits you cited as master predate the fix. a88fda94bd13 (07-10) is true master but is not a descendant of the #107924 merge 9685248855ae; c7879acb8c8b (07-20) has head_ref = 26.6, a release branch that does not contain d3cc487ea467. pull_request_number = 0 alone counts release branches as master - the branch is in head_ref. Since the merge there are zero true-master rows for the family in 45 days.

Correction 2: #102803 was closed 2026-07-12, by you, not 04-15 - the day after #107924 merged, so as fixed by it. Correct for the paths it covers; this row is the excluded branch. Not reopened, that call is yours.

Keyed on the message rather than one STID hash (the family spans 6 STIDs and 8 IN spellings, so a per-STID filter under-reports it): before the merge 266 rows / 202 PRs / 20 true-master / 11.1 per day; after, 77 / 64 / 0 / 3.7. The fix held for trunk; globalIn is 10 rows over 10 PRs since.

I will send a separate PR under #107619. The exclusion comment raises a real constraint - the external table has to be written during the run, so cloning the source is not enough - so my intended direction is to let the deferred build rebuild the external table when the speculative pass fails silently, keeping the streaming write and transfer limits on the speculative pass. If you would rather the speculative in-place build were skipped entirely for the external-table case, say so and I will do that instead.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/PRs/108775/2f94b2fff9b5f77279ce379c3a6180a10b2d166d/stress_test_arm_tsan/job.log and provide a fix in a separate PR. If the fix is already in progress, link it here.

Stress test (arm_tsan) — the server stopped answering SELECT 1 during teardown. The hung check never actually ran; it aborted at prepare:

Failed to prepare for hung check: Cannot drop databases after stress tests.
Probably server consumed too much memory and cannot execute simple queries

No ThreadSanitizer report, no LOGICAL_ERROR, and no ClickHouse frames in the collected stacks — only __sanitizer::internal_usleep in the watchdog.

Not a regression from this PR:

  • 9 of the 10 stress variants on this same commit are green, including amd_tsan, arm_asan_ubsan, arm_asan_ubsan (s3), arm_debug, arm_msan and arm_release. Only arm_tsan failed.
  • CIDB shows Stress test (arm_tsan) failing on 6–26 unrelated PRs every day for the last two weeks, with pull_request_number = 0 (master) present on most days — including twice on 2026-08-01 itself:
SELECT toStartOfDay(check_start_time) AS day, count() AS n, groupUniqArray(pull_request_number) AS prs
FROM checks
WHERE check_start_time > now() - INTERVAL 14 DAY
  AND check_name = 'Stress test (arm_tsan)' AND test_status IN ('FAIL','ERROR')
GROUP BY day ORDER BY day DESC
  • This PR's diff is one system-table source file. The only new work it adds is constructing a codec per row of system.parts_columns, and only when that column is selected — it cannot exhaust server memory or hang the server.

@groeneai

groeneai commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

I investigated. Agreed this is not a regression from this PR, and I can confirm your reading of the artifacts. Two separate things are going on, and only the second is fixable in the harness.

The stall is real, and it is server-side. The [ OK ]-after-verdict discriminator does not apply to a stress job (its job.log does not carry the per-test stream; the 16 [ OK ] lines are the pre-stress smoke phase). Using the progress line it does carry, the last one is All processes finished at 09:05:20, and the very first liveness probe after it already times out: kill -CONT ... && clickhouse client --receive_timeout=5 -q 'SELECT 1 FORMAT Null' at 09:05:30 never returns. So the server stopped answering at the moment the 8 test processes finished, before teardown asked it for anything. I have no evidence for the memory half of the message: that sentence is a hardcoded guess in the else clause of prepare_for_hung_check (ci/jobs/scripts/stress/stress.py:558-562) and nothing measures memory there.

Why you could not see more than the watchdog. The job never uploaded its artifacts. Every one of the 9 green stress variants on this commit attached 18-19 files, including clickhouse-server.log, clickhouse-server.stress.log.zst and fatal.log. This one attached zero and its node is still RUNNING, because it was SIGTERMed at the 10800 s cap (Timeout exceeded [10800], 08:56:01) before the upload step. So the one artifact that would identify the stalled threads was lost to a timeout, and the stack you did see is misleading in two ways: pid 3938 is labelled main server but its thread 1 is ClickHouseWatch in __GI___wait4 at BaseDaemon.cpp:706, i.e. the watchdog parent, and the attach to the real serving child (3944) timed out after 30 s and reported only Got suspiciously small stacktraces.

The harness defect: teardown is unbounded because the timeout flag it passes is the wrong one. Every teardown command passes --receive_timeout=10 or =15, yet all 88 socket errors in the log report 300000 ms. That is because the client applies handshake_timeout_ms (default 300 s) for the connect/handshake phase and only switches to receive_timeout after the handshake completes (src/Client/Connection.cpp:264-265 vs :352-353). Against a server that accepts the TCP connection but never completes the handshake, receive_timeout is never reached. Measured against a socket that accepts and never writes:

flag elapsed reported
--receive_timeout=10 300 s 300000 ms
--receive_timeout=3 300 s 300000 ms
--handshake_timeout_ms=10000 10 s 10000 ms

The first row reproduces the CI log exactly. The consequence is the for i in {1..30} loop over SYSTEM STOP DISTRIBUTED SENDS in stop_server (tests/docker_scripts/stress_tests.lib:222-226): 14 attempts at ~302 s each burned 4001 s (66 min) with no bound but the job cap. At 30 attempts it would be 2.5 h alone. With the handshake bounded at 10 s the same loop costs about 5 min, the job finishes inside its budget, and the artifacts get uploaded.

So the fix I would send is to pass --handshake_timeout_ms alongside --receive_timeout on the teardown paths, so a wedged server cannot consume the job budget. I want to be clear that this does not fix the stall itself, and I am not proposing it as one: it converts a lost job into a job that reports the stall with its logs attached. Given that the underlying stall is only diagnosable from clickhouse-server.stress.log.zst, which this class of failure currently destroys, I think that ordering is the right one. Tell me if you would rather I go straight at the stall instead and leave the budget alone.

On the watchdog mislabel, a fix is already in progress: #112269 identifies the server from argv and skips the watchdog parent by comm, so this dump would name the serving child. It is open and mergeable.

Breadth. This sub-signature is invisible to CIDB by the obvious keys: over 14 days of stress FAIL/ERROR rows, Failed to prepare for hung check and Cannot drop databases after stress tests both return 0 hits, because that sentence exists only in job.log. Keying on the teardown loop instead (SYSTEM STOP DISTRIBUTED SENDS in the context) gives 7 rows over 14 days on 7 distinct commits, 6 of the 7 on arm_tsan, one of them a true head_ref = 'master' (248c7f6, 2026-07-31). Your daily counts for the check overall reproduce: 5 to 26 rows per day. One correction to the master claim: today's two pull_request_number = 0 rows are both the same job on head_ref = '26.7', so ReleaseBranchCI rather than master. Scoping to head_ref = 'master' specifically, master rows appear on 6 of the last 16 days, so the point stands, just not for today.

Session id: cron:clickhouse-premium-slot-24:20260801-100800

@groeneai

groeneai commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

On the separate PR I promised for the globalIn face under #107619: I am not opening one, because your own open draft #102308 already implements the direction I described, and the design choice there is one you explicitly reserved.

I checked #102192 and my #109722 before, but missed #102308. Verified at its live head 0118172bacca by fetching src/Interpreters/PreparedSets.cpp (883 lines): it calls buildExternalTableFromInplaceSet(set_and_key->external_table, ...), guards the transfer limits with network_transfer_limits.hasLimits(), guards truncation with isTruncated(), and adds a createQueryPlanForRetry rebuild callback that also restores non-clonable sources. Its diff deletes the !set_and_key->external_table exclusion at PreparedSets.cpp:499 outright, and it ships 04095_future_set_inplace_build_restore_global_in.sql asserting both analyzers under its own failpoint, which is exactly the old-analyzer arm I measured as 0 against an oracle of 1000. compare/9685248855ae...0118172bacca is ahead 929 and behind 0, so its head contains merged #107924: it is a deliberate replacement, not a stale pre-fix branch.

So opening my own PR would compete with it on the identical hunk with a conflicting design, and would pre-empt the replace-versus-supersede choice you left open in your 2026-07-12 comment there.

I have posted the technical analysis on #102308 instead: #102308 (comment). It covers a GLOBAL JOIN replay hazard that the hasLimits() and isTruncated() guards do not catch under the old analyzer, a correction to one of the three stated reasons for the exclusion (the partial-prefix concern does not apply, because the external table is always StorageMemory and MemorySink publishes only from onFinish), and a smaller alternative that follows from that correction. Cross-referenced on #107619 as well.

If you would rather close #102308 as superseded and have only specific pieces carried over on top of #107924, tell me which and I will prepare that PR. My #109722 is still open and redundant now that #107924 merged, so feel free to close it.

The Stress test (arm_tsan) request in your other comment is being handled separately.

@alexey-milovidov

Copy link
Copy Markdown
Member

After this change, I do not think the PR makes sense.

@alexey-milovidov

Copy link
Copy Markdown
Member

Without adding a new file, this can only be made by scanning, or at least, peeking at the columns' data. We should reconsider this approach.

The PR is reviewed. Closing.

@alexey-milovidov alexey-milovidov self-assigned this Aug 1, 2026
@mekilis

mekilis commented Aug 1, 2026

Copy link
Copy Markdown
Author

Thanks for the review and rework.

Agreed: without exact per-part metadata the feature is too weak, and adding a file per part is too much overhead. Closing makes sense.

@groeneai

groeneai commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

The separate PR is open: #112927

It bounds the SYSTEM STOP DISTRIBUTED SENDS loop in stop_server, which completes your own
bada962: that commit's message states the 30 x 300 = 9000 s arithmetic and the intent to cap
each attempt at 10 s, but --receive_timeout is inert on this path. The client holds the 300 s
handshake timeout until Hello completes (Connection.cpp:264-265, swapped at :352-353), and the
client CLI's handshake default is 300 000 ms (ConnectionParameters.cpp:177), not the setting's
10 000 ms. Measured against a socket that accepts and never writes: --receive_timeout=10 and =3
both take 300 s, --handshake_timeout_ms=10000 takes 10.2 s. All 30 iterations are kept, so the
worst case becomes 450 s.

I have not gone at the server-side stall itself, which was the alternative I offered above. It is
only diagnosable from clickhouse-server.stress.log.zst, and that is the artifact the current
teardown destroys by exhausting the job budget before the upload step, so this ordering makes the
stall investigable rather than substituting for it. Say the word if you would rather I reverse it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add compression_codec field to system.part_columns

5 participants