Repository navigation
Fix flaky test: TestRefreshableMVQuerySettings::test_query_settings_apply_to_refreshes - #781
Merged
Merged
Conversation
…ost recent insert on first refresh
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the test-only changes aimed at reducing refresh-test flakiness.
No open issues 🎉
What changed in this PR
Reduces flakiness in the refreshable materialized-view query-settings integration test on multi-replica ClickHouse Cloud services. Changes are limited to tests; adapter behavior is unchanged.
Changes:
- Adds
select_sequential_consistencyto the model’s query settings so refreshes can see recently inserted rows across replicas. - Polls for the expected row after requesting a refresh, while preserving assertions that
join_use_nullsapplies.
| File | Description |
|---|---|
tests/integration/adapter/materialized_view/test_materialized_view_query_settings.py |
Adds consistency settings and retry-based row checks to stabilize refresh assertions. |
Review effort: Balanced
canbekley
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the Native leg of
test_cloudit failed once withid 4000 was not written to hackers(run 41827567747). It's not a regression: #777 touches no MV code, and the HTTP leg and the nightlies passed.Why it fails
The test:
SYSTEM REFRESH VIEW+SYSTEM WAIT VIEWEvery
project.run_sqlcall opens a new connection, so on Cloud each statement can hit a different replica. That breaks the test in two ways:SYSTEM WAIT VIEWon one replica does not see a refresh requested on another and returns at once (FixSYSTEM WAIT VIEWnot waiting for a refresh requested on another replica ClickHouse#120623). The read then runs before the refresh is done.What changes
The test checks the same things as before, it's now more sync and waits when sync is not possible:
select_sequential_consistency: 1to the model'squery_settings. It ends up in the view'sSETTINGSclause, which is what the refresh runs with, so the refresh syncs with Keeper and sees the row. Fixes 2. Harmless on local MergeTree. The adapter's connection default forShareddatabases does not help here, since it only applies to statements dbt sends, not to the server-side refresh.retry_until_assertion_passeshelper, instead of trustingSYSTEM WAIT VIEW. Fixes 1. The refresh itself is still issued once. this is what we do in other tests to wait for the results being fully processedNote
Low Risk
Changes are limited to integration test synchronization; no adapter or runtime behavior is modified.
Overview
Fixes intermittent failures in
TestRefreshableMVQuerySettings::test_query_settings_apply_to_refresheson Cloud Native, where eachrun_sqlcan hit a different replica.The refreshable MV model now includes
select_sequential_consistency: 1inquery_settingsso server-side refreshes see recently inserted source rows across replicas. AfterSYSTEM REFRESH VIEW/SYSTEM WAIT VIEW, assertions go through a newmatched_department_after_refreshhelper that polls withretry_until_assertion_passesinstead of assuming wait completed on the read replica (pre–26.10SYSTEM WAIT VIEWbehavior). The test still verifiesjoin_use_nullsin DDL and NULLmatched_departmentafter refresh.Reviewed by Cursor Bugbot for commit 0c6649a. Bugbot is set up for automated code reviews on this repo. Configure here.