Skip to content

Commit ad5c822

Browse files
committed
Merge branch 'main' into repo_review_dependencies
2 parents 9df5c71 + 8fdeb8e commit ad5c822

File tree

22 files changed

+253
-197
lines changed

22 files changed

+253
-197
lines changed

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
env:
1414
CHC_BRANCH: "main"
15-
CHC_VERSION: "0.8.5"
15+
CHC_VERSION: "0.8.6"
1616
CH_VERSION: "24.8"
1717

1818
jobs:

clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseDataType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.time.Duration;
88
import java.time.LocalDate;
99
import java.time.LocalDateTime;
10+
import java.time.LocalTime;
1011
import java.time.Period;
1112
import java.time.ZonedDateTime;
1213
import java.time.temporal.ChronoUnit;

clickhouse-jdbc/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@
393393
<configuration>
394394
<shadedArtifactAttached>true</shadedArtifactAttached>
395395
<createDependencyReducedPom>true</createDependencyReducedPom>
396-
<createSourcesJar>true</createSourcesJar>
396+
<!-- <createSourcesJar>true</createSourcesJar>-->
397397
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
398398
<shadedClassifierName>all</shadedClassifierName>
399399
<artifactSet>

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

Lines changed: 15 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import com.clickhouse.client.api.http.ClickHouseHttpProto;
1616
import com.clickhouse.client.api.insert.InsertResponse;
1717
import com.clickhouse.client.api.insert.InsertSettings;
18-
import com.clickhouse.client.api.internal.ClickHouseLZ4OutputStream;
1918
import com.clickhouse.client.api.internal.ClientStatisticsHolder;
2019
import com.clickhouse.client.api.internal.HttpAPIClientHelper;
2120
import com.clickhouse.client.api.internal.MapUtils;
@@ -80,9 +79,6 @@
8079
import java.util.function.Supplier;
8180
import java.util.stream.Collectors;
8281

83-
import static java.time.temporal.ChronoUnit.MILLIS;
84-
import static java.time.temporal.ChronoUnit.SECONDS;
85-
8682
/**
8783
* <p>Client is the starting point for all interactions with ClickHouse. </p>
8884
*
@@ -141,12 +137,12 @@ public class Client implements AutoCloseable {
141137
private int retries;
142138
private LZ4Factory lz4Factory = null;
143139

144-
private Client(Set<String> endpoints, Map<String,String> configuration, boolean useNewImplementation,
140+
private Client(Set<String> endpoints, Map<String,String> configuration,
145141
ExecutorService sharedOperationExecutor, ColumnToMethodMatchingStrategy columnToMethodMatchingStrategy) {
146-
this(endpoints, configuration, useNewImplementation, sharedOperationExecutor, columnToMethodMatchingStrategy, null);
142+
this(endpoints, configuration, sharedOperationExecutor, columnToMethodMatchingStrategy, null);
147143
}
148144

149-
private Client(Set<String> endpoints, Map<String,String> configuration, boolean useNewImplementation,
145+
private Client(Set<String> endpoints, Map<String,String> configuration,
150146
ExecutorService sharedOperationExecutor, ColumnToMethodMatchingStrategy columnToMethodMatchingStrategy, Object metricsRegistry) {
151147
// Simple initialization
152148
this.configuration = configuration;
@@ -256,14 +252,22 @@ public static class Builder {
256252

257253
// Read-only configuration
258254
private Map<String, String> configuration;
259-
private boolean useNewImplementation = true;
260255

261256
private ExecutorService sharedOperationExecutor = null;
262257
private ColumnToMethodMatchingStrategy columnToMethodMatchingStrategy;
263258
private Object metricRegistry = null;
264259
public Builder() {
265260
this.endpoints = new HashSet<>();
266-
this.configuration = new HashMap<String, String>();
261+
this.configuration = new HashMap<>();
262+
263+
for (ClientConfigProperties p : ClientConfigProperties.values()) {
264+
if (p.getDefaultValue() != null) {
265+
this.configuration.put(p.getKey(), p.getDefaultValue());
266+
}
267+
}
268+
269+
allowBinaryReaderToReuseBuffers(false);
270+
columnToMethodMatchingStrategy = DefaultColumnToMethodMatchingStrategy.INSTANCE;
267271
}
268272

269273
/**
@@ -510,7 +514,7 @@ public Builder setSocketRcvbuf(long size) {
510514
* @param size - socket send buffer size in bytes
511515
*/
512516
public Builder setSocketSndbuf(long size) {
513-
this.configuration.put(ClientConfigProperties.SOCKET_RCVBUF_OPT.getKey(), String.valueOf(size));
517+
this.configuration.put(ClientConfigProperties.SOCKET_SNDBUF_OPT.getKey(), String.valueOf(size));
514518
return this;
515519
}
516520

@@ -656,25 +660,12 @@ public Builder setExecutionTimeout(long timeout, ChronoUnit timeUnit) {
656660
return this;
657661
}
658662

659-
/**
660-
* Switches to new implementation of the client. Default is true.
661-
* Throws exception if {@code useNewImplementation == false}
662-
* @deprecated
663-
*/
664-
public Builder useNewImplementation(boolean useNewImplementation) {
665-
if (!useNewImplementation) {
666-
throw new ClientException("switch between new and old version is remove because old version is deprecated.");
667-
}
668-
return this;
669-
}
670-
671663
public Builder setHttpCookiesEnabled(boolean enabled) {
672664
//TODO: extract to settings string constants
673665
this.configuration.put("client.http.cookies_enabled", String.valueOf(enabled));
674666
return this;
675667
}
676668

677-
678669
/**
679670
* Defines path to the trust store file. It cannot be combined with
680671
* certificates. Either trust store or certificates should be used.
@@ -1013,8 +1004,6 @@ public Builder setServerVersion(String serverVersion) {
10131004
}
10141005

10151006
public Client build() {
1016-
setDefaults();
1017-
10181007
// check if endpoint are empty. so can not initiate client
10191008
if (this.endpoints.isEmpty()) {
10201009
throw new IllegalArgumentException("At least one endpoint is required");
@@ -1070,128 +1059,9 @@ public Client build() {
10701059
throw new IllegalArgumentException("Nor server timezone nor specific timezone is set");
10711060
}
10721061

1073-
return new Client(this.endpoints, this.configuration, this.useNewImplementation, this.sharedOperationExecutor,
1062+
return new Client(this.endpoints, this.configuration, this.sharedOperationExecutor,
10741063
this.columnToMethodMatchingStrategy, this.metricRegistry);
10751064
}
1076-
1077-
1078-
private static final int DEFAULT_NETWORK_BUFFER_SIZE = 300_000;
1079-
1080-
/**
1081-
* Default size for a buffers used in networking.
1082-
*/
1083-
public static final int DEFAULT_BUFFER_SIZE = 8192;
1084-
public static final int DEFAULT_SOCKET_BUFFER_SIZE = 804800;
1085-
1086-
private void setDefaults() {
1087-
1088-
// set default database name if not specified
1089-
if (!configuration.containsKey(ClientConfigProperties.DATABASE.getKey())) {
1090-
setDefaultDatabase((String) "default");
1091-
}
1092-
1093-
if (!configuration.containsKey(ClientConfigProperties.MAX_EXECUTION_TIME.getKey())) {
1094-
setExecutionTimeout(0, MILLIS);
1095-
}
1096-
1097-
if (!configuration.containsKey(ClientConfigProperties.MAX_THREADS_PER_CLIENT.getKey())) {
1098-
configuration.put(ClientConfigProperties.MAX_THREADS_PER_CLIENT.getKey(),
1099-
String.valueOf(0));
1100-
}
1101-
1102-
if (!configuration.containsKey("compression.lz4.uncompressed_buffer_size")) {
1103-
setLZ4UncompressedBufferSize(ClickHouseLZ4OutputStream.UNCOMPRESSED_BUFF_SIZE);
1104-
}
1105-
1106-
if (!configuration.containsKey(ClientConfigProperties.DISABLE_NATIVE_COMPRESSION.getKey())) {
1107-
disableNativeCompression(false);
1108-
}
1109-
1110-
if (!configuration.containsKey(ClientConfigProperties.USE_SERVER_TIMEZONE.getKey())) {
1111-
useServerTimeZone(true);
1112-
}
1113-
1114-
if (!configuration.containsKey(ClientConfigProperties.SERVER_TIMEZONE.getKey())) {
1115-
setServerTimeZone("UTC");
1116-
}
1117-
1118-
if (!configuration.containsKey(ClientConfigProperties.ASYNC_OPERATIONS.getKey())) {
1119-
useAsyncRequests(false);
1120-
}
1121-
1122-
if (!configuration.containsKey(ClientConfigProperties.HTTP_MAX_OPEN_CONNECTIONS.getKey())) {
1123-
setMaxConnections(10);
1124-
}
1125-
1126-
if (!configuration.containsKey(ClientConfigProperties.CONNECTION_REQUEST_TIMEOUT.getKey())) {
1127-
setConnectionRequestTimeout(10, SECONDS);
1128-
}
1129-
1130-
if (!configuration.containsKey(ClientConfigProperties.CONNECTION_REUSE_STRATEGY.getKey())) {
1131-
setConnectionReuseStrategy(ConnectionReuseStrategy.FIFO);
1132-
}
1133-
1134-
if (!configuration.containsKey(ClientConfigProperties.CONNECTION_POOL_ENABLED.getKey())) {
1135-
enableConnectionPool(true);
1136-
}
1137-
1138-
if (!configuration.containsKey(ClientConfigProperties.CONNECTION_TTL.getKey())) {
1139-
setConnectionTTL(-1, MILLIS);
1140-
}
1141-
1142-
if (!configuration.containsKey(ClientConfigProperties.CLIENT_RETRY_ON_FAILURE.getKey())) {
1143-
retryOnFailures(ClientFaultCause.NoHttpResponse, ClientFaultCause.ConnectTimeout,
1144-
ClientFaultCause.ConnectionRequestTimeout);
1145-
}
1146-
1147-
if (!configuration.containsKey(ClientConfigProperties.CLIENT_NETWORK_BUFFER_SIZE.getKey())) {
1148-
setClientNetworkBufferSize(DEFAULT_NETWORK_BUFFER_SIZE);
1149-
}
1150-
1151-
if (!configuration.containsKey(ClientConfigProperties.RETRY_ON_FAILURE.getKey())) {
1152-
setMaxRetries(3);
1153-
}
1154-
1155-
if (!configuration.containsKey("client_allow_binary_reader_to_reuse_buffers")) {
1156-
allowBinaryReaderToReuseBuffers(false);
1157-
}
1158-
1159-
if (columnToMethodMatchingStrategy == null) {
1160-
columnToMethodMatchingStrategy = DefaultColumnToMethodMatchingStrategy.INSTANCE;
1161-
}
1162-
1163-
if (!configuration.containsKey(ClientConfigProperties.HTTP_USE_BASIC_AUTH.getKey())) {
1164-
useHTTPBasicAuth(true);
1165-
}
1166-
1167-
if (!configuration.containsKey(ClientConfigProperties.COMPRESS_CLIENT_REQUEST.getKey())) {
1168-
compressClientRequest(false);
1169-
}
1170-
1171-
if (!configuration.containsKey(ClientConfigProperties.COMPRESS_SERVER_RESPONSE.getKey())) {
1172-
compressServerResponse(true);
1173-
}
1174-
1175-
if (!configuration.containsKey(ClientConfigProperties.USE_HTTP_COMPRESSION.getKey())) {
1176-
useHttpCompression(false);
1177-
}
1178-
1179-
if (!configuration.containsKey(ClientConfigProperties.APP_COMPRESSED_DATA.getKey())) {
1180-
appCompressedData(false);
1181-
}
1182-
1183-
if (!configuration.containsKey(ClientConfigProperties.SOCKET_OPERATION_TIMEOUT.getKey())) {
1184-
setSocketTimeout(0, SECONDS);
1185-
}
1186-
1187-
if (!configuration.containsKey(ClientConfigProperties.SOCKET_RCVBUF_OPT.getKey())) {
1188-
setSocketRcvbuf(DEFAULT_SOCKET_BUFFER_SIZE);
1189-
}
1190-
1191-
if (!configuration.containsKey(ClientConfigProperties.SOCKET_SNDBUF_OPT.getKey())) {
1192-
setSocketSndbuf(DEFAULT_SOCKET_BUFFER_SIZE);
1193-
}
1194-
}
11951065
}
11961066

11971067
/**

0 commit comments

Comments
 (0)