Skip to content

Revert "Reduce idle RabbitMQ CPU by 95% by not rebuilding the insert pipeline on every empty read" - #134110

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/revert-133527
Nov 25, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/revert-133527

Conversation

@groeneai

@groeneai groeneai commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Reverts #133527

Related: #133901
Related: #133527

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):

Description

#133527 made a materialized view created on an idle RabbitMQ table miss the messages published right after its CREATE (#133901): an empty first read now waits up to stream_poll_timeout_ms inside the insert pipeline built before the view existed, then acks what arrives. Since the merge, test_rabbitmq_handle_error_mode_stream fails in 26 of 547 CI runs and test_rabbitmq_reject_broken_messages_stream in 10 of 543, against 1 in 12,727 before. The reproducer from #133901 loses the new view's rows at the merge commit 3d50995 in 5/5 runs and at its first parent 73c474c in 0/10 (debug builds), and in 10/10 on master 6d2bccb. The revert brings back the idle CPU cost #133527 removed. An alternative fix is open in #133955.

Proof

Lost = all 100 messages reach t1 (the view that existed) and none reach t2 (the view created during the wait); they are acked.

build runs rows lost by the new view
809ae97 (last master build before #133527, CI) 20 0/20
73c474c (first parent, local debug) 10 0/10
3d50995 (merge commit, local debug) 5 5/5
dfee66b (first master build after #133527, CI) 5 5/5
6d2bccb (master, CI) 10 10/10
this revert (local debug) 10 0/10

Each run, in a fresh database:

CREATE TABLE rabbit (key UInt64) ENGINE = RabbitMQ SETTINGS rabbitmq_host_port = 'rabbitmq1:5672',
    rabbitmq_exchange_name = 'x', rabbitmq_queue_base = 'x', rabbitmq_format = 'JSONEachRow', rabbitmq_flush_interval_ms = 1000;
CREATE TABLE t1 (key UInt64) ENGINE = MergeTree ORDER BY key;
CREATE TABLE t2 (key UInt64) ENGINE = MergeTree ORDER BY key;
CREATE MATERIALIZED VIEW mv1 TO t1 AS SELECT key FROM rabbit;
-- wait for the server log line `Started streaming to 1 attached views`, then:
CREATE MATERIALIZED VIEW mv2 TO t2 AS SELECT key FROM rabbit;
-- publish 100 messages {"key": N} to exchange x; expected t1 = t2 = 100

On this revert, test_rabbitmq_handle_error_mode_stream and test_rabbitmq_reject_broken_messages_stream pass 10/10 each, and the rest of test_storage_rabbitmq passes locally except test_rabbitmq_broker_log_is_collected and test_rabbitmq_select[1], which need the CI runner image's broker config (TLS listener, log file) and fail the same way at the first parent.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.12.1.446-master (included in 26.12 and later)

…ty-read-like-kafka"

This reverts commit 3d50995, reversing
changes made to 73c474c.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (click to expand)

Pure revert of #133527: re-applying its diff (73c474c712de...3d50995a8c25) to this head gives the tree of master 8928bd2 exactly. Second-model review: 0 findings.

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov, could you review this? This reverts #133527, which makes a materialized view created on an idle RabbitMQ table miss the messages published right after it (#133901, two stream-mode tests red on master): the reproducer loses the new view's rows at 3d50995 and not at 73c474c. The fix in #133955 is the alternative.

@clickhouse-gh

clickhouse-gh Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6188ecc]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog can be tested Allows running workflows for external contributors comp-message-queues Message queue integrations (Kafka, RabbitMQ, NATS table engines for stream ingestion/egress). labels Nov 24, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 25, 2026
@alexey-milovidov alexey-milovidov self-assigned this Nov 25, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

@groeneai, after this get merged, reintroduce the original change with the fixes.

Merged via the queue into ClickHouse:master with commit 60698f5 Nov 25, 2026
576 of 578 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 25, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Acknowledged. I'm preparing a new PR that re-applies #133527 together with a fix for the messages a newly created view misses on an idle table (#133901); I'll follow up here with the PR link (or my findings) shortly.

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 comp-message-queues Message queue integrations (Kafka, RabbitMQ, NATS table engines for stream ingestion/egress). 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