Skip to content

Native Common Virtuals for RabbitMQ - #101411

Merged
Michicosun merged 2 commits into
masterfrom
native_common_virtuals/Rabbit
Apr 2, 2026
Merged

Michicosun merged 2 commits into
masterfrom
native_common_virtuals/Rabbit

Conversation

@Michicosun

@Michicosun Michicosun commented Mar 31, 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.517

@clickhouse-gh

clickhouse-gh Bot commented Mar 31, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c9608f8]

Summary: ❌

job_name test_name status info comment
Integration tests (amd_asan_ubsan, db disk, old analyzer, 2/6) failure
test_backup_restore_s3/test.py::test_backup_to_s3_different_credentials[data_file_name_from_checksum-native_multipart] FAIL cidb
Stress test (arm_msan) failure
Server died FAIL cidb
MemorySanitizer: use-of-uninitialized-value (STID: 2410-543a) FAIL cidb

AI Review

Summary

This PR adds the _table virtual column for RabbitMQ and updates integration coverage, but the new test still does not validate the rabbitmq_handle_error_mode='stream' path where virtual-column indexes shift (_raw_message/_error now follow _table). High-level verdict: useful change, but test coverage is still insufficient for the risky branch.

Missing context
  • ⚠️ No CI logs or test run results were provided in the review input.
Findings
  • ⚠️ Majors
    • [tests/integration/test_storage_rabbitmq/test.py:245-275] The added regression test checks _table only in default mode; it does not cover rabbitmq_handle_error_mode='stream', which is exactly where this PR changed virtual-column indexing. This leaves a real regression gap for _raw_message/_error mapping.
    • Suggested fix: create/adjust test table with rabbitmq_handle_error_mode='stream', produce at least one broken message, and assert _table, _raw_message, and _error values together in the same SELECT.
Tests
  • ⚠️ Add an integration test case for rabbitmq_handle_error_mode='stream' selecting _table, _raw_message, and _error together. This is needed to lock in the index mapping modified by this PR.
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 ⚠️ Missing stream-mode regression coverage for changed virtual-column mapping
Compilation time ✅
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Add regression coverage for rabbitmq_handle_error_mode='stream' that validates _table, _raw_message, and _error together.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Mar 31, 2026
@rienath rienath self-assigned this Mar 31, 2026
@clickhouse-gh

clickhouse-gh Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.00% 84.00% +0.00%
Functions 90.90% 90.80% -0.10%
Branches 76.50% 76.50% +0.00%

Changed lines: 45.83% (11/24) · Uncovered code

Full report · Diff report

@Michicosun
Michicosun added this pull request to the merge queue Apr 2, 2026
Merged via the queue into master with commit fea1e93 Apr 2, 2026
157 of 159 checks passed
@Michicosun
Michicosun deleted the native_common_virtuals/Rabbit branch April 2, 2026 09:12
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 2, 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.

3 participants