Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7b2d5c1
separated request creation and execution
chernser Jun 24, 2026
70217f5
Merge branch 'main' into 06/22/26/extract_request_logic
chernser Jun 24, 2026
54cc9c6
Merge branch 'main' into 06/22/26/extract_request_logic
chernser Jun 25, 2026
fd444b0
Added more tests and removed dead code halding 503 in client
chernser Jun 26, 2026
47a4965
Added cancelation tests
chernser Jun 26, 2026
e1018a7
Merge branch 'main' into 06/22/26/extract_request_logic
chernser Jun 26, 2026
9943d8d
Implemented cancellation method in client and added tests
chernser Jun 27, 2026
ea05afd
Fixed issue with 503 being not handled. Reorganized code handing stat…
chernser Jun 29, 2026
6592155
Merge branch '06/22/26/extract_request_logic' into 06/26/26/cancel_ht…
chernser Jun 29, 2026
8ea713b
Added exception handling
chernser Jun 30, 2026
862dd48
Fixed 503 error. Updated changelog
chernser Jul 1, 2026
edb40f4
Fixed unregistering request. Added tests that request is not retried
chernser Jul 1, 2026
e240deb
Merge branch 'main' into 06/26/26/cancel_http_request
chernser Jul 6, 2026
1ed667d
Updated migration guide with status code handling
chernser Jul 6, 2026
6feafbd
Fixed issue with mutating config
chernser Jul 17, 2026
035d69d
Merge pull request #2912 from ClickHouse/07/06/26/cance_http_request
chernser Jul 21, 2026
e1ee917
Merge remote-tracking branch 'origin/v0.10.0' into sync/release_0.10.0
chernser Jul 21, 2026
fcdf02d
Resolved changes between req cancellation and retries
chernser Jul 21, 2026
26bbf39
fixed skipped cancellation check
chernser Jul 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@
previously set in milliseconds but mistakenly retrieved and used in seconds in some places. Now it correctly uses
milliseconds consistently. (https://github.com/ClickHouse/clickhouse-java/issues/2358)

- **[client-v2]** HTTP `503 Service Unavailable` responses are now surfaced as a connection-style failure (
`java.net.ConnectException`) and are retried by default. Previously a `503` was treated as a server error (
`ServerException`) and fell under the `ServerRetryable` fault cause. It has been moved to the `ConnectTimeout` fault
cause category so that connectivity/availability failures are handled uniformly with other connection errors. Callers
that specifically excluded `ServerRetryable` to avoid retrying `503` should now adjust their
`client_retry_on_failures` configuration to exclude `ConnectTimeout` instead.

- **[client-v2]** Unexpected/unknown HTTP status codes (those the client cannot interpret as a ClickHouse response) now
throw a `ClientException` instead of a `ServerException`. Since the client cannot meaningfully handle these responses,
they are reported as a client-side error rather than being attributed to the server.

### New Features

- **[client-v2, jdbc-v2]** Added support for an application-supplied `javax.net.ssl.SSLContext`. In client-v2,
Expand Down Expand Up @@ -174,6 +185,12 @@
supported but will be removed. Please migrate to the new property.
(https://github.com/ClickHouse/clickhouse-java/issues/2858)

- **[client-v2]** Added `Client#cancelTransportRequest(String queryId)` to cancel an in-flight request that has not yet
received a response from the server, identified by the query id supplied in the operation settings. This aborts the
request on the client side (cancels the underlying IO operation) but does **not** issue a `KILL QUERY` on the server,
so a query that already started executing may continue to run server-side. It is recommended to use operation timeout
settings where possible; this API is intended for explicitly aborting a request from the client.

### Improvements

- **[jdbc-v2, client-v2]** Added support of hostnames with underscore (`_`) in them. Now it is possible to specify endpoint
Expand Down
260 changes: 157 additions & 103 deletions client-v2/src/main/java/com/clickhouse/client/api/Client.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ public class ClickHouseHttpProto {
*/
public static final String QPARAM_QUERY_STMT = "query";

public static final String QPARAM_ENABLE_HTTP_COMPRESSION = "enable_http_compression";

public static final String QPARAM_COMPRESS = "compress";

public static final String QPARAM_DECOMPRESS = "decompress";

public static final int DEFAULT_HTTP_PORT = 8123;

public static final int DEFAULT_HTTPS_PORT = 8443;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@
import com.clickhouse.client.api.http.ClickHouseHttpProto;
import com.clickhouse.client.api.metrics.OperationMetrics;
import com.clickhouse.client.api.metrics.ServerMetrics;
import com.clickhouse.client.api.transport.internal.TransportResponse;

import java.util.Collections;
import java.util.Map;

public class InsertResponse implements AutoCloseable {
private OperationMetrics operationMetrics;
private final Map<String, String> responseHeaders;

public InsertResponse(OperationMetrics metrics) {
this(metrics, Collections.emptyMap());
}

public InsertResponse(OperationMetrics metrics, Map<String, String> responseHeaders) {
public InsertResponse(TransportResponse transportResponse, OperationMetrics metrics) {
this.operationMetrics = metrics;
this.responseHeaders = responseHeaders;
this.responseHeaders = transportResponse.getHeaders();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.clickhouse.client.api.internal;

import org.slf4j.Logger;

import java.io.Closeable;

/**
* Class containing utility methods used across the client.
*/
Expand All @@ -14,4 +18,14 @@ public static boolean isNotBlank(String str) {
public static boolean isBlank(String str) {
return str == null || str.trim().isEmpty();
}

public static void quietClose(Closeable closeable, Logger log) {
if (closeable != null) {
try {
closeable.close();
} catch (Exception e) {
log.warn("Failed to close object " + closeable, e);
}
}
}
}
Loading
Loading