Skip to content

Fix test_rabbitmq_mv_combo slowdown instead of loosening its timeout - #110224

Merged
antonio2368 merged 2 commits into
masterfrom
fix-rabbitmq-mv-combo-parallel-view-processing
Jul 15, 2026
Merged

antonio2368 merged 2 commits into
masterfrom
fix-rabbitmq-mv-combo-parallel-view-processing

Conversation

@antonio2368

@antonio2368 antonio2368 commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

Related: #109170
Related: #109892

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

#109170 correctly made MV fan-out serial by default (parallel_view_processing=false), which #109892 papered over by loosening this test's timeout instead of fixing the resulting slowdown. This reverts #109892 and sets parallel_view_processing=1 in the test's default profile instead — the only place it can be applied to RabbitMQ's internal insert-to-views pipeline. Verified against the CI msan binary: 188s serial vs ~124s with this fix, under the original 180s deadline.

Documentation entry for a feature (if required):

Version info

  • Merged into: 26.7.1.981 (included in 26.7 and later)

…est_rabbitmq_mv_combo-progress"

This reverts commit 579786e, reversing
changes made to 797a5a9.
…ening the timeout

Since #109170 fixed parallel_view_processing being ignored, MV fan-out is
serialized by default (setting defaults to false). This genuinely slowed
down `RabbitMQ`'s internal insert-to-views pipeline for the 5 materialized
views in this test, which had been relying on the previously-buggy
always-parallel behavior. #109892 masked the slowdown by making the test's
no-progress deadline reset on progress instead of addressing the throughput
regression, which is reverted here.

Set `parallel_view_processing = 1` in the test's default profile, which is
the only place this setting can be applied for RabbitMQ's internal insert
context (it can't be set via `CREATE TABLE ... SETTINGS` or session `SET`,
since `StorageRabbitMQ` captures the global context at construction).
Verified with the CI msan binary: 188s (serial, default) vs 119s (parallel)
for the underlying consumption; combined with the revert, the test now
passes in ~124s against the original fixed 180s deadline.
@clickhouse-gh

clickhouse-gh Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d98913c]

Summary: ✅


AI Review

Summary

This PR replaces the test_rabbitmq_mv_combo no-progress timeout with a suite-wide parallel_view_processing=1 profile override so the workload fits back under the original 180-second deadline. I do not think it is ready as-is: the profile change is broader than the target test and removes RabbitMQ integration coverage of the default serial materialized-view path, while the fixed 180-second deadline reintroduces the same wall-clock fragility that the earlier polling logic was added to avoid.

Findings

⚠️ Majors

  • [tests/integration/test_storage_rabbitmq/configs/users.xml:5] Setting parallel_view_processing=1 in the shared default profile affects every RabbitMQ table created by instance and instance2, not only test_rabbitmq_mv_combo. Because StorageRabbitMQ takes its background-insert settings from the server/user profile, correctness-sensitive tests with attached views now all run under the non-default parallel path, so this module stops covering RabbitMQ's restored default serial behavior from #109170. Suggested fix: scope the override to a dedicated profile or instance used only by test_rabbitmq_mv_combo, or keep at least one RabbitMQ integration test explicitly on parallel_view_processing=0.
  • [tests/integration/test_storage_rabbitmq/test.py:772] Reverting to a hard 180-second deadline reintroduces the same wall-clock flake that #109892 fixed. The loop still polls five count() queries once per second, so a loaded sanitizer worker can keep making progress while exceeding 180 seconds; the existing check_expected_result_polling helper already uses a no-progress deadline specifically to avoid that failure mode. Suggested fix: keep the no-progress deadline reset in this test even after enabling parallel_view_processing=1.
Final Verdict
  • Status: ⚠️ Request changes
  • Narrow the parallel_view_processing override so the RabbitMQ integration suite still exercises the default serial materialized-view path.
  • Restore a no-progress timeout for test_rabbitmq_mv_combo instead of relying on a fixed 180-second wall-clock limit.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 13, 2026
@antonio2368 antonio2368 changed the title Fix test_rabbitmq_mv_combo slowdown at its root cause instead of loosening the timeout Fix test_rabbitmq_mv_combo slowdown instead of loosening its timeout Jul 13, 2026
<profiles>
<default>
<stream_like_engine_allow_direct_select>1</stream_like_engine_allow_direct_select>
<parallel_view_processing>1</parallel_view_processing>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This profile change affects the whole test_storage_rabbitmq/test.py module, not just test_rabbitmq_mv_combo. instance and instance2 both load this file, and StorageRabbitMQ takes its background-insert settings from the server/user profile when each table is created, so every RabbitMQ table with an attached view now runs with parallel_view_processing=1. That moves correctness-sensitive cases like test_rabbitmq_handle_error_mode_stream and the duplicate-message test off the production-default serial path that #109170 just restored, so a RabbitMQ-specific regression with parallel_view_processing=0 would no longer be caught here. Can we scope the override to the combo test, or keep at least one RabbitMQ integration case pinned to parallel_view_processing=0?

deadline = time.monotonic() + no_progress_timeout
# with threadsanitizer the speed of execution is about 8-13k rows per second.
# so consumption of 1 mln rows will require about 125 seconds
deadline = time.monotonic() + 180

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reintroduces the exact wall-clock flake that #109892 fixed. The heavy part of this loop is still the five count() queries; on a loaded sanitizer worker they can keep making progress while the total wall-clock time exceeds 180 seconds, which is why the module-level check_expected_result_polling helper resets the deadline on progress. Enabling parallel_view_processing lowers the common-case runtime, but it does not make a fixed 180 safe again. Keeping the no-progress timeout here would preserve the root-cause fix without regressing the test back to "fails while still consuming".

@CheSema CheSema self-assigned this Jul 13, 2026
@antonio2368
antonio2368 added this pull request to the merge queue Jul 15, 2026
Merged via the queue into master with commit 2201d62 Jul 15, 2026
346 of 347 checks passed
@antonio2368
antonio2368 deleted the fix-rabbitmq-mv-combo-parallel-view-processing branch July 15, 2026 14:35
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 15, 2026
pull Bot pushed a commit to SINHASantos/ClickHouse that referenced this pull request Aug 9, 2026
test_rabbitmq_mv_combo fails on Integration tests (amd_msan) with "Time limit of 180 seconds
reached". In the failing report the test is neither stalled nor far behind: consumption is
monotonic across all 37 observations and reaches 940800 / 1000000 (94.08%), needing about 20
more seconds at its own late rate. The budget goes to the polling loop itself.

Each poll iteration issued one SELECT count() per materialized view, and every
instance.query() spawns a clickhouse-client process inside the instance container, so the
actual poll interval in CI was about 5.0s rather than the ~1s the code asks for. Under msan
the cost is process start-up, not query work: every statement in that job shows the same
per-query floor regardless of shape. On a shard running three pytest workers, that leaves too
little margin to absorb ordinary cross-worker contention.

Counting all five targets with a single merge() query removes four of the five spawns per
poll. Measured on one box in one session, single worker: 5.14 spawns per poll to 1.02, and
polling overhead 19.8s of a 53.8s poll span (36.8%) to 7.8s of 54.8s (14.2%). With three
concurrent workers, overhead goes from about 38.7% to about 13.4%. Poll cadence improves from
about 1.56s to about 1.15s, so progress is observed more finely as well. Reverting only the
merged query returns every number to its previous value.

This deliberately does not touch the 180 second deadline, its failure message, the sleep(1),
the load or the final assertion, which is what ClickHouse#110224 asked for when it reverted my earlier
attempt at loosening the timeout. The merged count was verified equal to the previous
per-table sum, both while rows were arriving and once settled, and the anchored pattern was
verified to resolve to exactly the five target tables. The anchor is load-bearing: unanchored,
combo_[0-9]+ also matches the five combo_N_mv views, and a read of a materialized view goes to
its target table, so every row would be counted twice and the loop would exit at half the real
progress. Verified on a probe database with distinct per-table counts: anchored 11111 (the five
targets, once each), unanchored 22222.

Whole-module runs before and after give identical failure sets, and 21 repeat runs with three
workers passed. This is not claimed to eliminate the failure: since ClickHouse#110224 the test fails
about twice in 24 days over roughly 47000 runs and never on master, a rate no feasible local
run count could measure.

Related: ClickHouse#109909
Related: ClickHouse#110224
pull Bot pushed a commit to SINHASantos/ClickHouse that referenced this pull request Aug 17, 2026
test_rabbitmq_mv_combo intermittently fails "Time limit of 180 seconds
reached" on master, most recently on Integration tests (amd_msan, 6/8).

The run is not stalled. Consumption increases at every poll with zero
no-progress polls; the test is simply too slow. rabbitmq_max_block_size = 100
makes every consumer flush a 100-row part, so each of the 5 materialized-view
targets accumulates ~2000 level-0 parts and every merge round re-reads the
growing all_1_* base part. Measured on the failing job and reproduced
locally: 9989 of 9989 level-0 parts are exactly 100 rows, the final merge
level reaches 295-316, and merges read ~122M rows to consume 1M, i.e. ~122x
read amplification with ~96% of it base-part re-reads. Amplification rises as
the consumption rate falls, which is what crosses the fixed deadline at ~79%.

Raise rabbitmq_max_block_size to 10000 for this test's table only. This
reduces the work rather than relaxing the budget: the 180s deadline is
unchanged, no no-progress reset is introduced, and the parallel_view_processing
setting from ClickHouse#110224 is retained. rabbitmq_flush_interval_ms stays at 1000, so
partial blocks still flush every second; measured part sizes stay between 538
and 6168 rows and reach the new 10000 cap in 0 of 2090 parts, so the raised
ceiling cannot make the test wait for a full block. The final exact-count
assertion and the ^combo_[0-9]+$ poll anchor are untouched.

test_nats_overloaded_insert, the same high-volume MV fan-out shape, already
uses nats_max_block_size = 10000. Only 1 of the 32 occurrences in this file
changes; the other 31 belong to 29 other tests, including
test_rabbitmq_flush_by_block_size, whose subject is block-size semantics.

Validated with 12 interleaved A/B pairs on an MSAN build, the configuration
that fails, using the same binary in both arms with the run order alternated.
Amplification drops 122.11x to 12.43x with non-overlapping ranges, and the
consumption loop the deadline measures is faster in 12 of 12 pairs (median
77.2s to 66.6s, Mann-Whitney U=142/144). A Debug build cannot show this:
there merges cost only 0.23 of 384 cores, so the amplification is free and
wall time is dominated by fixture setup. Sibling regression run: 9 tests in
the module pass.

Related: ClickHouse#109909
@antonio2368 antonio2368 added pr-must-backport Pull request should be backported intentionally. Use this label with great care! and removed pr-must-backport Pull request should be backported intentionally. Use this label with great care! labels Sep 3, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…combo-parallel-view-processing

Fix test_rabbitmq_mv_combo slowdown instead of loosening its timeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants