Skip to content

Commit e8e49aa

Browse files
committed
fix test 02789_reading_from_s3_with_connection_pool
1 parent 4f1fbc2 commit e8e49aa

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
1
2-
1
1+
DiskConnectionsPreserved 1
2+
DiskConnStorageConnectionsPreservedectionsPreserved 1

tests/queries/0_stateless/02789_reading_from_s3_with_connection_pool.sh

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,32 @@ do
3333
AND query_id='$query_id';
3434
")
3535

36-
[[ $RES -eq 1 ]] && echo "$RES" && break;
36+
[[ $RES -eq 1 ]] && echo "DiskConnectionsPreserved $RES" && break;
3737
done
3838

3939

4040
# Test connection pool in ReadWriteBufferFromHTTP
41+
# we do here `while` because it might be a bad luck that the session is not preserved due to hitting server limits
42+
# if we change LIMIT 2 to LIMIT 1 then test would fail because
43+
# query_log collects the metrics before pipeline is destroyed
44+
# StorageURLSource releases the HTTP session either when all data is fully read or at d-tor
45+
# with LIMIT 1 the HTTP session is released after query_log is written
4146

4247
while true
4348
do
4449
query_id=$(${CLICKHOUSE_CLIENT} -q "
45-
create table if not exists mut (n int, m int, k int) engine=ReplicatedMergeTree('/test/02441/{database}/mut', '1') order by n;
46-
set insert_keeper_fault_injection_probability=0;
47-
set parallel_replicas_for_cluster_engines=0;
48-
insert into mut values (1, 2, 3), (10, 20, 30);
49-
50-
system stop merges mut;
51-
alter table mut delete where n = 10;
50+
SELECT queryID() FROM(
51+
SELECT sleepEachRow(2)
52+
FROM url(
53+
'http://localhost:8123/?query=' || encodeURLComponent('select 1'),
54+
'LineAsString',
55+
's String')
56+
-- queryID() will be returned for each row, since the query above doesn't return anything we need to return a fake row
57+
) LIMIT 2 SETTINGS max_threads=1, http_make_head_request=0;
58+
")
5259

53-
select queryID() from(
54-
-- a funny way to wait for a MUTATE_PART to be assigned
55-
select sleepEachRow(2) from url('http://localhost:8123/?param_tries={1..10}&query=' || encodeURLComponent(
56-
'select 1 where ''MUTATE_PART'' not in (select type from system.replication_queue where database=''' || currentDatabase() || ''' and table=''mut'')'
57-
), 'LineAsString', 's String')
58-
-- queryID() will be returned for each row, since the query above doesn't return anything we need to return a fake row
59-
union all
60-
select 1
61-
) limit 1 settings max_threads=1, http_make_head_request=0;
62-
" 2>&1)
6360
${CLICKHOUSE_CLIENT} --query "SYSTEM FLUSH LOGS query_log"
61+
6462
RES=$(${CLICKHOUSE_CLIENT} -m --query "
6563
SELECT ProfileEvents['StorageConnectionsPreserved'] > 0
6664
FROM system.query_log
@@ -69,5 +67,5 @@ do
6967
AND query_id='$query_id';
7068
")
7169

72-
[[ $RES -eq 1 ]] && echo "$RES" && break;
70+
[[ $RES -eq 1 ]] && echo "DiskConnStorageConnectionsPreservedectionsPreserved $RES" && break;
7371
done

0 commit comments

Comments
 (0)