mv_dependencies: test passed

This commit is contained in:
Ilya Golshtein 2024-11-17 15:41:51 +03:00
parent 410951d64f
commit 3fcd892a36
2 changed files with 9 additions and 9 deletions

View File

@ -53,6 +53,7 @@ namespace Setting
namespace ServerSetting
{
extern const ServerSettingsUInt64 max_materialized_views_count_for_table;
extern const ServerSettingsUInt64 startup_mv_delay_ms;
}
namespace RefreshSetting
@ -749,7 +750,7 @@ void StorageMaterializedView::renameInMemory(const StorageID & new_table_id)
void StorageMaterializedView::pushDependencies()
{
assert(!dependencies_are_tracked);
// assert(!dependencies_are_tracked);
if (!dependencies_are_tracked)
{
auto metadata_snapshot = getInMemoryMetadataPtr();
@ -762,7 +763,7 @@ void StorageMaterializedView::pushDependencies()
void StorageMaterializedView::startup()
{
if (const auto configured_delay_ms = getContext()->getServerSettings().startup_mv_delay_ms; configured_delay_ms)
if (const auto configured_delay_ms = getContext()->getServerSettings()[ServerSetting::startup_mv_delay_ms]; configured_delay_ms)
{
std::random_device rd;
const auto delay_ms = std::uniform_int_distribution<>(0, 1)(rd) ? configured_delay_ms : 0UL;

View File

@ -198,7 +198,6 @@ def test_multiple_tables(started_cluster):
query(f"drop table test.table_{i} sync")
<<<<<<< HEAD
def test_async_load_system_database(started_cluster):
id = 1
for i in range(4):
@ -243,9 +242,10 @@ def test_async_load_system_database(started_cluster):
for i in range(id - 1):
node2.query(f"drop table if exists system.text_log_{i + 1}_test")
node2.query(f"drop table if exists system.query_log_{i + 1}_test")
=======
def test_materialzed_views(started_cluster):
query = instance.query
query = node1.query
query("create database test_mv")
query("create table test_mv.t (Id UInt64) engine=MergeTree order by Id")
query("create table test_mv.a (Id UInt64) engine=MergeTree order by Id")
@ -253,15 +253,14 @@ def test_materialzed_views(started_cluster):
query("create materialized view t_to_a to test_mv.a as select Id from test_mv.t")
query("create materialized view t_to_z to test_mv.z as select Id from test_mv.t")
instance.restart_clickhouse()
node1.restart_clickhouse()
query("insert into test_mv.t values(42)")
assert query("select * from test_mv.a Format CSV") == "42\n"
assert query("select * from test_mv.z Format CSV") == "42\n"
query("drop materialized view t_to_a")
query("drop materialized view t_to_z")
query("drop view t_to_a")
query("drop view t_to_z")
query("drop table test_mv.t")
query("drop table test_mv.a")
query("drop table test_mv.z")
query("drop database test_mv")
>>>>>>> 4d4a53cc440 (mv_dependencies: initial)