Repository navigation
Fix test_rabbitmq_mv_combo slowdown instead of loosening its timeout - #110224
Conversation
…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.
|
Workflow [PR], commit [d98913c] Summary: ✅ AI ReviewSummaryThis PR replaces the Findings
Final Verdict
|
| <profiles> | ||
| <default> | ||
| <stream_like_engine_allow_direct_select>1</stream_like_engine_allow_direct_select> | ||
| <parallel_view_processing>1</parallel_view_processing> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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".
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
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
…combo-parallel-view-processing Fix test_rabbitmq_mv_combo slowdown instead of loosening its timeout
Related: #109170
Related: #109892
Changelog category (leave one):
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 setsparallel_view_processing=1in 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
26.7.1.981(included in26.7and later)