mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-09 17:14:47 +00:00
rework test_async_insert_adaptive_busy_timeout
This commit is contained in:
parent
718957886d
commit
b4a0a9b00c
@ -104,7 +104,7 @@ def test_with_merge_tree():
|
||||
_insert_queries_sequentially(
|
||||
table_name,
|
||||
_query_settings,
|
||||
iterations=100,
|
||||
iterations=10,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 50],
|
||||
)
|
||||
@ -125,7 +125,7 @@ def test_with_merge_tree_multithread():
|
||||
table_name,
|
||||
_query_settings,
|
||||
thread_num=15,
|
||||
tasks=1000,
|
||||
tasks=100,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 15],
|
||||
)
|
||||
@ -152,7 +152,7 @@ def test_with_replicated_merge_tree():
|
||||
_insert_queries_sequentially(
|
||||
table_name,
|
||||
settings,
|
||||
iterations=100,
|
||||
iterations=10,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 50],
|
||||
)
|
||||
@ -180,7 +180,7 @@ def test_with_replicated_merge_tree_multithread():
|
||||
table_name,
|
||||
_query_settings,
|
||||
thread_num=15,
|
||||
tasks=1000,
|
||||
tasks=100,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 15],
|
||||
)
|
||||
@ -200,13 +200,13 @@ def test_compare_sequential_inserts_durations_for_adaptive_and_fixed_async_timeo
|
||||
|
||||
fixed_tm_settings = copy.copy(_query_settings)
|
||||
fixed_tm_settings["async_insert_use_adaptive_busy_timeout"] = 0
|
||||
fixed_tm_settings["async_insert_busy_timeout_ms"] = 200
|
||||
fixed_tm_settings["async_insert_busy_timeout_ms"] = 100
|
||||
|
||||
fixed_tm_run_duration = timeit.timeit(
|
||||
lambda: _insert_queries_sequentially(
|
||||
fixed_tm_table_name,
|
||||
fixed_tm_settings,
|
||||
iterations=100,
|
||||
iterations=50,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 50],
|
||||
),
|
||||
@ -231,13 +231,13 @@ def test_compare_sequential_inserts_durations_for_adaptive_and_fixed_async_timeo
|
||||
|
||||
adaptive_tm_settings = copy.copy(_query_settings)
|
||||
adaptive_tm_settings["async_insert_busy_timeout_min_ms"] = 10
|
||||
adaptive_tm_settings["async_insert_busy_timeout_max_ms"] = 1000
|
||||
adaptive_tm_settings["async_insert_busy_timeout_max_ms"] = 500
|
||||
|
||||
adaptive_tm_run_duration = timeit.timeit(
|
||||
lambda: _insert_queries_sequentially(
|
||||
adaptive_tm_table_name,
|
||||
adaptive_tm_settings,
|
||||
iterations=100,
|
||||
iterations=50,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 50],
|
||||
),
|
||||
@ -268,14 +268,14 @@ def test_compare_parallel_inserts_durations_for_adaptive_and_fixed_async_timeout
|
||||
|
||||
fixed_tm_settings = copy.copy(_query_settings)
|
||||
fixed_tm_settings["async_insert_use_adaptive_busy_timeout"] = 0
|
||||
fixed_tm_settings["async_insert_busy_timeout_ms"] = 200
|
||||
fixed_tm_settings["async_insert_busy_timeout_ms"] = 500
|
||||
|
||||
fixed_tm_run_duration = timeit.timeit(
|
||||
lambda: _insert_queries_in_parallel(
|
||||
fixed_tm_table_name,
|
||||
fixed_tm_settings,
|
||||
thread_num=15,
|
||||
tasks=1000,
|
||||
tasks=150,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 50],
|
||||
),
|
||||
@ -300,14 +300,14 @@ def test_compare_parallel_inserts_durations_for_adaptive_and_fixed_async_timeout
|
||||
|
||||
adaptive_tm_settings = copy.copy(_query_settings)
|
||||
adaptive_tm_settings["async_insert_busy_timeout_min_ms"] = 10
|
||||
adaptive_tm_settings["async_insert_busy_timeout_max_ms"] = 200
|
||||
adaptive_tm_settings["async_insert_busy_timeout_max_ms"] = 500
|
||||
|
||||
adaptive_tm_run_duration = timeit.timeit(
|
||||
lambda: _insert_queries_in_parallel(
|
||||
adaptive_tm_table_name,
|
||||
adaptive_tm_settings,
|
||||
thread_num=15,
|
||||
tasks=100,
|
||||
tasks=150,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 50],
|
||||
),
|
||||
@ -344,29 +344,34 @@ def test_change_queries_frequency():
|
||||
|
||||
settings = copy.copy(_query_settings)
|
||||
min_ms = 50
|
||||
max_ms = 200
|
||||
|
||||
settings["async_insert_busy_timeout_min_ms"] = min_ms
|
||||
settings["async_insert_busy_timeout_max_ms"] = 2000
|
||||
settings["async_insert_busy_timeout_max_ms"] = max_ms
|
||||
|
||||
_insert_queries_sequentially(
|
||||
table_name,
|
||||
settings,
|
||||
iterations=50,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 50],
|
||||
)
|
||||
|
||||
select_log_query = f"SELECT countIf(timeout_milliseconds - {min_ms} < 25) FROM (SELECT timeout_milliseconds FROM system.asynchronous_insert_log ORDER BY event_time DESC LIMIT 10)"
|
||||
res = node.query(select_log_query)
|
||||
assert int(res) >= 5
|
||||
|
||||
_insert_queries_in_parallel(
|
||||
table_name,
|
||||
settings,
|
||||
thread_num=15,
|
||||
thread_num=20,
|
||||
tasks=2000,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 15],
|
||||
)
|
||||
|
||||
_insert_queries_sequentially(
|
||||
table_name,
|
||||
settings,
|
||||
iterations=200,
|
||||
max_values_size=1000,
|
||||
array_size_range=[10, 50],
|
||||
)
|
||||
|
||||
select_log_query = "SELECT timeout_milliseconds FROM system.asynchronous_insert_log ORDER BY event_time DESC LIMIT 50"
|
||||
select_log_query = f"SELECT countIf({max_ms} - timeout_milliseconds < 100) FROM (SELECT timeout_milliseconds FROM system.asynchronous_insert_log ORDER BY event_time DESC LIMIT 10)"
|
||||
res = node.query(select_log_query)
|
||||
for line in res.splitlines():
|
||||
assert int(line) == min_ms
|
||||
assert int(res) >= 5
|
||||
|
||||
node.query("DROP TABLE IF EXISTS {} SYNC".format(table_name))
|
||||
|
@ -532,6 +532,7 @@ def test_current_database():
|
||||
assert "Not enough privileges" in instance.query_and_get_error(
|
||||
"SELECT * FROM table", user="A"
|
||||
)
|
||||
instance.query("DROP TABLE default.table SYNC")
|
||||
|
||||
|
||||
def test_grant_with_replace_option():
|
||||
|
Loading…
Reference in New Issue
Block a user