Trying to add a test

This commit is contained in:
Dmitry Novik 2023-02-07 18:38:26 +00:00
parent d43d17f59a
commit 9c74443783
3 changed files with 28 additions and 1 deletions

View File

@ -1229,12 +1229,12 @@ try
size_t default_background_server_memory_usage = static_cast<size_t>(memory_amount * background_memory_usage_to_ram_ratio);
if (background_memory_usage_soft_limit == 0 || background_memory_usage_soft_limit > default_background_server_memory_usage)
{
background_memory_usage_soft_limit = default_background_server_memory_usage;
LOG_WARNING(log, "Setting background_memory_usage_soft_limit was set to {}"
" ({} available * {:.2f} background_memory_usage_to_ram_ratio)",
formatReadableSizeWithBinarySuffix(background_memory_usage_soft_limit),
formatReadableSizeWithBinarySuffix(memory_amount),
background_memory_usage_to_ram_ratio);
background_memory_usage_soft_limit = default_background_server_memory_usage;
}
LOG_INFO(log, "Merges and mutations memory limit is set to {}",

View File

@ -0,0 +1,27 @@
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance("node")
@pytest.fixture(scope="module", autouse=True)
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_memory_limit_success():
node.query("CREATE TABLE test_merge_oom ENGINE=AggregatingMergeTree ORDER BY id EMPTY AS SELECT number%1024 AS id, arrayReduce( 'groupArrayState', arrayMap( x-> randomPrintableASCII(100), range(8192))) fat_state FROM numbers(20000)")
node.query("SYSTEM STOP MERGES test_merge_oom")
node.query("INSERT INTO test_merge_oom SELECT number%1024 AS id, arrayReduce( 'groupArrayState', arrayMap( x-> randomPrintableASCII(100), range(8192))) fat_state FROM numbers(20000)")
node.query("INSERT INTO test_merge_oom SELECT number%1024 AS id, arrayReduce( 'groupArrayState', arrayMap( x-> randomPrintableASCII(100), range(8192))) fat_state FROM numbers(20000)")
node.query("INSERT INTO test_merge_oom SELECT number%1024 AS id, arrayReduce( 'groupArrayState', arrayMap( x-> randomPrintableASCII(100), range(8192))) fat_state FROM numbers(20000)")
_, error = node.query_and_get_answer_with_error("SYSTEM START MERGES test_merge_oom;SET optimize_throw_if_noop=1;OPTIMIZE TABLE test_merge_oom FINAL")
assert not error
node.query("DROP TABLE test_merge_oom")