Fix flaky test 03000_traverse_shadow_system_data_paths

This commit is contained in:
Aleksei Filatov 2024-04-26 15:37:44 +03:00
parent 0c8775ac73
commit 19a2dd3318
3 changed files with 20 additions and 30 deletions

View File

@ -1,29 +0,0 @@
#!/usr/bin/env bash
# Tags: no-fasttest
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
TABLE="03000_traverse_shadow_system_data_path_table"
BACKUP="03000_traverse_shadow_system_data_path_backup"
${CLICKHOUSE_CLIENT} --query="CREATE TABLE ${TABLE} (
id Int64,
data String
) ENGINE=MergeTree()
ORDER BY id
SETTINGS storage_policy='s3_cache';"
${CLICKHOUSE_CLIENT} --query="INSERT INTO ${TABLE} VALUES (0, 'data');"
${CLICKHOUSE_CLIENT} --query "SELECT count() > 0 FROM system.remote_data_paths WHERE disk_name = 's3_cache'"
${CLICKHOUSE_CLIENT} --query="ALTER TABLE ${TABLE} FREEZE WITH NAME '${BACKUP}';"
${CLICKHOUSE_CLIENT} --query="DROP TABLE ${TABLE} SYNC;"
${CLICKHOUSE_CLIENT} --query "
SELECT count() > 0
FROM system.remote_data_paths
WHERE disk_name = 's3_cache' AND local_path LIKE '%shadow/${BACKUP}%'
SETTINGS traverse_shadow_remote_data_paths=1;"
${CLICKHOUSE_CLIENT} --query "SYSTEM UNFREEZE WITH NAME '${BACKUP}';" &>/dev/null || true

View File

@ -0,0 +1,20 @@
-- Tags: no-replicated-database, no-fasttest
DROP TABLE IF EXISTS 03000_traverse_shadow_system_data_path_table;
CREATE TABLE 03000_traverse_shadow_system_data_path_table (
id Int64,
data String
) ENGINE=MergeTree()
ORDER BY id
SETTINGS storage_policy='s3_cache';
INSERT INTO 03000_traverse_shadow_system_data_path_table VALUES (0, 'data');
ALTER TABLE 03000_traverse_shadow_system_data_path_table FREEZE WITH NAME '03000_traverse_shadow_system_data_path_table_backup';
SELECT count() > 0
FROM system.remote_data_paths
WHERE disk_name = 's3_cache' AND local_path LIKE '%shadow/03000_traverse_shadow_system_data_path_table_backup%'
SETTINGS traverse_shadow_remote_data_paths=1;
DROP TABLE IF EXISTS 03000_traverse_shadow_system_data_path_table;