mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #67726 from ClickHouse/fix-02789_reading_from_s3_with_connection_pool
Fix test `02789_reading_from_s3_with_connection_pool`
This commit is contained in:
commit
357013f08d
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tags: no-fasttest, no-random-settings, no-replicated-database
|
||||
# Tags: no-fasttest, no-random-settings, no-replicated-database, no-distributed-cache
|
||||
|
||||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
@ -14,43 +14,59 @@ SETTINGS disk = 's3_disk', min_bytes_for_wide_part = 0;
|
||||
|
||||
INSERT INTO test_s3 SELECT number, number FROM numbers_mt(1e7);
|
||||
"
|
||||
query="SELECT a, b FROM test_s3"
|
||||
query_id=$(${CLICKHOUSE_CLIENT} --query "select queryID() from ($query) limit 1" 2>&1)
|
||||
${CLICKHOUSE_CLIENT} --query "SYSTEM FLUSH LOGS"
|
||||
${CLICKHOUSE_CLIENT} -nm --query "
|
||||
SELECT ProfileEvents['DiskConnectionsPreserved'] > 0
|
||||
FROM system.query_log
|
||||
WHERE type = 'QueryFinish'
|
||||
AND current_database = currentDatabase()
|
||||
AND query_id='$query_id';
|
||||
"
|
||||
|
||||
# This (reusing connections from the pool) is not guaranteed to always happen,
|
||||
# (due to random time difference between the queries and random activity in parallel)
|
||||
# but should happen most of the time.
|
||||
|
||||
while true
|
||||
do
|
||||
query="SELECT a, b FROM test_s3"
|
||||
query_id=$(${CLICKHOUSE_CLIENT} --query "select queryID() from ($query) limit 1" 2>&1)
|
||||
${CLICKHOUSE_CLIENT} --query "SYSTEM FLUSH LOGS"
|
||||
|
||||
RES=$(${CLICKHOUSE_CLIENT} -nm --query "
|
||||
SELECT ProfileEvents['DiskConnectionsPreserved'] > 0
|
||||
FROM system.query_log
|
||||
WHERE type = 'QueryFinish'
|
||||
AND current_database = currentDatabase()
|
||||
AND query_id='$query_id';
|
||||
")
|
||||
|
||||
[[ $RES -eq 1 ]] && echo "$RES" && break;
|
||||
done
|
||||
|
||||
|
||||
# Test connection pool in ReadWriteBufferFromHTTP
|
||||
|
||||
query_id=$(${CLICKHOUSE_CLIENT} -nq "
|
||||
create table mut (n int, m int, k int) engine=ReplicatedMergeTree('/test/02441/{database}/mut', '1') order by n;
|
||||
set insert_keeper_fault_injection_probability=0;
|
||||
insert into mut values (1, 2, 3), (10, 20, 30);
|
||||
while true
|
||||
do
|
||||
query_id=$(${CLICKHOUSE_CLIENT} -nq "
|
||||
create table mut (n int, m int, k int) engine=ReplicatedMergeTree('/test/02441/{database}/mut', '1') order by n;
|
||||
set insert_keeper_fault_injection_probability=0;
|
||||
insert into mut values (1, 2, 3), (10, 20, 30);
|
||||
|
||||
system stop merges mut;
|
||||
alter table mut delete where n = 10;
|
||||
system stop merges mut;
|
||||
alter table mut delete where n = 10;
|
||||
|
||||
select queryID() from(
|
||||
-- a funny way to wait for a MUTATE_PART to be assigned
|
||||
select sleepEachRow(2) from url('http://localhost:8123/?param_tries={1..10}&query=' || encodeURLComponent(
|
||||
'select 1 where ''MUTATE_PART'' not in (select type from system.replication_queue where database=''' || currentDatabase() || ''' and table=''mut'')'
|
||||
), 'LineAsString', 's String')
|
||||
-- queryID() will be returned for each row, since the query above doesn't return anything we need to return a fake row
|
||||
union all
|
||||
select 1
|
||||
) limit 1 settings max_threads=1;
|
||||
" 2>&1)
|
||||
${CLICKHOUSE_CLIENT} --query "SYSTEM FLUSH LOGS"
|
||||
${CLICKHOUSE_CLIENT} -nm --query "
|
||||
SELECT ProfileEvents['StorageConnectionsPreserved'] > 0
|
||||
FROM system.query_log
|
||||
WHERE type = 'QueryFinish'
|
||||
AND current_database = currentDatabase()
|
||||
AND query_id='$query_id';
|
||||
"
|
||||
select queryID() from(
|
||||
-- a funny way to wait for a MUTATE_PART to be assigned
|
||||
select sleepEachRow(2) from url('http://localhost:8123/?param_tries={1..10}&query=' || encodeURLComponent(
|
||||
'select 1 where ''MUTATE_PART'' not in (select type from system.replication_queue where database=''' || currentDatabase() || ''' and table=''mut'')'
|
||||
), 'LineAsString', 's String')
|
||||
-- queryID() will be returned for each row, since the query above doesn't return anything we need to return a fake row
|
||||
union all
|
||||
select 1
|
||||
) limit 1 settings max_threads=1;
|
||||
" 2>&1)
|
||||
${CLICKHOUSE_CLIENT} --query "SYSTEM FLUSH LOGS"
|
||||
RES=$(${CLICKHOUSE_CLIENT} -nm --query "
|
||||
SELECT ProfileEvents['StorageConnectionsPreserved'] > 0
|
||||
FROM system.query_log
|
||||
WHERE type = 'QueryFinish'
|
||||
AND current_database = currentDatabase()
|
||||
AND query_id='$query_id';
|
||||
")
|
||||
|
||||
[[ $RES -eq 1 ]] && echo "$RES" && break;
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user