2020-01-19 19:16:33 +00:00
|
|
|
# pylint: disable=unused-argument
|
|
|
|
# pylint: disable=redefined-outer-name
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
node = cluster.add_instance(
|
|
|
|
"node",
|
|
|
|
main_configs=["configs/config.d/storage_configuration.xml"],
|
|
|
|
tmpfs=["/disk1:size=100M", "/disk2:size=100M"],
|
|
|
|
)
|
2020-09-16 04:26:10 +00:00
|
|
|
|
2020-01-19 19:16:33 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
@pytest.fixture(scope="module")
|
2020-01-19 19:16:33 +00:00
|
|
|
def start_cluster():
|
|
|
|
try:
|
|
|
|
cluster.start()
|
|
|
|
yield cluster
|
|
|
|
finally:
|
|
|
|
cluster.shutdown()
|
|
|
|
|
2020-09-16 04:26:10 +00:00
|
|
|
|
2022-11-23 14:48:51 +00:00
|
|
|
def test_disk_selection(start_cluster):
|
2022-03-22 16:39:58 +00:00
|
|
|
query = "SELECT count(ignore(*)) FROM (SELECT * FROM system.numbers LIMIT 1e7) GROUP BY number"
|
2020-01-19 19:16:33 +00:00
|
|
|
settings = {
|
2022-03-22 16:39:58 +00:00
|
|
|
"max_bytes_before_external_group_by": 1 << 20,
|
|
|
|
"max_bytes_before_external_sort": 1 << 20,
|
2020-01-19 19:16:33 +00:00
|
|
|
}
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
assert node.contains_in_log("Setting up /disk1/ to store temporary data in it")
|
|
|
|
assert node.contains_in_log("Setting up /disk2/ to store temporary data in it")
|
2020-01-19 19:16:33 +00:00
|
|
|
|
|
|
|
node.query(query, settings=settings)
|
2022-03-22 16:39:58 +00:00
|
|
|
assert node.contains_in_log(
|
|
|
|
"Writing part of aggregation data into temporary file /disk1/"
|
|
|
|
)
|
|
|
|
assert node.contains_in_log(
|
|
|
|
"Writing part of aggregation data into temporary file /disk2/"
|
|
|
|
)
|