mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 18:42:26 +00:00
Fix black
This commit is contained in:
parent
f8b3987d52
commit
6601ded4a1
@ -11,6 +11,7 @@ ch1 = cluster.add_instance(
|
|||||||
|
|
||||||
database_name = "dedup_attach"
|
database_name = "dedup_attach"
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def started_cluster():
|
def started_cluster():
|
||||||
try:
|
try:
|
||||||
@ -28,10 +29,14 @@ def q(query):
|
|||||||
def test_deduplicated_attached_part_renamed_after_attach(started_cluster):
|
def test_deduplicated_attached_part_renamed_after_attach(started_cluster):
|
||||||
ch1.query(f"CREATE DATABASE {database_name}")
|
ch1.query(f"CREATE DATABASE {database_name}")
|
||||||
|
|
||||||
q("CREATE TABLE dedup (id UInt32) ENGINE=ReplicatedMergeTree('/clickhouse/tables/dedup_attach/dedup/s1', 'r1') ORDER BY id;")
|
q(
|
||||||
|
"CREATE TABLE dedup (id UInt32) ENGINE=ReplicatedMergeTree('/clickhouse/tables/dedup_attach/dedup/s1', 'r1') ORDER BY id;"
|
||||||
|
)
|
||||||
q("INSERT INTO dedup VALUES (1),(2),(3);")
|
q("INSERT INTO dedup VALUES (1),(2),(3);")
|
||||||
|
|
||||||
table_data_path = q("SELECT data_paths FROM system.tables WHERE database=currentDatabase() AND table='dedup'").strip("'[]\n")
|
table_data_path = q(
|
||||||
|
"SELECT data_paths FROM system.tables WHERE database=currentDatabase() AND table='dedup'"
|
||||||
|
).strip("'[]\n")
|
||||||
|
|
||||||
ch1.exec_in_container(
|
ch1.exec_in_container(
|
||||||
[
|
[
|
||||||
@ -43,7 +48,11 @@ def test_deduplicated_attached_part_renamed_after_attach(started_cluster):
|
|||||||
# Part is attached as all_1_1_0
|
# Part is attached as all_1_1_0
|
||||||
q("ALTER TABLE dedup ATTACH PART 'all_0_0_0'")
|
q("ALTER TABLE dedup ATTACH PART 'all_0_0_0'")
|
||||||
|
|
||||||
assert 2 == int(q(f"SELECT count() FROM system.parts WHERE database='{database_name}' AND table = 'dedup'").strip())
|
assert 2 == int(
|
||||||
|
q(
|
||||||
|
f"SELECT count() FROM system.parts WHERE database='{database_name}' AND table = 'dedup'"
|
||||||
|
).strip()
|
||||||
|
)
|
||||||
|
|
||||||
ch1.exec_in_container(
|
ch1.exec_in_container(
|
||||||
[
|
[
|
||||||
@ -55,7 +64,20 @@ def test_deduplicated_attached_part_renamed_after_attach(started_cluster):
|
|||||||
# Part is deduplicated and not attached
|
# Part is deduplicated and not attached
|
||||||
q("ALTER TABLE dedup ATTACH PART 'all_1_1_0'")
|
q("ALTER TABLE dedup ATTACH PART 'all_1_1_0'")
|
||||||
|
|
||||||
assert 2 == int(q(f"SELECT count() FROM system.parts WHERE database='{database_name}' AND table = 'dedup'").strip())
|
assert 2 == int(
|
||||||
assert 1 == int(q(f"SELECT count() FROM system.detached_parts WHERE database='{database_name}' AND table = 'dedup'").strip())
|
q(
|
||||||
|
f"SELECT count() FROM system.parts WHERE database='{database_name}' AND table = 'dedup'"
|
||||||
|
).strip()
|
||||||
|
)
|
||||||
|
assert 1 == int(
|
||||||
|
q(
|
||||||
|
f"SELECT count() FROM system.detached_parts WHERE database='{database_name}' AND table = 'dedup'"
|
||||||
|
).strip()
|
||||||
|
)
|
||||||
# Check that it is not 'attaching_all_1_1_0'
|
# Check that it is not 'attaching_all_1_1_0'
|
||||||
assert "all_1_1_0" == q(f"SELECT name FROM system.detached_parts WHERE database='{database_name}' AND table = 'dedup'").strip()
|
assert (
|
||||||
|
"all_1_1_0"
|
||||||
|
== q(
|
||||||
|
f"SELECT name FROM system.detached_parts WHERE database='{database_name}' AND table = 'dedup'"
|
||||||
|
).strip()
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user