Skip to content

Native Common Virtuals for FileLog - #101006

Merged
Michicosun merged 6 commits into
masterfrom
native_common_virtuals/FileLog
Mar 31, 2026
Merged

Michicosun merged 6 commits into
masterfrom
native_common_virtuals/FileLog

Conversation

@Michicosun

@Michicosun Michicosun commented Mar 28, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Part of #100766

Version info

  • Merged into: 26.4.1.444

@clickhouse-gh

clickhouse-gh Bot commented Mar 28, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [1145c4e]

Summary: ❌

job_name test_name status info comment
Stress test (arm_debug) failure
Possible deadlock on shutdown (see gdb.log) FAIL cidb
Upgrade check (amd_release) failure
Error message in clickhouse-server.log (see upgrade_error_messages.txt) FAIL cidb

AI Review

Summary

This PR makes _table a native virtual column for FileLog and updates common virtual-column handling to derive from each storage's current virtual-column snapshot, so _table is not duplicated. I did not find new correctness, safety, compatibility, or performance issues in the final PR state.

Missing context
  • ⚠️ CI is still in progress (Style check, Code Review, Fast test, Build (arm_tidy)), so there is no final completed CI signal yet.
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Mar 28, 2026
Comment thread src/Storages/StorageSnapshot.cpp Resolved
Comment thread src/Storages/IStorage.h Resolved
@clickhouse-gh

clickhouse-gh Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.20% +0.10%
Functions 90.90% 90.90% +0.00%
Branches 76.70% 76.70% +0.00%

Changed lines: 87.90% (138/157) · Uncovered code

Full report · Diff report

@Michicosun
Michicosun added this pull request to the merge queue Mar 31, 2026
Merged via the queue into master with commit 6626971 Mar 31, 2026
158 of 160 checks passed
@Michicosun
Michicosun deleted the native_common_virtuals/FileLog branch March 31, 2026 12:06
clickgapai pushed a commit to clickgapai/ClickHouse that referenced this pull request Mar 31, 2026
@clickgapai

Copy link
Copy Markdown
Contributor

Hi @Michicosun @yariks5s — while reviewing this PR I found the following:

Could you review the test PR and add the can be tested label if it looks good?
Happy to discuss — close anything that's wrong or already addressed.

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 31, 2026
lilredbot pushed a commit to JTCunning/ClickHouse that referenced this pull request Nov 4, 2026
…og sources

Since the "native common virtuals" series (ClickHouse#101138 for Kafka, ClickHouse#101411 for
RabbitMQ, ClickHouse#101139 for NATS, ClickHouse#101006 for FileLog) the streaming sources
fill the `_table` virtual column inside the per-row (NATS: per-message)
loop with `getStorageID().getTableName()`. `IStorage::getStorageID()`
locks the table-wide `id_mutex` and copies the `StorageID`, and all
reader-place virtuals are materialized for every row whether or not the
query selects `_table`, so every consumer thread of one table took the
same mutex for every row and consumers of one table serialized on it
(ClickHouse#120032). The Kafka, StorageKafka2 and RabbitMQ dead-letter branches did
the same once per failed message.

Take one `StorageID` snapshot plus a `Field` with the table name before
the consume loop and fill `_table` / the dead-letter element from it.
A block now carries the table name read when the block started, which is
the identity `streamToViews` inserts the block under.

Measured with a bpftrace uprobe on `IStorage::getStorageID` while a
materialized view drains the table: calls made by the source function
itself go from one per row (100000 for 100000 Kafka / StorageKafka2 /
FileLog rows, 20000 for 20000 NATS / RabbitMQ rows) to one per block
(2-8 for Kafka, StorageKafka2, FileLog and NATS; 261-371 for RabbitMQ,
which drains in small blocks).

The existing virtual-column tests now also check `_table` for Kafka (both
engines), RabbitMQ, NATS and FileLog.

Closes ClickHouse#120032

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog 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.

4 participants