Description
After upgrading ClickHouse server from 25.3 to 26.3 (which changed the default value of async_insert from 0 to 1), the setting remained 0 for all connections made via jdbc-v2, despite no explicit configuration on either client or server side.
Root Cause
jdbc-v2 explicitly sends all user profile settings as HTTP query parameters on every request. This means the driver's own hardcoded defaults override the server-side profile values.
Even though async_insert = 1 is set in the server profile, every query arrives at the server with async_insert=0 injected by the driver, which can be confirmed via system.query_log:
SELECT Settings['async_insert']
FROM system.query_log
WHERE type = 'QueryStart'
ORDER BY event_time DESC
LIMIT 5;
-- returns 0 for all jdbc-v2 connections
Full Settings map from system.query_log for a jdbc-v2 connection:
{max_query_size=2000000000, connect_timeout=30, connect_timeout_with_failover_ms=3000,
connections_with_failover_max_tries=3, use_uncompressed_cache=0, load_balancing=random,
distributed_aggregation_memory_efficient=1, max_bytes_before_external_group_by=20000000000,
max_bytes_before_external_sort=20000000000, max_memory_usage=120000000000, async_insert=0}
The driver is sending the entire profile as explicit HTTP parameters, including async_insert=0.
For comparison, clickhouse-connect (Python) for the same user and server returns:
async_insert: value=1, changed=0
It doesn't touch the setting at all and lets the server use its own default.
Steps to Reproduce
- Use ClickHouse server 26.3+ (where
async_insert default is 1)
- Connect via jdbc-v2 (tested with 0.9.7)
- Run:
SELECT value, changed FROM system.settings WHERE name = 'async_insert';
- Observe
value=0, changed=1 - the driver has overridden the server default
What Was Tried
All of the following failed to override the driver-injected value:
- Setting
async_insert=1 in server profile (users.xml)
- Setting
async_insert=1 in JDBC URL as ?clickhouse_setting_async_insert=1
- Setting
async_insert=1 in Driver Properties / User Properties
- Adding
SET async_insert=1 as Connection Initialization SQL in DBeaver
- Using profile constraints in
users.xml:
<constraints>
<async_insert>
<readonly/>
</async_insert>
</constraints>
This results in SETTING_CONSTRAINT_VIOLATION on connect because the driver sends async_insert=0 during the handshake, before any user-level constraints are applied.
The only workaround found is appending SETTINGS async_insert=1 to every individual query.
Expected Behavior
The driver should not explicitly send settings that were not configured by the user. Server profile settings belong to the server - the driver should only transmit settings that are explicitly set by the client, not shadow server-side defaults with its own hardcoded values.
Environment
- ClickHouse server: 26.3
- Driver:
com.clickhouse:clickhouse-jdbc 0.9.7 (jdbc-v2)
- Client: DBeaver 26.0.2
- OS: Windows 11, JVM 21.0.8
http_user_agent: DBeaver 26.0.2 - Main jdbc-v2/0.9.7 clickhouse-java-v2/0.9.7 (Windows 11; jvm:21.0.8) Apache-HttpClient/5.4.4
Description
After upgrading ClickHouse server from 25.3 to 26.3 (which changed the default value of
async_insertfrom0to1), the setting remained0for all connections made via jdbc-v2, despite no explicit configuration on either client or server side.Root Cause
jdbc-v2 explicitly sends all user profile settings as HTTP query parameters on every request. This means the driver's own hardcoded defaults override the server-side profile values.
Even though
async_insert = 1is set in the server profile, every query arrives at the server withasync_insert=0injected by the driver, which can be confirmed viasystem.query_log:Full
Settingsmap fromsystem.query_logfor a jdbc-v2 connection:The driver is sending the entire profile as explicit HTTP parameters, including
async_insert=0.For comparison,
clickhouse-connect(Python) for the same user and server returns:It doesn't touch the setting at all and lets the server use its own default.
Steps to Reproduce
async_insertdefault is1)value=0, changed=1- the driver has overridden the server defaultWhat Was Tried
All of the following failed to override the driver-injected value:
async_insert=1in server profile (users.xml)async_insert=1in JDBC URL as?clickhouse_setting_async_insert=1async_insert=1in Driver Properties / User PropertiesSET async_insert=1as Connection Initialization SQL in DBeaverusers.xml:This results in
SETTING_CONSTRAINT_VIOLATIONon connect because the driver sendsasync_insert=0during the handshake, before any user-level constraints are applied.The only workaround found is appending
SETTINGS async_insert=1to every individual query.Expected Behavior
The driver should not explicitly send settings that were not configured by the user. Server profile settings belong to the server - the driver should only transmit settings that are explicitly set by the client, not shadow server-side defaults with its own hardcoded values.
Environment
com.clickhouse:clickhouse-jdbc0.9.7 (jdbc-v2)http_user_agent:DBeaver 26.0.2 - Main jdbc-v2/0.9.7 clickhouse-java-v2/0.9.7 (Windows 11; jvm:21.0.8) Apache-HttpClient/5.4.4