Skip to content

Commit 4d0e32e

Browse files
committed
tests: avoid extra remote_data_paths usage in 02286_drop_filesystem_cache (slow)
Now it is 2x faster
1 parent 856d0cd commit 4d0e32e

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

tests/queries/0_stateless/02286_drop_filesystem_cache.sh

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ for STORAGE_POLICY in 's3_cache' 'local_cache' 'azure_cache'; do
3939

4040
$CLICKHOUSE_CLIENT --query "SELECT * FROM test_02286 FORMAT Null"
4141
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
42-
4342
$CLICKHOUSE_CLIENT --query "SELECT count()
4443
FROM (
4544
SELECT
@@ -53,20 +52,26 @@ for STORAGE_POLICY in 's3_cache' 'local_cache' 'azure_cache'; do
5352
ON data_paths.cache_path = caches.cache_path"
5453

5554
$CLICKHOUSE_CLIENT --query "DROP TABLE test_02286 SYNC"
56-
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache"
5755

58-
$CLICKHOUSE_CLIENT --query "SELECT cache_path FROM system.filesystem_cache"
59-
$CLICKHOUSE_CLIENT --query "SELECT cache_path, local_path
60-
FROM (
61-
SELECT
62-
arrayJoin(cache_paths) AS cache_path,
63-
local_path,
64-
remote_path
65-
FROM
66-
system.remote_data_paths
67-
) AS data_paths
68-
INNER JOIN system.filesystem_cache AS caches
69-
ON data_paths.cache_path = caches.cache_path"
56+
cache_entries=$($CLICKHOUSE_CLIENT --query "SELECT count() FROM system.filesystem_cache")
57+
echo "$cache_entries"
58+
# system.remote_data_paths is very slow for web disks, so let's avoid extra
59+
# call to it (we need it only for debugging of this tests, and only when we
60+
# have cache entries, which tests does not expect)
61+
if [ $cache_entries -gt 0 ]; then
62+
$CLICKHOUSE_CLIENT --query "SELECT cache_path FROM system.filesystem_cache"
63+
$CLICKHOUSE_CLIENT --query "SELECT cache_path, local_path
64+
FROM (
65+
SELECT
66+
arrayJoin(cache_paths) AS cache_path,
67+
local_path,
68+
remote_path
69+
FROM
70+
system.remote_data_paths
71+
) AS data_paths
72+
INNER JOIN system.filesystem_cache AS caches
73+
ON data_paths.cache_path = caches.cache_path "
74+
fi
7075

7176
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS test_022862"
7277
done

0 commit comments

Comments
 (0)