mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
mv_dependencies: test passed
This commit is contained in:
parent
410951d64f
commit
3fcd892a36
@ -53,6 +53,7 @@ namespace Setting
|
|||||||
namespace ServerSetting
|
namespace ServerSetting
|
||||||
{
|
{
|
||||||
extern const ServerSettingsUInt64 max_materialized_views_count_for_table;
|
extern const ServerSettingsUInt64 max_materialized_views_count_for_table;
|
||||||
|
extern const ServerSettingsUInt64 startup_mv_delay_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace RefreshSetting
|
namespace RefreshSetting
|
||||||
@ -749,7 +750,7 @@ void StorageMaterializedView::renameInMemory(const StorageID & new_table_id)
|
|||||||
|
|
||||||
void StorageMaterializedView::pushDependencies()
|
void StorageMaterializedView::pushDependencies()
|
||||||
{
|
{
|
||||||
assert(!dependencies_are_tracked);
|
// assert(!dependencies_are_tracked);
|
||||||
if (!dependencies_are_tracked)
|
if (!dependencies_are_tracked)
|
||||||
{
|
{
|
||||||
auto metadata_snapshot = getInMemoryMetadataPtr();
|
auto metadata_snapshot = getInMemoryMetadataPtr();
|
||||||
@ -762,7 +763,7 @@ void StorageMaterializedView::pushDependencies()
|
|||||||
|
|
||||||
void StorageMaterializedView::startup()
|
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;
|
std::random_device rd;
|
||||||
const auto delay_ms = std::uniform_int_distribution<>(0, 1)(rd) ? configured_delay_ms : 0UL;
|
const auto delay_ms = std::uniform_int_distribution<>(0, 1)(rd) ? configured_delay_ms : 0UL;
|
||||||
|
@ -198,7 +198,6 @@ def test_multiple_tables(started_cluster):
|
|||||||
query(f"drop table test.table_{i} sync")
|
query(f"drop table test.table_{i} sync")
|
||||||
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
def test_async_load_system_database(started_cluster):
|
def test_async_load_system_database(started_cluster):
|
||||||
id = 1
|
id = 1
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
@ -243,9 +242,10 @@ def test_async_load_system_database(started_cluster):
|
|||||||
for i in range(id - 1):
|
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.text_log_{i + 1}_test")
|
||||||
node2.query(f"drop table if exists system.query_log_{i + 1}_test")
|
node2.query(f"drop table if exists system.query_log_{i + 1}_test")
|
||||||
=======
|
|
||||||
|
|
||||||
def test_materialzed_views(started_cluster):
|
def test_materialzed_views(started_cluster):
|
||||||
query = instance.query
|
query = node1.query
|
||||||
query("create database test_mv")
|
query("create database test_mv")
|
||||||
query("create table test_mv.t (Id UInt64) engine=MergeTree order by Id")
|
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")
|
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_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")
|
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)")
|
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.a Format CSV") == "42\n"
|
||||||
assert query("select * from test_mv.z Format CSV") == "42\n"
|
assert query("select * from test_mv.z Format CSV") == "42\n"
|
||||||
|
|
||||||
query("drop materialized view t_to_a")
|
query("drop view t_to_a")
|
||||||
query("drop materialized view t_to_z")
|
query("drop view t_to_z")
|
||||||
query("drop table test_mv.t")
|
query("drop table test_mv.t")
|
||||||
query("drop table test_mv.a")
|
query("drop table test_mv.a")
|
||||||
query("drop table test_mv.z")
|
query("drop table test_mv.z")
|
||||||
query("drop database test_mv")
|
query("drop database test_mv")
|
||||||
>>>>>>> 4d4a53cc440 (mv_dependencies: initial)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user