ClickHouse/tests/queries/0_stateless/02026_storage_filelog_largefile.sh

41 lines
1.7 KiB
Bash
Raw Normal View History

2021-10-06 10:37:58 +00:00
#!/usr/bin/env bash
# Tags: long, no-parallel
2021-10-06 10:37:58 +00:00
set -eu
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
# Data preparation.
# Now we can get the user_files_path by use the table file function for trick. also we can get it by query as:
# "insert into function file('exist.txt', 'CSV', 'val1 char') values ('aaaa'); select _path from file('exist.txt', 'CSV', 'val1 char')"
user_files_path=$(clickhouse-client --query "select _path,_file from file('nonexist.txt', 'CSV', 'val1 char')" 2>&1 | grep Exception | awk '{gsub("/nonexist.txt","",$9); print $9}')
2021-10-30 09:54:17 +00:00
mkdir -p ${user_files_path}/${CLICKHOUSE_TEST_UNIQUE_NAME}/
2021-10-06 10:37:58 +00:00
2021-10-30 09:54:17 +00:00
rm -rf ${user_files_path}/${CLICKHOUSE_TEST_UNIQUE_NAME:?}/*
2021-10-06 10:37:58 +00:00
2021-10-30 09:54:17 +00:00
chmod 777 ${user_files_path}/${CLICKHOUSE_TEST_UNIQUE_NAME}/
2021-10-06 15:48:23 +00:00
2021-11-10 07:55:49 +00:00
for i in {1..10}
2021-10-06 10:37:58 +00:00
do
2021-10-30 09:54:17 +00:00
${CLICKHOUSE_CLIENT} --query "insert into function file('${user_files_path}/${CLICKHOUSE_TEST_UNIQUE_NAME}/test$i.csv', 'CSV', 'k UInt32, v UInt32') select number, number from numbers(10000);"
2021-10-06 10:37:58 +00:00
done
${CLICKHOUSE_CLIENT} --query "drop table if exists file_log;"
2021-10-30 09:54:17 +00:00
${CLICKHOUSE_CLIENT} --query "create table file_log(k UInt32, v UInt32) engine=FileLog('${user_files_path}/${CLICKHOUSE_TEST_UNIQUE_NAME}/', 'CSV');"
2021-10-06 10:37:58 +00:00
${CLICKHOUSE_CLIENT} --query "select count() from file_log "
2021-11-10 07:55:49 +00:00
for i in {11..20}
2021-10-06 10:37:58 +00:00
do
2021-10-30 09:54:17 +00:00
${CLICKHOUSE_CLIENT} --query "insert into function file('${user_files_path}/${CLICKHOUSE_TEST_UNIQUE_NAME}/test$i.csv', 'CSV', 'k UInt32, v UInt32') select number, number from numbers(10000);"
2021-10-06 10:37:58 +00:00
done
${CLICKHOUSE_CLIENT} --query "select count() from file_log "
${CLICKHOUSE_CLIENT} --query "drop table file_log;"
2021-10-30 09:54:17 +00:00
rm -rf ${user_files_path}/${CLICKHOUSE_TEST_UNIQUE_NAME:?}