ClickHouse/tests/queries/0_stateless/02286_drop_filesystem_cache.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
4.2 KiB
Bash
Raw Normal View History

2022-05-30 22:46:21 +00:00
#!/usr/bin/env bash
2022-12-29 22:03:37 +00:00
# Tags: long, no-fasttest, no-parallel, no-s3-storage, no-random-settings
2022-05-30 22:46:21 +00:00
# set -x
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
2022-12-29 20:16:07 +00:00
for STORAGE_POLICY in 's3_cache' 'local_cache'; do
echo "Using storage policy: $STORAGE_POLICY"
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS test_02286"
2022-05-30 22:46:21 +00:00
2022-12-29 20:16:07 +00:00
$CLICKHOUSE_CLIENT -n --query "CREATE TABLE test_02286 (key UInt32, value String)
Engine=MergeTree()
ORDER BY key
SETTINGS storage_policy='$STORAGE_POLICY', min_bytes_for_wide_part = 10485760"
$CLICKHOUSE_CLIENT --query "SYSTEM STOP MERGES"
$CLICKHOUSE_CLIENT --query "SYSTEM DROP FILESYSTEM CACHE"
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
$CLICKHOUSE_CLIENT --enable_filesystem_cache_on_write_operations=0 --query "INSERT INTO test_02286 SELECT number, toString(number) FROM numbers(100)"
$CLICKHOUSE_CLIENT --query "SELECT * FROM test_02286 FORMAT Null"
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
$CLICKHOUSE_CLIENT --query "SYSTEM DROP FILESYSTEM CACHE"
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
$CLICKHOUSE_CLIENT --query "SELECT * FROM test_02286 FORMAT Null"
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
$CLICKHOUSE_CLIENT --multiline --multiquery --query "SYSTEM DROP FILESYSTEM CACHE './data'; --{serverError 36}"
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
$CLICKHOUSE_CLIENT --query "SELECT * FROM test_02286 FORMAT Null"
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
$CLICKHOUSE_CLIENT -n --query "SELECT count()
FROM (
SELECT
arrayJoin(cache_paths) AS cache_path,
local_path,
remote_path
FROM
system.remote_data_paths
) AS data_paths
INNER JOIN system.filesystem_cache AS caches
ON data_paths.cache_path = caches.cache_path"
$CLICKHOUSE_CLIENT --query "DROP TABLE test_02286 NO DELAY"
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
$CLICKHOUSE_CLIENT --query "SELECT cache_path FROM system.filesystem_cache"
$CLICKHOUSE_CLIENT -n --query "SELECT cache_path, local_path
FROM (
SELECT
arrayJoin(cache_paths) AS cache_path,
local_path,
remote_path
FROM
system.remote_data_paths
) AS data_paths
INNER JOIN system.filesystem_cache AS caches
ON data_paths.cache_path = caches.cache_path"
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS test_022862"
$CLICKHOUSE_CLIENT -n --query "CREATE TABLE test_022862 (key UInt32, value String)
Engine=MergeTree()
ORDER BY key
SETTINGS storage_policy='${STORAGE_POLICY}_2', min_bytes_for_wide_part = 10485760"
$CLICKHOUSE_CLIENT --enable_filesystem_cache_on_write_operations=0 --query "INSERT INTO test_022862 SELECT number, toString(number) FROM numbers(100)"
$CLICKHOUSE_CLIENT --query "SELECT * FROM test_022862 FORMAT Null"
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
$CLICKHOUSE_CLIENT --query "SYSTEM DROP FILESYSTEM CACHE '${STORAGE_POLICY}_2/'"
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS test_022862"
2022-05-30 22:46:21 +00:00
done