2023-03-30 17:06:49 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-07-02 12:15:59 +00:00
|
|
|
# Tags: no-object-storage, no-random-settings, no-random-merge-tree-settings
|
2023-03-30 17:06:49 +00:00
|
|
|
|
|
|
|
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
# shellcheck source=../shell_config.sh
|
|
|
|
. "$CUR_DIR"/../shell_config.sh
|
|
|
|
|
2024-08-07 10:55:16 +00:00
|
|
|
$CLICKHOUSE_CLIENT -m -q "
|
2023-03-30 17:06:49 +00:00
|
|
|
drop table if exists data;
|
2023-05-02 22:31:09 +00:00
|
|
|
create table data (key UInt64 CODEC(NONE)) engine=MergeTree() order by tuple() settings min_bytes_for_wide_part=1e9;
|
2023-03-30 17:06:49 +00:00
|
|
|
"
|
|
|
|
|
|
|
|
# reading 1e6*8 bytes with 1M bandwith it should take (8-1)/1=7 seconds
|
|
|
|
$CLICKHOUSE_CLIENT -q "insert into data select * from numbers(1e6)"
|
|
|
|
|
|
|
|
query_id=$(random_str 10)
|
2023-09-04 15:52:48 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query_id "$query_id" -q "backup table data to Disk('backups', '$CLICKHOUSE_DATABASE/data/backup1')" --max_backup_bandwidth=1M > /dev/null
|
2024-08-07 10:55:16 +00:00
|
|
|
$CLICKHOUSE_CLIENT -m -q "
|
2023-03-30 17:06:49 +00:00
|
|
|
SYSTEM FLUSH LOGS;
|
|
|
|
SELECT
|
|
|
|
query_duration_ms >= 7e3,
|
|
|
|
ProfileEvents['ReadBufferFromFileDescriptorReadBytes'] > 8e6
|
|
|
|
FROM system.query_log
|
|
|
|
WHERE current_database = '$CLICKHOUSE_DATABASE' AND query_id = '$query_id' AND type != 'QueryStart'
|
|
|
|
"
|