mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Speedup a bit.
This commit is contained in:
parent
dc5009d401
commit
90f3f5789f
@ -407,10 +407,7 @@ def test_alter_policy(start_cluster, name, engine):
|
||||
|
||||
|
||||
def get_random_string(length):
|
||||
return "".join(
|
||||
random.choice(string.ascii_uppercase + string.digits) for _ in range(length)
|
||||
)
|
||||
|
||||
return "randomPrintableASCII({})".format(length)
|
||||
|
||||
def get_used_disks_for_table(node, table_name):
|
||||
return tuple(
|
||||
@ -554,7 +551,7 @@ def test_max_data_part_size(start_cluster, name, engine):
|
||||
|
||||
node1.query_with_retry(
|
||||
"INSERT INTO {} VALUES {}".format(
|
||||
name, ",".join(["('" + x + "')" for x in data])
|
||||
name, ",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
used_disks = get_used_disks_for_table(node1, name)
|
||||
@ -598,7 +595,7 @@ def test_jbod_overflow(start_cluster, name, engine):
|
||||
data.append(get_random_string(1024 * 1024)) # 1MB row
|
||||
node1.query_with_retry(
|
||||
"INSERT INTO {} VALUES {}".format(
|
||||
name, ",".join(["('" + x + "')" for x in data])
|
||||
name, ",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
|
||||
@ -612,7 +609,7 @@ def test_jbod_overflow(start_cluster, name, engine):
|
||||
|
||||
node1.query_with_retry(
|
||||
"INSERT INTO {} VALUES {}".format(
|
||||
name, ",".join(["('" + x + "')" for x in data])
|
||||
name, ",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
|
||||
@ -676,7 +673,7 @@ def test_background_move(start_cluster, name, engine):
|
||||
# small jbod size is 40MB, so lets insert 5MB batch 5 times
|
||||
node1.query_with_retry(
|
||||
"INSERT INTO {} VALUES {}".format(
|
||||
name, ",".join(["('" + x + "')" for x in data])
|
||||
name, ",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
|
||||
@ -694,8 +691,9 @@ def test_background_move(start_cluster, name, engine):
|
||||
# first (oldest) part was moved to external
|
||||
assert used_disks[0] == "external"
|
||||
|
||||
node1.query("SYSTEM FLUSH LOGS")
|
||||
path = node1.query(
|
||||
"SELECT path_on_disk FROM system.part_log WHERE table = '{}' AND event_type='MovePart' ORDER BY event_time LIMIT 1".format(
|
||||
"SELECT path_on_disk FROM system.part_log WHERE table = '{}' AND event_type='MovePart' AND part_name = 'all_1_1_0'".format(
|
||||
name
|
||||
)
|
||||
)
|
||||
@ -788,7 +786,7 @@ def test_start_stop_moves(start_cluster, name, engine):
|
||||
# jbod size is 40MB, so lets insert 5MB batch 7 times
|
||||
node1.query_with_retry(
|
||||
"INSERT INTO {} VALUES {}".format(
|
||||
name, ",".join(["('" + x + "')" for x in data])
|
||||
name, ",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
|
||||
@ -1302,7 +1300,7 @@ def test_detach_attach(start_cluster, name, engine):
|
||||
data.append(get_random_string(1024 * 1024)) # 1MB row
|
||||
node1.query_with_retry(
|
||||
"INSERT INTO {} VALUES {}".format(
|
||||
name, ",".join(["('" + x + "')" for x in data])
|
||||
name, ",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
|
||||
@ -1354,7 +1352,7 @@ def test_mutate_to_another_disk(start_cluster, name, engine):
|
||||
data.append(get_random_string(1024 * 1024)) # 1MB row
|
||||
node1.query_with_retry(
|
||||
"INSERT INTO {} VALUES {}".format(
|
||||
name, ",".join(["('" + x + "')" for x in data])
|
||||
name, ",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
|
||||
@ -1503,7 +1501,7 @@ def test_simple_replication_and_moves(start_cluster):
|
||||
data.append(get_random_string(512 * 1024)) # 500KB value
|
||||
node.query_with_retry(
|
||||
"INSERT INTO replicated_table_for_moves VALUES {}".format(
|
||||
",".join(["('" + x + "')" for x in data])
|
||||
",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
|
||||
@ -1538,12 +1536,12 @@ def test_simple_replication_and_moves(start_cluster):
|
||||
|
||||
node1.query_with_retry(
|
||||
"INSERT INTO replicated_table_for_moves VALUES {}".format(
|
||||
",".join(["('" + x + "')" for x in data])
|
||||
",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
node2.query_with_retry(
|
||||
"INSERT INTO replicated_table_for_moves VALUES {}".format(
|
||||
",".join(["('" + x + "')" for x in data])
|
||||
",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
|
||||
@ -1581,7 +1579,7 @@ def test_download_appropriate_disk(start_cluster):
|
||||
data.append(get_random_string(1024 * 1024)) # 1MB value
|
||||
node1.query_with_retry(
|
||||
"INSERT INTO replicated_table_for_download VALUES {}".format(
|
||||
",".join(["('" + x + "')" for x in data])
|
||||
",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
|
||||
@ -1618,15 +1616,13 @@ def test_rename(start_cluster):
|
||||
"""
|
||||
)
|
||||
|
||||
node1.query("SYSTEM STOP MERGES default.renaming_table")
|
||||
|
||||
for _ in range(5):
|
||||
data = []
|
||||
for i in range(10):
|
||||
data.append(get_random_string(1024 * 1024)) # 1MB value
|
||||
node1.query(
|
||||
"INSERT INTO renaming_table VALUES {}".format(
|
||||
",".join(["('" + x + "')" for x in data])
|
||||
",".join(["(" + x + ")" for x in data])
|
||||
)
|
||||
)
|
||||
|
||||
@ -1667,6 +1663,8 @@ def test_freeze(start_cluster):
|
||||
"""
|
||||
)
|
||||
|
||||
node1.query("SYSTEM STOP MERGES default.freezing_table")
|
||||
|
||||
for _ in range(5):
|
||||
data = []
|
||||
dates = []
|
||||
@ -1675,7 +1673,7 @@ def test_freeze(start_cluster):
|
||||
dates.append("toDate('2019-03-05')")
|
||||
node1.query(
|
||||
"INSERT INTO freezing_table VALUES {}".format(
|
||||
",".join(["(" + d + ", '" + s + "')" for d, s in zip(dates, data)])
|
||||
",".join(["(" + d + ", " + s + ")" for d, s in zip(dates, data)])
|
||||
)
|
||||
)
|
||||
|
||||
@ -1719,7 +1717,7 @@ def test_kill_while_insert(start_cluster):
|
||||
data.append(get_random_string(1024 * 1024)) # 1MB value
|
||||
node1.query(
|
||||
"INSERT INTO {name} VALUES {}".format(
|
||||
",".join(["('" + s + "')" for s in data]), name=name
|
||||
",".join(["(" + s + ")" for s in data]), name=name
|
||||
)
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user