ClickHouse/tests/integration/test_projection_report_broken_part/test.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
1.8 KiB
Python
Raw Normal View History

2023-05-21 12:53:33 +00:00
# pylint: disable=unused-argument
# pylint: disable=redefined-outer-name
# pylint: disable=line-too-long
import pytest
import time
from helpers.client import QueryRuntimeException
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance(
"node",
main_configs=[
"configs/testkeeper.xml",
],
)
2023-05-21 16:44:17 +00:00
2023-05-21 12:53:33 +00:00
@pytest.fixture(scope="module", autouse=True)
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
2023-05-21 16:44:17 +00:00
2023-05-21 12:53:33 +00:00
def test_projection_broken_part():
node.query(
"""
create table test_projection_broken_parts_1 (a int, b int, projection ab (select a, sum(b) group by a))
engine = ReplicatedMergeTree('/clickhouse-tables/test_projection_broken_parts', 'r1')
order by a settings index_granularity = 1;
create table test_projection_broken_parts_2 (a int, b int, projection ab (select a, sum(b) group by a))
engine ReplicatedMergeTree('/clickhouse-tables/test_projection_broken_parts', 'r2')
order by a settings index_granularity = 1;
insert into test_projection_broken_parts_1 values (1, 1), (1, 2), (1, 3);
system sync replica test_projection_broken_parts_2;
"""
)
# break projection part
node.exec_in_container(
[
"bash",
"-c",
"rm /var/lib/clickhouse/data/default/test_projection_broken_parts_1/all_0_0_0/ab.proj/data.bin",
]
)
expected_error = "No such file or directory"
assert expected_error in node.query_and_get_error(
"select sum(b) from test_projection_broken_parts_1 group by a"
)
time.sleep(2)
2023-05-21 16:44:17 +00:00
assert (
int(node.query("select sum(b) from test_projection_broken_parts_1 group by a"))
== 6
)