ClickHouse/tests/integration/test_compressed_marks_restart/test.py

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

59 lines
1.8 KiB
Python
Raw Normal View History

2022-09-27 09:36:20 +00:00
#!/usr/bin/env python3
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance("node", stay_alive=True)
2022-09-27 09:53:26 +00:00
2022-09-27 09:36:20 +00:00
@pytest.fixture(scope="module", autouse=True)
def started_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_compressed_marks_restart_compact():
2022-09-27 09:53:26 +00:00
node.query(
"create table test_02381_compact (a UInt64, b String) ENGINE = MergeTree order by (a, b)"
)
2022-09-27 09:36:20 +00:00
node.query("insert into test_02381_compact values (1, 'Hello')")
2022-09-27 09:53:26 +00:00
node.query(
"alter table test_02381_compact modify setting compress_marks=true, compress_primary_key=true"
)
2022-09-27 09:36:20 +00:00
node.query("insert into test_02381_compact values (2, 'World')")
node.query("optimize table test_02381_compact final")
2022-09-27 09:53:26 +00:00
assert (
node.query("SELECT count() FROM test_02381_compact WHERE not ignore(*)")
== "2\n"
)
2022-09-27 09:36:20 +00:00
node.restart_clickhouse()
2022-09-27 09:53:26 +00:00
assert (
node.query("SELECT count() FROM test_02381_compact WHERE not ignore(*)")
== "2\n"
)
2022-09-27 09:36:20 +00:00
def test_compressed_marks_restart_wide():
2022-09-27 09:53:26 +00:00
node.query(
"create table test_02381_wide (a UInt64, b String) ENGINE = MergeTree order by (a, b) SETTINGS min_bytes_for_wide_part=0"
)
2022-09-27 09:36:20 +00:00
node.query("insert into test_02381_wide values (1, 'Hello')")
2022-09-27 09:53:26 +00:00
node.query(
"alter table test_02381_wide modify setting compress_marks=true, compress_primary_key=true"
)
2022-09-27 09:36:20 +00:00
node.query("insert into test_02381_wide values (2, 'World')")
node.query("optimize table test_02381_wide final")
2022-09-27 09:53:26 +00:00
assert (
node.query("SELECT count() FROM test_02381_wide WHERE not ignore(*)") == "2\n"
)
2022-09-27 09:36:20 +00:00
node.restart_clickhouse()
2022-09-27 09:53:26 +00:00
assert (
node.query("SELECT count() FROM test_02381_wide WHERE not ignore(*)") == "2\n"
)