The test downgrades the embedded Keeper from multi_read=1 to multi_read=0 and
restarts, expecting the coordinated refreshable MV to re-attach and stop
gracefully (Disabled). The embedded Keeper restarts together with the server and
can still be applying the new feature_flags config (re-deriving the
/keeper/feature_flags system znode) while it already accepts client connections.
If the server's ZooKeeper client negotiates feature flags in that window it caches
a stale MULTI_READ=enabled for the whole session, and RefreshTask reads MULTI_READ
only once (at attach), so the view comes up healthy and reports Scheduled with an
empty exception instead of Disabled. Fast hosts win this race; the slower db disk
integration shards lose it deterministically (assert 'Disabled' in 'Scheduled').
Fix is test-only: after each Keeper config swap + restart, wait until the server's
live Keeper session (system.zookeeper_connection.enabled_feature_flags) reflects
the wanted MULTI_READ state before relying on the view's state, retrying the
restart if the session raced to the stale value. The graceful-stop production code
path is unchanged and is still exercised.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Related: #106737
Related: #100394
Changelog category (leave one):
Description
Fixes a flaky
test_refreshable_mv_no_multi_read/test.py::test_refreshable_mv_attach_without_multi_read(added in #108441). It failed deterministically in thedb diskintegration shards withAssertionError: assert 'Disabled' in 'Scheduled\t\n', reported on #100394.The test downgrades the embedded Keeper from
multi_read=1tomulti_read=0and restarts, expecting the coordinated refreshable MV to re-attach and stop gracefully (Disabled). The embedded Keeper restarts together with the server; on a loaded host it can still be applying the newfeature_flagsconfig (re-deriving the/keeper/feature_flagssystem znode) while it already accepts client connections. If the server's ZooKeeper client negotiates feature flags in that window, it caches the staleMULTI_READ=enabledfor the whole session.RefreshTaskreadsMULTI_READonly once, at attach, so the view comes up healthy (coordinated) and reportsScheduledwith an empty exception instead ofDisabled. Fast hosts win this race; the slowerdb diskshards lose it consistently.Fix is test-only: after each Keeper config swap + restart, wait until the server's live Keeper session (
system.zookeeper_connection.enabled_feature_flags) actually reflects the wantedMULTI_READstate before relying on the view's state, retrying the restart if the session raced to the stale value. The graceful-stop production code path is unchanged and is still exercised (the no-multi-read attach still logs "The view is stopped").Validated with
CLICKHOUSE_USE_DATABASE_DISK=1on a debug build: the updated test passes repeatedly, and a controlled reproduction of the old single-restart logic under the stale-flag condition reproduces the exactassert 'Disabled' in 'Scheduled\t\n'failure.