diff --git a/tests/integration/test_input_format_parallel_parsing_memory_tracking/__init__.py b/tests/integration/test_input_format_parallel_parsing_memory_tracking/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/integration/test_input_format_parallel_parsing_memory_tracking/configs/conf.xml b/tests/integration/test_input_format_parallel_parsing_memory_tracking/configs/conf.xml new file mode 100644 index 00000000000..26cb2bfa782 --- /dev/null +++ b/tests/integration/test_input_format_parallel_parsing_memory_tracking/configs/conf.xml @@ -0,0 +1,4 @@ + + + 3000000000 + diff --git a/tests/integration/test_input_format_parallel_parsing_memory_tracking/test.py b/tests/integration/test_input_format_parallel_parsing_memory_tracking/test.py new file mode 100644 index 00000000000..06a1a72162d --- /dev/null +++ b/tests/integration/test_input_format_parallel_parsing_memory_tracking/test.py @@ -0,0 +1,33 @@ +# pylint: disable=unused-argument +# pylint: disable=redefined-outer-name +# pylint: disable=line-too-long + +import pytest + +from helpers.cluster import ClickHouseCluster + +cluster = ClickHouseCluster(__file__) + +instance = cluster.add_instance('instance', main_configs=['configs/conf.xml']) + +@pytest.fixture(scope='module', autouse=True) +def start_cluster(): + try: + cluster.start() + yield cluster + finally: + cluster.shutdown() + +# max_memory_usage_for_user cannot be used, since the memory for user accounted +# correctly, only total is not +def test_memory_tracking_total(): + instance.query(''' + CREATE TABLE null (row String) ENGINE=Null; + ''') + instance.exec_in_container(['bash', '-c', + 'clickhouse client -q "SELECT arrayStringConcat(arrayMap(x->toString(cityHash64(x)), range(1000)), \' \') from numbers(10000)" > data.json']) + for it in range(0, 20): + # the problem can be triggered only via HTTP, + # since clickhouse-client parses the data by itself. + assert instance.exec_in_container(['curl', '--silent', '--show-error', '--data-binary', '@data.json', + 'http://127.1:8123/?query=INSERT%20INTO%20null%20FORMAT%20TSV']) == '', 'Failed on {} iteration'.format(it)