From 0db2a5cf8cdb107a6d213158166961602e36a465 Mon Sep 17 00:00:00 2001 From: Zhichun Wu Date: Tue, 2 May 2023 21:33:55 +0800 Subject: [PATCH 1/4] update readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 911d82213..0f1d0d1bf 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,10 @@ Java libraries for connecting to ClickHouse and processing data in various forma | Transaction | Transaction | :white_check_mark: | supported since 0.3.2-patch11, use ClickHouse 22.7+ for native implicit transaction support | | | Savepoint | :x: | | | | XAConnection | :x: | | -| Misc. | Centralized Configuration | :white_check_mark: | supported since 0.4.2, limited to JDBC driver and requires custom server setting `custom_jdbc_config` for all connected JDBC clients - [#1290](../../pull/1290) | -| | INFILE & OUTFILE | :white_check_mark: | supported since 0.4.2, limited to JDBC driver and requires `localFile` option - [#1291](../../pull/1291) | +| Misc. | Centralized Configuration | :white_check_mark: | supported since 0.4.2, limited to JDBC driver and requires custom server setting `custom_jdbc_config` for all connected JDBC clients - [#1290](../../pull/1290) | +| | INFILE & OUTFILE | :white_check_mark: | supported since 0.4.2, limited to JDBC driver and requires `localFile` option - [#1291](../../pull/1291) | | | Implicit Type Conversion | :white_check_mark: | String/number to Date/Time/Timestamp and more | +| | Object mapping | :white_check_mark: | supported since 0.4.6, slow and limited to simple data types | ## Usage From b9a3f8f931c0f3bf70b2ef142bbac06a8028c7a9 Mon Sep 17 00:00:00 2001 From: Zhichun Wu Date: Tue, 2 May 2023 21:42:04 +0800 Subject: [PATCH 2/4] update description --- .../client/http/config/ClickHouseHttpOption.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/clickhouse-http-client/src/main/java/com/clickhouse/client/http/config/ClickHouseHttpOption.java b/clickhouse-http-client/src/main/java/com/clickhouse/client/http/config/ClickHouseHttpOption.java index 5a360934f..60cb4f849 100644 --- a/clickhouse-http-client/src/main/java/com/clickhouse/client/http/config/ClickHouseHttpOption.java +++ b/clickhouse-http-client/src/main/java/com/clickhouse/client/http/config/ClickHouseHttpOption.java @@ -33,6 +33,10 @@ public enum ClickHouseHttpOption implements ClickHouseOption { * Whether to enable keep-alive or not. */ KEEP_ALIVE("http_keep_alive", true, "Whether to use keep-alive or not"), + /** + * Max open connections apply with Apache HttpClient only. + */ + MAX_OPEN_CONNECTIONS("max_open_connections", 10, "Max open connections apply with Apache HttpClient only."), /** * Whether to receive information about the progress of a query in response * headers. @@ -47,13 +51,7 @@ public enum ClickHouseHttpOption implements ClickHouseOption { /** * Web context. */ - WEB_CONTEXT("web_context", "/", "Web context."), - - /** - * Max connections of ApacheHttpConnectionImpl - */ - MAX_OPEN_CONNECTIONS("max_open_connections", 10, - "max open connections for a ClickHouseConnection"); + WEB_CONTEXT("web_context", "/", "Web context."); private final String key; private final Serializable defaultValue; From d2969f1e4328eeba8993d3ceeb3bb97754f62bc4 Mon Sep 17 00:00:00 2001 From: Zhichun Wu Date: Tue, 2 May 2023 21:48:08 +0800 Subject: [PATCH 3/4] Log one more bug fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9a39448..c8301b36f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Two new options(use_compilation & max_mapper_cache) reserved for future usage. ### Bug Fixes +* Too many socket fds generated by Apache HttpClient. * NoClassDefFoundError with clickhouse-apache-http-client-jdbc. [#1319](https://github.com/ClickHouse/clickhouse-java/issues/1319) * Nested array in tuple array is incorrectly deserialized. [#1324](https://github.com/ClickHouse/clickhouse-java/issues/1324) * client certificate password exposure in exception. [#1331](https://github.com/ClickHouse/clickhouse-java/issues/1331) From 230f199e6766cdffe8ce221f2235d723a7f0b14c Mon Sep 17 00:00:00 2001 From: Zhichun Wu Date: Tue, 2 May 2023 21:56:17 +0800 Subject: [PATCH 4/4] Fix issues reported by SonarCloud --- .../clickhouse/client/http/ClickHouseHttpConnectionFactory.java | 2 +- clickhouse-jdbc/src/main/java/com/clickhouse/jdbc/Main.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clickhouse-http-client/src/main/java/com/clickhouse/client/http/ClickHouseHttpConnectionFactory.java b/clickhouse-http-client/src/main/java/com/clickhouse/client/http/ClickHouseHttpConnectionFactory.java index b1723ab79..764d09bd0 100644 --- a/clickhouse-http-client/src/main/java/com/clickhouse/client/http/ClickHouseHttpConnectionFactory.java +++ b/clickhouse-http-client/src/main/java/com/clickhouse/client/http/ClickHouseHttpConnectionFactory.java @@ -25,7 +25,7 @@ public static ClickHouseHttpConnection createConnection(ClickHouseNode server, C } catch (IOException e) { throw e; } catch (Throwable t) { - log.warn("Error when creating http client %s, will use HTTP_URL_CONNECTION", provider.name(), t); + log.warn("Error when creating http client %s, will use HTTP_URL_CONNECTION", provider, t); return new HttpUrlConnectionImpl(server, request, executor); } } diff --git a/clickhouse-jdbc/src/main/java/com/clickhouse/jdbc/Main.java b/clickhouse-jdbc/src/main/java/com/clickhouse/jdbc/Main.java index 3cd9580e9..fbe69f495 100644 --- a/clickhouse-jdbc/src/main/java/com/clickhouse/jdbc/Main.java +++ b/clickhouse-jdbc/src/main/java/com/clickhouse/jdbc/Main.java @@ -510,7 +510,7 @@ final long read(Options options) throws ClickHouseException, SQLException { if (options.hasFile()) { try { response.getInputStream().setCopyToTarget( - !"-".equals(options.file) ? new FileOutputStream(options.file, false) + !"-".equals(options.file) ? new FileOutputStream(options.file, false) // NOSONAR : System.out); // NOSONAR } catch (IOException e) { throw ClickHouseException.of(e, server);