ClickHouse / ClickHouse/clickhouse-java

ClickHouseDatabaseMetaData.getCatalogs exceeds max_execution_time, causing the connection not to be released

Open
#1,557 0 comments 0 reactions 0 assignees View on GitHub
action:verify bug client-api-v2
Dominant language
Java
Stars
1.6k
Forks
636
Avg merge
2d 16h
Merged PRs (30d)
28

Description

class: ClickHouseDatabaseMetaData.getCatalogs

```
SELECT
event_time,
query_duration_ms,
initial_user,
query sql,
if(exception_code = 0,'success',exception) exception,
Settings
FROM clusterAllReplicas('ck', 'system.query_log')
WHERE event_time>='2024-02-29 14:39:00'
AND event_time<'2024-02-29 14:40:00'
AND query_duration_ms>600000
ORDER BY event_time DESC limit 10;\G
```
```
event_time: 2024-02-29 14:39:11
query_duration_ms: 822838
initial_user: trino
sql: select name as TABLE_CAT from system.databases order by name settings max_execution_time=20
exception: success
Settings: {'max_threads':'6','use_hedged_requests':'0','queue_max_wait_ms':'120000','use_uncompressed_cache':'0','background_fetches_pool_size':'26','background_schedule_pool_size':'256','load_balancing':'random','log_queries':'1','max_concurrent_queries_for_user':'100','send_progress_in_http_headers':'1','join_use_nulls':'1','max_replica_delay_for_distributed_queries':'1','distributed_ddl_task_timeout':'360','max_execution_time':'20','timeout_before_checking_execution_speed':'60','max_memory_usage':'50000000000','max_memory_usage_for_user':'50000000000','enable_global_with_statement':'1','date_time_input_format':'best_effort','insert_distributed_one_random_shard':'1'}
```

clickhouse-server HTTP connection:
![image](https://github.com/ClickHouse/clickhouse-java/assets/37773807/94a2df1c-6a15-4b25-87e7-6d118db43ad1)
This will cause many queries for that user to fail.

1. Why does settings max_execution_time=20 in sql not take effect?
2. `show create user trino` get `max_execution_time = 600`, This setting does not take effect either.
3. **How can I avoid time-out metadata queries that on `system.databases` like this? Can I set it in clickhouse-jdbc?**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.