2020-02-26 13:54:41 +00:00
|
|
|
import pytest
|
|
|
|
|
2024-02-26 12:45:20 +00:00
|
|
|
from helpers.cluster import ClickHouseCluster, CLICKHOUSE_CI_MIN_TESTED_VERSION
|
2020-02-26 13:54:41 +00:00
|
|
|
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
2022-03-22 16:39:58 +00:00
|
|
|
node1 = cluster.add_instance(
|
|
|
|
"node1",
|
|
|
|
with_zookeeper=True,
|
2024-02-26 12:45:20 +00:00
|
|
|
image="clickhouse/clickhouse-server",
|
|
|
|
tag=CLICKHOUSE_CI_MIN_TESTED_VERSION,
|
2022-03-22 16:39:58 +00:00
|
|
|
stay_alive=True,
|
|
|
|
with_installed_binary=True,
|
2023-07-20 15:12:55 +00:00
|
|
|
allow_analyzer=False,
|
2022-03-22 16:39:58 +00:00
|
|
|
)
|
|
|
|
node2 = cluster.add_instance(
|
2023-05-07 01:45:17 +00:00
|
|
|
"node2",
|
|
|
|
main_configs=["configs/wide_parts_only.xml", "configs/no_compress_marks.xml"],
|
|
|
|
with_zookeeper=True,
|
2023-07-20 15:05:07 +00:00
|
|
|
allow_analyzer=False,
|
2022-03-22 16:39:58 +00:00
|
|
|
)
|
2020-02-26 13:54:41 +00:00
|
|
|
|
2020-09-16 04:26:10 +00:00
|
|
|
|
2020-02-26 13:54:41 +00:00
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
def start_cluster():
|
|
|
|
try:
|
|
|
|
cluster.start()
|
2022-03-22 16:39:58 +00:00
|
|
|
create_query = """CREATE TABLE t(date Date, id UInt32)
|
2021-12-07 16:55:55 +00:00
|
|
|
ENGINE = ReplicatedMergeTree('/clickhouse/tables/test/t', '{}')
|
|
|
|
PARTITION BY toYYYYMM(date)
|
2022-03-22 16:39:58 +00:00
|
|
|
ORDER BY id"""
|
2021-12-07 16:55:55 +00:00
|
|
|
node1.query(create_query.format(1))
|
2022-03-22 16:39:58 +00:00
|
|
|
node1.query("DETACH TABLE t") # stop being leader
|
2021-12-07 16:55:55 +00:00
|
|
|
node2.query(create_query.format(2))
|
|
|
|
node1.query("ATTACH TABLE t")
|
2020-02-26 13:54:41 +00:00
|
|
|
yield cluster
|
|
|
|
|
|
|
|
finally:
|
|
|
|
cluster.shutdown()
|
|
|
|
|
|
|
|
|
2020-09-14 23:14:14 +00:00
|
|
|
def test_backward_compatability1(start_cluster):
|
2020-02-26 13:54:41 +00:00
|
|
|
node2.query("INSERT INTO t VALUES (today(), 1)")
|
|
|
|
node1.query("SYSTEM SYNC REPLICA t", timeout=10)
|
|
|
|
|
|
|
|
assert node1.query("SELECT count() FROM t") == "1\n"
|