This commit is contained in:
Dmitry Novik 2023-02-21 01:43:01 +00:00
parent 16a9ac9118
commit 573ce50403

View File

@ -21,15 +21,20 @@ def test_memory_usage():
"CREATE TABLE async_table(data Array(UInt64)) ENGINE=MergeTree() ORDER BY data" "CREATE TABLE async_table(data Array(UInt64)) ENGINE=MergeTree() ORDER BY data"
) )
response = node.get_query_request( node.get_query_request(
"SELECT groupArray(number + sleepEachRow(0.0001)) FROM numbers(1000000) SETTINGS max_memory_usage_for_user={}".format(30 * (2 ** 23)) "SELECT count() FROM system.numbers"
) )
INSERT_QUERY = "INSERT INTO async_table SETTINGS async_insert=1, wait_for_async_insert=1 VALUES ({})" INSERT_QUERY = "INSERT INTO async_table SETTINGS async_insert=1, wait_for_async_insert=1 VALUES ({})"
for i in range(10): for iter in range(10):
node.query(INSERT_QUERY.format([i in range(i * 5000000, (i + 1) * 5000000)])) values = list(range(iter * 5000000, (iter + 1) * 5000000))
node.query(INSERT_QUERY.format(values))
response = node.get_query_request(
"SELECT groupArray(number) FROM numbers(1000000) SETTINGS max_memory_usage_for_user={}".format(30 * (2 ** 23))
)
_, err = response.get_answer_and_error() _, err = response.get_answer_and_error()
assert err == "", "Query failed" assert err == "", "Query failed with error {}".format(err)
node.query("DROP TABLE async_table") node.query("DROP TABLE async_table")