ClickHouse/tests/queries/0_stateless/02226_filesystem_cache_profile_events.sh

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

97 lines
3.5 KiB
Bash
Raw Normal View History

2022-05-27 13:10:52 +00:00
#!/usr/bin/env bash
2022-08-16 19:28:30 +00:00
# Tags: no-fasttest, no-parallel, no-s3-storage, no-random-settings, no-cpu-aarch64, no-replicated-database
2022-05-27 13:10:52 +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
2022-12-29 22:03:37 +00:00
for STORAGE_POLICY in 's3_cache' 'local_cache' 'azure_cache'; do
2022-12-29 20:16:07 +00:00
echo "Using storage policy: $STORAGE_POLICY"
clickhouse client --multiquery --multiline --query """
SET max_memory_usage='20G';
SET enable_filesystem_cache_on_write_operations = 0;
DROP TABLE IF EXISTS test_02226;
CREATE TABLE test_02226 (key UInt32, value String) Engine=MergeTree() ORDER BY key SETTINGS storage_policy='$STORAGE_POLICY';
INSERT INTO test_02226 SELECT * FROM generateRandom('key UInt32, value String') LIMIT 10000;
SET remote_filesystem_read_method='threadpool';
"""
query="SELECT * FROM test_02226 LIMIT 10"
query_id=$(clickhouse client --query "select queryID() from ($query) limit 1" 2>&1)
clickhouse client --multiquery --multiline --query """
SYSTEM FLUSH LOGS;
SELECT ProfileEvents['CachedReadBufferReadFromSourceBytes'] > 0 as remote_fs_read,
ProfileEvents['CachedReadBufferReadFromCacheBytes'] > 0 as remote_fs_cache_read,
ProfileEvents['CachedReadBufferCacheWriteBytes'] > 0 as remote_fs_read_and_download
FROM system.query_log
WHERE query_id='$query_id'
AND type = 'QueryFinish'
AND current_database = currentDatabase()
ORDER BY query_start_time DESC
LIMIT 1;
"""
clickhouse client --multiquery --multiline --query """
set remote_filesystem_read_method = 'read';
set local_filesystem_read_method = 'pread';
"""
query_id=$(clickhouse client --query "select queryID() from ($query) limit 1" 2>&1)
clickhouse client --multiquery --multiline --query """
SYSTEM FLUSH LOGS;
SELECT ProfileEvents['CachedReadBufferReadFromSourceBytes'] > 0 as remote_fs_read,
ProfileEvents['CachedReadBufferReadFromCacheBytes'] > 0 as remote_fs_cache_read,
ProfileEvents['CachedReadBufferCacheWriteBytes'] > 0 as remote_fs_read_and_download
FROM system.query_log
WHERE query_id='$query_id'
AND type = 'QueryFinish'
AND current_database = currentDatabase()
ORDER BY query_start_time DESC
LIMIT 1;
"""
clickhouse client --multiquery --multiline --query """
set remote_filesystem_read_method='threadpool';
"""
query_id=$(clickhouse client --query "select queryID() from ($query) limit 1")
clickhouse client --multiquery --multiline --query """
SYSTEM FLUSH LOGS;
SELECT ProfileEvents['CachedReadBufferReadFromSourceBytes'] > 0 as remote_fs_read,
ProfileEvents['CachedReadBufferReadFromCacheBytes'] > 0 as remote_fs_cache_read,
ProfileEvents['CachedReadBufferCacheWriteBytes'] > 0 as remote_fs_read_and_download
FROM system.query_log
WHERE query_id='$query_id'
AND type = 'QueryFinish'
AND current_database = currentDatabase()
ORDER BY query_start_time DESC
LIMIT 1;
"""
2023-04-18 15:50:54 +00:00
clickhouse client --multiquery --multiline --query """
SELECT * FROM test_02226 WHERE value LIKE '%abc%' ORDER BY value LIMIT 10 FORMAT Null;
SET enable_filesystem_cache_on_write_operations = 1;
TRUNCATE TABLE test_02226;
SELECT count() FROM test_02226;
SYSTEM DROP FILESYSTEM CACHE;
INSERT INTO test_02226 SELECT * FROM generateRandom('key UInt32, value String') LIMIT 10000;
"""
2023-04-19 14:57:49 +00:00
clickhouse client --query "DROP TABLE test_02226"
2022-06-21 17:30:21 +00:00
done