|
33 | 33 | AND query_id='$query_id'; |
34 | 34 | ") |
35 | 35 |
|
36 | | - [[ $RES -eq 1 ]] && echo "$RES" && break; |
| 36 | + [[ $RES -eq 1 ]] && echo "DiskConnectionsPreserved $RES" && break; |
37 | 37 | done |
38 | 38 |
|
39 | 39 |
|
40 | 40 | # 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 |
41 | 46 |
|
42 | 47 | while true |
43 | 48 | do |
44 | 49 | 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 | + ") |
52 | 59 |
|
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) |
63 | 60 | ${CLICKHOUSE_CLIENT} --query "SYSTEM FLUSH LOGS query_log" |
| 61 | + |
64 | 62 | RES=$(${CLICKHOUSE_CLIENT} -m --query " |
65 | 63 | SELECT ProfileEvents['StorageConnectionsPreserved'] > 0 |
66 | 64 | FROM system.query_log |
|
69 | 67 | AND query_id='$query_id'; |
70 | 68 | ") |
71 | 69 |
|
72 | | - [[ $RES -eq 1 ]] && echo "$RES" && break; |
| 70 | + [[ $RES -eq 1 ]] && echo "DiskConnStorageConnectionsPreservedectionsPreserved $RES" && break; |
73 | 71 | done |
0 commit comments