mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
fix test_partition
This commit is contained in:
parent
62d3e9da4d
commit
49539e6862
@ -3,6 +3,8 @@ import logging
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
from helpers.test_tools import TSV
|
||||
from helpers.test_tools import assert_eq_with_retry
|
||||
from helpers.wait_for_helpers import wait_for_delete_inactive_parts
|
||||
from helpers.wait_for_helpers import wait_for_delete_empty_parts
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
instance = cluster.add_instance(
|
||||
@ -181,7 +183,10 @@ def attach_check_all_parts_table(started_cluster):
|
||||
q("SYSTEM STOP MERGES")
|
||||
q("DROP TABLE IF EXISTS test.attach_partition")
|
||||
q(
|
||||
"CREATE TABLE test.attach_partition (n UInt64) ENGINE = MergeTree() PARTITION BY intDiv(n, 8) ORDER BY n"
|
||||
"CREATE TABLE test.attach_partition (n UInt64) "
|
||||
"ENGINE = MergeTree() "
|
||||
"PARTITION BY intDiv(n, 8) ORDER BY n "
|
||||
"SETTINGS old_parts_lifetime = 1"
|
||||
)
|
||||
q(
|
||||
"INSERT INTO test.attach_partition SELECT number FROM system.numbers WHERE number % 2 = 0 LIMIT 8"
|
||||
@ -199,6 +204,9 @@ def attach_check_all_parts_table(started_cluster):
|
||||
def test_attach_check_all_parts(attach_check_all_parts_table):
|
||||
q("ALTER TABLE test.attach_partition DETACH PARTITION 0")
|
||||
|
||||
wait_for_delete_inactive_parts(instance, "test.attach_partition")
|
||||
wait_for_delete_empty_parts(instance, "test.attach_partition")
|
||||
|
||||
path_to_detached = path_to_data + "data/test/attach_partition/detached/"
|
||||
instance.exec_in_container(["mkdir", "{}".format(path_to_detached + "0_5_5_0")])
|
||||
instance.exec_in_container(
|
||||
@ -449,15 +457,23 @@ def test_system_detached_parts(drop_detached_parts_table):
|
||||
|
||||
|
||||
def test_detached_part_dir_exists(started_cluster):
|
||||
q("create table detached_part_dir_exists (n int) engine=MergeTree order by n")
|
||||
q(
|
||||
"create table detached_part_dir_exists (n int) "
|
||||
"engine=MergeTree order by n "
|
||||
"settings old_parts_lifetime = 1"
|
||||
)
|
||||
q("insert into detached_part_dir_exists select 1") # will create all_1_1_0
|
||||
q(
|
||||
"alter table detached_part_dir_exists detach partition id 'all'"
|
||||
) # will move all_1_1_0 to detached/all_1_1_0
|
||||
) # will move all_1_1_0 to detached/all_1_1_0 and create all_1_1_1
|
||||
|
||||
wait_for_delete_inactive_parts(instance, "detached_part_dir_exists")
|
||||
wait_for_delete_empty_parts(instance, "detached_part_dir_exists")
|
||||
|
||||
q("detach table detached_part_dir_exists")
|
||||
q("attach table detached_part_dir_exists")
|
||||
q("insert into detached_part_dir_exists select 1") # will create all_1_1_0
|
||||
q("insert into detached_part_dir_exists select 1") # will create all_2_2_0
|
||||
q("insert into detached_part_dir_exists select 1") # will create all_3_3_0
|
||||
instance.exec_in_container(
|
||||
[
|
||||
"bash",
|
||||
|
Loading…
Reference in New Issue
Block a user