diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index be631aa0c41..2a8fd3df57a 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -1731,6 +1731,10 @@ catch (...) void MergeTreeData::waitForOutdatedPartsToBeLoaded() const { + /// Background tasks are not run if storage is static. + if (isStaticStorage()) + return; + if (outdated_data_parts_loading_finished) return; diff --git a/tests/queries/0_stateless/02482_load_parts_parition_commands.reference b/tests/queries/0_stateless/02482_load_parts_parition_commands.reference deleted file mode 100644 index bf234f57595..00000000000 --- a/tests/queries/0_stateless/02482_load_parts_parition_commands.reference +++ /dev/null @@ -1,62 +0,0 @@ -Engine: MergeTree, Command: ALTER TABLE load_parts_drop_partition_src DROP PARTITION 1 -500 -1 -1 -1 -0 -0 -Engine: MergeTree, Command: ALTER TABLE load_parts_drop_partition_src DETACH PARTITION 1 -500 -1 -1 -1 -0 -0 -Engine: MergeTree, Command: ALTER TABLE load_parts_drop_partition_src MOVE PARTITION 1 TO TABLE load_parts_drop_partition_dst -500 -500 -1 -1 -1 -0 -0 -Engine: MergeTree, Command: TRUNCATE load_parts_drop_partition_src -500 -1 -1 -1 -0 -0 -Engine: ReplicatedMergeTree('/test/02482_load_parts_partitions/{database}/{table}', '1'), Command: ALTER TABLE load_parts_drop_partition_src DROP PARTITION 1 -500 -1 -1 -1 -1 -0 -0 -Engine: ReplicatedMergeTree('/test/02482_load_parts_partitions/{database}/{table}', '1'), Command: ALTER TABLE load_parts_drop_partition_src DETACH PARTITION 1 -500 -1 -1 -1 -1 -0 -0 -Engine: ReplicatedMergeTree('/test/02482_load_parts_partitions/{database}/{table}', '1'), Command: ALTER TABLE load_parts_drop_partition_src MOVE PARTITION 1 TO TABLE load_parts_drop_partition_dst -500 -500 -1 -1 -1 -1 -0 -0 -Engine: ReplicatedMergeTree('/test/02482_load_parts_partitions/{database}/{table}', '1'), Command: TRUNCATE load_parts_drop_partition_src -500 -1 -1 -1 -1 -0 -0 diff --git a/tests/queries/0_stateless/02482_load_parts_parition_commands.sh b/tests/queries/0_stateless/02482_load_parts_parition_commands.sh deleted file mode 100755 index 768e5ddb290..00000000000 --- a/tests/queries/0_stateless/02482_load_parts_parition_commands.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env bash -# Tags: zookeeper, long - -CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -# shellcheck source=../shell_config.sh -. "$CURDIR"/../shell_config.sh - -function query_with_retry -{ - retry=0 - until [ $retry -ge 5 ] - do - result=$($CLICKHOUSE_CLIENT $2 --query="$1" 2>&1) - if [ "$?" == 0 ]; then - echo -n "$result" - return - else - retry=$(($retry + 1)) - sleep 3 - fi - done - echo "Query '$1' failed with '$result'" -} - -function test_case -{ - engine="$1" - partition_command="$2" - tables=$(echo "$partition_command" | grep -E "load_parts_drop_partition_[a-z]*" -o) - - echo "Engine: $engine, Command: $partition_command" - - for table in $tables; do - $CLICKHOUSE_CLIENT -n --query " - DROP TABLE IF EXISTS $table SYNC; - - CREATE TABLE $table(id UInt64, val UInt64) - ENGINE = $engine - ORDER BY id PARTITION BY id; - - SYSTEM STOP MERGES $table; - " - - $CLICKHOUSE_CLIENT --max_block_size=1 --max_insert_block_size=1 --min_insert_block_size_rows=1 --min_insert_block_size_bytes=1 -n --query " - INSERT INTO $table SELECT 1, number FROM numbers(500); - - SELECT count() FROM system.parts WHERE database = '$CLICKHOUSE_DATABASE' AND table = '$table' AND active; - - SYSTEM START MERGES $table; - " - - query_with_retry "OPTIMIZE TABLE $table PARTITION 1 FINAL SETTINGS optimize_throw_if_noop = 1" - done - - $CLICKHOUSE_CLIENT -n --query " - SELECT count() FROM system.parts WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'load_parts_drop_partition_src' AND active; - SELECT count() > 0 FROM system.parts WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'load_parts_drop_partition_src' AND NOT active; - - DETACH TABLE load_parts_drop_partition_src; - ATTACH TABLE load_parts_drop_partition_src; - - SELECT count() FROM system.parts WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'load_parts_drop_partition_src' AND active; - " - - if [[ "$engine" != "MergeTree" ]]; then - $CLICKHOUSE_CLIENT --query "SELECT count() > 0 FROM system.parts WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'load_parts_drop_partition_src' AND NOT active" - fi - - $CLICKHOUSE_CLIENT --query "$partition_command" - - $CLICKHOUSE_CLIENT -n --query " - SELECT count() FROM system.parts WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'load_parts_drop_partition_src' AND level = 0; - - DETACH TABLE load_parts_drop_partition_src; - ATTACH TABLE load_parts_drop_partition_src; - - SELECT count() FROM system.parts WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'load_parts_drop_partition_src' AND level = 0; - " - - for table in $tables; do - $CLICKHOUSE_CLIENT --query "DROP TABLE $table SYNC" - done -} - -declare -a engines=( - "MergeTree" - "ReplicatedMergeTree('/test/02482_load_parts_partitions/{database}/{table}', '1')" -) - -for engine in "${engines[@]}"; do - test_case "$engine" "ALTER TABLE load_parts_drop_partition_src DROP PARTITION 1" - test_case "$engine" "ALTER TABLE load_parts_drop_partition_src DETACH PARTITION 1" - test_case "$engine" "ALTER TABLE load_parts_drop_partition_src MOVE PARTITION 1 TO TABLE load_parts_drop_partition_dst" - test_case "$engine" "TRUNCATE load_parts_drop_partition_src" -done