Automatic style fix

This commit is contained in:
robot-clickhouse 2022-09-28 11:49:57 +00:00
parent 2eef384807
commit 9bc7a96624
2 changed files with 16 additions and 20 deletions

View File

@ -4165,20 +4165,13 @@ class ClickHouseInstance:
def count_metadata_furcation_refs(self, disk, path=None): def count_metadata_furcation_refs(self, disk, path=None):
if not path: if not path:
path = f"/var/lib/clickhouse/disks/{disk}/store" path = f"/var/lib/clickhouse/disks/{disk}/store"
command = [ command = ["grep", "-A", "1", "r00000000000000000000", "-R", path]
"grep",
"-A",
"1",
"r00000000000000000000",
"-R",
path
]
lines = self.exec_in_container(command).split("\n") lines = self.exec_in_container(command).split("\n")
prev_line = "" prev_line = ""
objects = {} objects = {}
pattern = re.compile(".*:\d+\s+(\S+)") pattern = re.compile(".*:\d+\s+(\S+)")
for line in lines: for line in lines:
if line.endswith('-0'): if line.endswith("-0"):
res = pattern.match(prev_line) res = pattern.match(prev_line)
if res: if res:
object = res.group(1) object = res.group(1)

View File

@ -414,6 +414,7 @@ def wait_mutations(node, table, seconds):
) )
assert mutations == "0\n" assert mutations == "0\n"
def wait_for_clean_old_parts(node, table, seconds): def wait_for_clean_old_parts(node, table, seconds):
time.sleep(1) time.sleep(1)
while seconds > 0: while seconds > 0:
@ -429,6 +430,7 @@ def wait_for_clean_old_parts(node, table, seconds):
) )
assert parts == "0\n" assert parts == "0\n"
def s3_zero_copy_unfreeze_base(cluster, unfreeze_query_template): def s3_zero_copy_unfreeze_base(cluster, unfreeze_query_template):
node1 = cluster.instances["node1"] node1 = cluster.instances["node1"]
node2 = cluster.instances["node2"] node2 = cluster.instances["node2"]
@ -637,6 +639,7 @@ def test_s3_zero_copy_concurrent_merge(cluster):
for node in (node1, node2): for node in (node1, node2):
assert node.query("select sum(id) from concurrent_merge").strip() == "1600" assert node.query("select sum(id) from concurrent_merge").strip() == "1600"
def test_s3_zero_copy_keeps_data_after_mutation(cluster): def test_s3_zero_copy_keeps_data_after_mutation(cluster):
node1 = cluster.instances["node1"] node1 = cluster.instances["node1"]
node2 = cluster.instances["node2"] node2 = cluster.instances["node2"]
@ -645,7 +648,7 @@ def test_s3_zero_copy_keeps_data_after_mutation(cluster):
node2.query("DROP TABLE IF EXISTS zero_copy_mutation NO DELAY") node2.query("DROP TABLE IF EXISTS zero_copy_mutation NO DELAY")
node1.query( node1.query(
""" """
CREATE TABLE zero_copy_mutation (id UInt64, value1 String, value2 String, value3 String) CREATE TABLE zero_copy_mutation (id UInt64, value1 String, value2 String, value3 String)
ENGINE=ReplicatedMergeTree('/clickhouse/tables/zero_copy_mutation', '{replica}') ENGINE=ReplicatedMergeTree('/clickhouse/tables/zero_copy_mutation', '{replica}')
ORDER BY id ORDER BY id
@ -653,10 +656,10 @@ def test_s3_zero_copy_keeps_data_after_mutation(cluster):
SETTINGS storage_policy='s3', SETTINGS storage_policy='s3',
old_parts_lifetime=1000 old_parts_lifetime=1000
""" """
) )
node2.query( node2.query(
""" """
CREATE TABLE zero_copy_mutation (id UInt64, value1 String, value2 String, value3 String) CREATE TABLE zero_copy_mutation (id UInt64, value1 String, value2 String, value3 String)
ENGINE=ReplicatedMergeTree('/clickhouse/tables/zero_copy_mutation', '{replica}') ENGINE=ReplicatedMergeTree('/clickhouse/tables/zero_copy_mutation', '{replica}')
ORDER BY id ORDER BY id
@ -664,14 +667,14 @@ def test_s3_zero_copy_keeps_data_after_mutation(cluster):
SETTINGS storage_policy='s3', SETTINGS storage_policy='s3',
old_parts_lifetime=1000 old_parts_lifetime=1000
""" """
) )
node1.query( node1.query(
""" """
INSERT INTO zero_copy_mutation INSERT INTO zero_copy_mutation
SELECT * FROM generateRandom('id UInt64, value1 String, value2 String, value3 String') limit 1000000 SELECT * FROM generateRandom('id UInt64, value1 String, value2 String, value3 String') limit 1000000
""" """
) )
wait_for_active_parts(node2, 4, "zero_copy_mutation") wait_for_active_parts(node2, 4, "zero_copy_mutation")
@ -679,14 +682,14 @@ def test_s3_zero_copy_keeps_data_after_mutation(cluster):
check_objects_exisis(cluster, objects1) check_objects_exisis(cluster, objects1)
node1.query( node1.query(
""" """
ALTER TABLE zero_copy_mutation ALTER TABLE zero_copy_mutation
ADD COLUMN valueX String MATERIALIZED value1 ADD COLUMN valueX String MATERIALIZED value1
""" """
) )
node1.query( node1.query(
""" """
ALTER TABLE zero_copy_mutation ALTER TABLE zero_copy_mutation
MATERIALIZE COLUMN valueX MATERIALIZE COLUMN valueX
""" """
@ -700,10 +703,10 @@ def test_s3_zero_copy_keeps_data_after_mutation(cluster):
nodeX = node1 nodeX = node1
nodeY = node2 nodeY = node2
assert node1.count_metadata_furcation_refs('s31') == 0 assert node1.count_metadata_furcation_refs("s31") == 0
assert node2.count_metadata_furcation_refs('s31') == 0 assert node2.count_metadata_furcation_refs("s31") == 0
if node2.count_metadata_furcation_refs('s31'): if node2.count_metadata_furcation_refs("s31"):
nodeX = node2 nodeX = node2
nodeY = node1 nodeY = node1