You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -664,3 +664,148 @@ Complete examples code is stored in the repo in a 'example` [folder](https://git
664
664
-[client-v2](https://github.com/ClickHouse/clickhouse-java/tree/main/examples/client-v2) - main set of examples.
665
665
-[demo-service](https://github.com/ClickHouse/clickhouse-java/tree/main/examples/demo-service) - example of how to use the client in a Spring Boot application.
666
666
-[demo-kotlin-service](https://github.com/ClickHouse/clickhouse-java/tree/main/examples/demo-kotlin-service) - example of how to use the client in Ktor (Kotlin) application.
667
+
668
+
## Migration From V1 ( =< 0.7.x ) {#migration_from_v1}
669
+
670
+
671
+
Old client (V1) was using `com.clickhouse.client.ClickHouseClient#builder` as start point. The new client (V2) uses similar pattern with `com.clickhouse.client.api.Client.Builder`. Main
672
+
differences are:
673
+
- no service loader is used to grab implementation. The `com.clickhouse.client.api.Client` is facade class for all kinds of implementation in the future.
674
+
- a fewer sources of configuration: one is provided to the builder and one is with operation settings (`QuerySettings`, `InsertSettings`). Previous version had configuration per node and was loading
675
+
env. variables in some cases.
676
+
677
+
### Configuration Parameters Match {#migration_from_v1_config}
678
+
679
+
There are 3 enum classes related to configuration in V1:
680
+
-`com.clickhouse.client.config.ClickHouseDefaults` - configuration parameters that supposed to be set in most use cases. Like `USER` and `PASSWORD`.
681
+
-`com.clickhouse.client.config.ClickHouseClientOption` - configuration parameters specific for the client. Like `HEALTH_CHECK_INTERVAL`.
682
+
-`com.clickhouse.client.http.config.ClickHouseHttpOption` - configuration parameters specific for HTTP interface. Like `RECEIVE_QUERY_PROGRESS`.
683
+
684
+
They were designed to group parameters and provide clear separation. However in some cases it lead to a confusion (is there a difference between `com.clickhouse.client.config.ClickHouseDefaults#ASYNC` and
685
+
`com.clickhouse.client.config.ClickHouseClientOption#ASYNC`). The new V2 client uses `com.clickhouse.client.api.Client.Builder` as single dictionary of all possible client configuration options.There is
686
+
`com.clickhouse.client.api.ClientConfigProperties` where all configuration parameter names are listed.
687
+
688
+
Table below shows what old options are supported in the new client and there new meaning.
|`com.clickhouse.client.config.ClickHouseDefaults#FORMAT`, `com.clickhouse.client.config.ClickHouseClientOption#FORMAT`| ✗ | Moved to operation settings (`QuerySettings` and `InsertSettings`) |
702
+
|`com.clickhouse.client.config.ClickHouseDefaults#MAX_SCHEDULER_THREADS`| ✗ | see `com.clickhouse.client.api.Client.Builder#setSharedOperationExecutor`|
703
+
|`com.clickhouse.client.config.ClickHouseDefaults#MAX_THREADS`| ✗ | see `com.clickhouse.client.api.Client.Builder#setSharedOperationExecutor`|
|`com.clickhouse.client.config.ClickHouseDefaults#THREAD_KEEPALIVE_TIMEOUT`| see `com.clickhouse.client.api.Client.Builder#setSharedOperationExecutor`||
|`com.clickhouse.client.config.ClickHouseClientOption#CUSTOM_SOCKET_FACTORY_OPTIONS`| ✗ | See `com.clickhouse.client.api.Client.Builder#sslSocketSNI` to set SNI |
|`com.clickhouse.client.config.ClickHouseClientOption#COMPRESS`|`com.clickhouse.client.api.Client.Builder#compressServerResponse`| See also `com.clickhouse.client.api.Client.Builder#useHttpCompression`|
735
+
|`com.clickhouse.client.config.ClickHouseClientOption#DECOMPRESS`|`com.clickhouse.client.api.Client.Builder#compressClientRequest`| See also `com.clickhouse.client.api.Client.Builder#useHttpCompression`|
736
+
|`com.clickhouse.client.config.ClickHouseClientOption#COMPRESS_ALGORITHM`| ✗ |`LZ4` for non-http compression. Http compression is defined by `Accept-Encoding` header. |
737
+
|`com.clickhouse.client.config.ClickHouseClientOption#DECOMPRESS_ALGORITHM`| ✗ |`LZ4` for non-http compression. Http compression is defined by `Content-Encoding` header. |
|`com.clickhouse.client.config.ClickHouseClientOption#LOG_LEADING_COMMENT`| ✗ | See `com.clickhouse.client.api.query.QuerySettings#logComment` and `com.clickhouse.client.api.insert.InsertSettings#logComment`|
|`com.clickhouse.client.config.ClickHouseClientOption#RETRY`|`com.clickhouse.client.api.Client.Builder#setMaxRetries`| See also `com.clickhouse.client.api.Client.Builder#retryOnFailures`|
|`com.clickhouse.client.config.ClickHouseClientOption#SSL_ROOT_CERTIFICATE`|`com.clickhouse.client.api.Client.Builder#setRootCertificate`| SSL Auth should be enabled by `com.clickhouse.client.api.Client.Builder#useSSLAuthentication`|
|`com.clickhouse.client.http.config.ClickHouseHttpOption#WAIT_END_OF_QUERY`| ✗ | Server side setting |
806
+
|`com.clickhouse.client.http.config.ClickHouseHttpOption#REMEMBER_LAST_SET_ROLES`|`com.clickhouse.client.api.Client#setDBRoles`| Is runtime configuration now. See also `com.clickhouse.client.api.query.QuerySettings#setDBRoles` and `com.clickhouse.client.api.insert.InsertSettings#setDBRoles`|
807
+
|`com.clickhouse.client.http.config.ClickHouseHttpOption#AHC_VALIDATE_AFTER_INACTIVITY`| ✗ | Always enabled when Apache Http Client is used |
0 commit comments