mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-22 15:52:13 +00:00
test/pylib: use view_build_status_v2 table in wait_for_view
Change the util function wait_for_view to read the view build status from the system.view_build_status_v2 table which replaces system_distributed.view_build_status. The old table can still be used but it is less efficient because it's implemented as a virtual table which reads from the v2 table, so it's better to read directly from the v2 table. This can cause slowness in tests. The additional util function wait_for_view_v1 reads from the old table. This may be needed in upgrade tests if the v2 table is not available yet.
This commit is contained in:
@@ -233,9 +233,16 @@ async def start_writes(cql: Session, keyspace: str, table: str, concurrency: int
|
||||
|
||||
return finish
|
||||
|
||||
async def wait_for_view(cql: Session, name: str, node_count: int, timeout: int = 120):
|
||||
async def wait_for_view_v1(cql: Session, name: str, node_count: int, timeout: int = 120):
|
||||
async def view_is_built():
|
||||
done = await cql.run_async(f"SELECT COUNT(*) FROM system_distributed.view_build_status WHERE status = 'SUCCESS' AND view_name = '{name}' ALLOW FILTERING")
|
||||
return done[0][0] == node_count or None
|
||||
deadline = time.time() + timeout
|
||||
await wait_for(view_is_built, deadline)
|
||||
|
||||
async def wait_for_view(cql: Session, name: str, node_count: int, timeout: int = 120):
|
||||
async def view_is_built():
|
||||
done = await cql.run_async(f"SELECT COUNT(*) FROM system.view_build_status_v2 WHERE status = 'SUCCESS' AND view_name = '{name}' ALLOW FILTERING")
|
||||
return done[0][0] == node_count or None
|
||||
deadline = time.time() + timeout
|
||||
await wait_for(view_is_built, deadline)
|
||||
|
||||
@@ -7,7 +7,7 @@ import pytest
|
||||
import time
|
||||
import asyncio
|
||||
import logging
|
||||
from test.pylib.util import unique_name, wait_for_cql_and_get_hosts, wait_for, wait_for_view
|
||||
from test.pylib.util import unique_name, wait_for_cql_and_get_hosts, wait_for, wait_for_view, wait_for_view_v1
|
||||
from test.pylib.manager_client import ManagerClient
|
||||
from test.pylib.internal_types import ServerInfo
|
||||
from test.topology.util import trigger_snapshot, wait_until_topology_upgrade_finishes, enter_recovery_state, reconnect_driver, \
|
||||
@@ -406,7 +406,7 @@ async def test_view_build_status_migration_to_v2_with_cleanup(request, manager:
|
||||
await create_table(cql)
|
||||
await create_mv(cql, "vt1")
|
||||
|
||||
await wait_for_view(cql, "vt1", 4)
|
||||
await wait_for_view_v1(cql, "vt1", 4)
|
||||
|
||||
result = await cql.run_async("SELECT * FROM system_distributed.view_build_status")
|
||||
assert len(result) == 4
|
||||
|
||||
Reference in New Issue
Block a user