Skip to content

Commit e1ee917

Browse files
committed
Merge remote-tracking branch 'origin/v0.10.0' into sync/release_0.10.0
2 parents 1529baf + 035d69d commit e1ee917

16 files changed

Lines changed: 1500 additions & 195 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@
108108
previously set in milliseconds but mistakenly retrieved and used in seconds in some places. Now it correctly uses
109109
milliseconds consistently. (https://github.com/ClickHouse/clickhouse-java/issues/2358)
110110

111+
- **[client-v2]** HTTP `503 Service Unavailable` responses are now surfaced as a connection-style failure (
112+
`java.net.ConnectException`) and are retried by default. Previously a `503` was treated as a server error (
113+
`ServerException`) and fell under the `ServerRetryable` fault cause. It has been moved to the `ConnectTimeout` fault
114+
cause category so that connectivity/availability failures are handled uniformly with other connection errors. Callers
115+
that specifically excluded `ServerRetryable` to avoid retrying `503` should now adjust their
116+
`client_retry_on_failures` configuration to exclude `ConnectTimeout` instead.
117+
118+
- **[client-v2]** Unexpected/unknown HTTP status codes (those the client cannot interpret as a ClickHouse response) now
119+
throw a `ClientException` instead of a `ServerException`. Since the client cannot meaningfully handle these responses,
120+
they are reported as a client-side error rather than being attributed to the server.
121+
111122
### New Features
112123

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

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

179196
- **[jdbc-v2, client-v2]** Added support of hostnames with underscore (`_`) in them. Now it is possible to specify endpoint

client-v2/src/main/java/com/clickhouse/client/api/Client.java

Lines changed: 149 additions & 99 deletions
Large diffs are not rendered by default.

client-v2/src/main/java/com/clickhouse/client/api/http/ClickHouseHttpProto.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ public class ClickHouseHttpProto {
8484
*/
8585
public static final String QPARAM_QUERY_STMT = "query";
8686

87+
public static final String QPARAM_ENABLE_HTTP_COMPRESSION = "enable_http_compression";
88+
89+
public static final String QPARAM_COMPRESS = "compress";
90+
91+
public static final String QPARAM_DECOMPRESS = "decompress";
92+
8793
public static final int DEFAULT_HTTP_PORT = 8123;
8894

8995
public static final int DEFAULT_HTTPS_PORT = 8443;

client-v2/src/main/java/com/clickhouse/client/api/insert/InsertResponse.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,17 @@
33
import com.clickhouse.client.api.http.ClickHouseHttpProto;
44
import com.clickhouse.client.api.metrics.OperationMetrics;
55
import com.clickhouse.client.api.metrics.ServerMetrics;
6+
import com.clickhouse.client.api.transport.internal.TransportResponse;
67

7-
import java.util.Collections;
88
import java.util.Map;
99

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

14-
public InsertResponse(OperationMetrics metrics) {
15-
this(metrics, Collections.emptyMap());
16-
}
17-
18-
public InsertResponse(OperationMetrics metrics, Map<String, String> responseHeaders) {
14+
public InsertResponse(TransportResponse transportResponse, OperationMetrics metrics) {
1915
this.operationMetrics = metrics;
20-
this.responseHeaders = responseHeaders;
16+
this.responseHeaders = transportResponse.getHeaders();
2117
}
2218

2319
@Override

client-v2/src/main/java/com/clickhouse/client/api/internal/ClientUtils.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package com.clickhouse.client.api.internal;
22

3+
import org.slf4j.Logger;
4+
5+
import java.io.Closeable;
6+
37
/**
48
* Class containing utility methods used across the client.
59
*/
@@ -14,4 +18,14 @@ public static boolean isNotBlank(String str) {
1418
public static boolean isBlank(String str) {
1519
return str == null || str.trim().isEmpty();
1620
}
21+
22+
public static void quietClose(Closeable closeable, Logger log) {
23+
if (closeable != null) {
24+
try {
25+
closeable.close();
26+
} catch (Exception e) {
27+
log.warn("Failed to close object " + closeable, e);
28+
}
29+
}
30+
}
1731
}

0 commit comments

Comments
 (0)