Skip to content

Commit f9f9683

Browse files
authored
Merge pull request #900 from ClickHouse/develop
merge 0.3.2-patch8
2 parents 3b0a353 + b76a2ee commit f9f9683

File tree

131 files changed

+6401
-2106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+6401
-2106
lines changed

.github/workflows/benchmark.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ on:
2525
driver:
2626
description: "Driver version"
2727
required: true
28-
default: "0.3.2-SNAPSHOT"
28+
default: "0.3.3-SNAPSHOT"
2929
options:
3030
description: "Benchmark options"
3131
required: true
@@ -60,8 +60,8 @@ jobs:
6060
run: |
6161
mvn --batch-mode --update-snapshots -q -DskipTests install
6262
cd clickhouse-benchmark
63-
java -DclickhouseVersion="21.8" -jar target/benchmarks.jar -rf text \
64-
-p client=clickhouse-http-jdbc1 -p client=clickhouse-grpc-jdbc -p type=object Basic
63+
java -DclickhouseVersion="22.3" -jar target/benchmarks.jar -rf text \
64+
-p client=clickhouse-http-jdbc -p client=clickhouse-grpc-jdbc -p type=object Basic
6565
echo "BENCHMARK_REPORT<<EOF" >> $GITHUB_ENV
6666
cat jmh-result.text >> $GITHUB_ENV
6767
echo "EOF" >> $GITHUB_ENV

.github/workflows/legacy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
version:
77
description: "Legacy driver version"
88
required: true
9-
default: "0.3.2-SNAPSHOT"
9+
default: "0.3.3-SNAPSHOT"
1010

1111
jobs:
1212
release:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
version:
77
description: "Release version"
88
required: true
9-
default: "0.3.2-SNAPSHOT"
9+
default: "0.3.3-SNAPSHOT"
1010

1111
jobs:
1212
release:

.github/workflows/timezone.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ jobs:
6464
mvn --batch-mode --update-snapshots \
6565
--projects clickhouse-jdbc \
6666
-DclickhouseTimezone=${{ matrix.serverTz }} \
67-
-DclickhouseVersion=21.8 \
67+
-DclickhouseVersion=22.3 \
6868
-Duser.timezone=${{ matrix.clientTz }} \
6969
--also-make clean verify

README.md

Lines changed: 38 additions & 32 deletions
Large diffs are not rendered by default.

clickhouse-benchmark/src/main/java/com/clickhouse/benchmark/BaseState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public BaseState() {
3232
}
3333

3434
protected int getRandomNumber(int bound) {
35-
return random.nextInt(bound);
35+
return bound < 1 ? 0 : random.nextInt(bound);
3636
}
3737

3838
protected void consume(Blackhole blackhole, Callable<?> task) throws InterruptedException {

clickhouse-benchmark/src/main/java/com/clickhouse/benchmark/ServerState.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ public void doSetup() throws Exception {
7373
imageTag = ":" + imageTag;
7474
}
7575

76-
final String imageNameWithTag = "yandex/clickhouse-server" + imageTag;
76+
final String imageNameWithTag = "clickhouse/clickhouse-server" + imageTag;
7777

7878
container = new GenericContainer<>(new ImageFromDockerfile().withDockerfileFromBuilder(builder -> builder
7979
.from(imageNameWithTag)
80-
.run("echo '<yandex><listen_host>0.0.0.0</listen_host><http_port>8123</http_port>"
80+
.run("echo '<clickhouse><listen_host>0.0.0.0</listen_host><http_port>8123</http_port>"
8181
+ "<tcp_port>9000</tcp_port><mysql_port>9004</mysql_port>"
8282
+ "<postgresql_port>9005</postgresql_port>"
8383
+ "<interserver_http_port>9009</interserver_http_port>"
84-
+ "<grpc_port>9100</grpc_port></yandex>' > /etc/clickhouse-server/config.d/custom.xml")))
84+
+ "<grpc_port>9100</grpc_port></clickhouse>' > /etc/clickhouse-server/config.d/custom.xml")))
8585
.withExposedPorts(Constants.GRPC_PORT, Constants.HTTP_PORT, Constants.MYSQL_PORT,
8686

8787
Constants.NATIVE_PORT)

clickhouse-benchmark/src/main/java/com/clickhouse/benchmark/client/ClientState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private ClickHouseClient createClient() {
5757

5858
ClickHouseClientBuilder builder = ClickHouseClient.builder();
5959
if (bufferSize != null && !bufferSize.isEmpty()) {
60-
builder.option(ClickHouseClientOption.MAX_BUFFER_SIZE, Integer.parseInt(bufferSize));
60+
builder.option(ClickHouseClientOption.BUFFER_SIZE, Integer.parseInt(bufferSize));
6161
}
6262
if (compression != null && !compression.isEmpty()) {
6363
// builder.option(ClickHouseClientOption.COMPRESSION,

clickhouse-benchmark/src/main/java/com/clickhouse/benchmark/jdbc/DriverState.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.sql.SQLException;
66
import java.sql.Statement;
77
import java.util.Properties;
8-
import java.util.UUID;
98

109
import org.openjdk.jmh.annotations.Level;
1110
import org.openjdk.jmh.annotations.Param;
@@ -20,7 +19,7 @@
2019

2120
@State(Scope.Thread)
2221
public class DriverState extends BaseState {
23-
@Param(value = { "clickhouse4j", "clickhouse-http-jdbc", "clickhouse-grpc-jdbc", "clickhouse-jdbc",
22+
@Param(value = { "clickhouse-jdbc", "clickhouse-grpc-jdbc", "clickhouse-legacy-jdbc", "clickhouse4j",
2423
"clickhouse-native-jdbc", "mariadb-java-client", "mysql-connector-java", "postgresql-jdbc" })
2524
private String client;
2625

@@ -54,7 +53,11 @@ public void doSetup(ServerState serverState) throws Exception {
5453
serverState.getPassword(), compression, additional);
5554
// ClickHouseDefines.WRITE_COMPRESS = false;
5655
// ClickHouseDefines.READ_DECOMPRESS = Boolean.parseBoolean(compression);
57-
conn = driver.connect(url, new Properties());
56+
Properties props = new Properties();
57+
if (jdbcDriver.getClassName().startsWith("com.clickhouse.jdbc.")) {
58+
props.setProperty("format", System.getProperty("format", "RowBinaryWithNamesAndTypes"));
59+
}
60+
conn = driver.connect(url, props);
5861

5962
try (Statement s = conn.createStatement()) {
6063
// s.execute("drop table if exists system.test_insert");

clickhouse-benchmark/src/main/java/com/clickhouse/benchmark/jdbc/JdbcDriver.java

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,53 @@
33
import com.clickhouse.benchmark.Constants;
44

55
public enum JdbcDriver {
6-
// ClickHouse4j
7-
Clickhouse4j("cc.blynk.clickhouse.ClickHouseDriver",
8-
"jdbc:clickhouse://%s:%s/%s?ssl=false&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&compress=%s%s",
9-
Constants.HTTP_PORT),
106
// ClickHouse JDBC Driver
11-
ClickhouseHttpJdbc1("com.clickhouse.jdbc.ClickHouseDriver",
7+
ClickhouseJdbc("com.clickhouse.jdbc.ClickHouseDriver",
128
"jdbc:ch://%s:%s/%s?http_connection_provider=HTTP_URL_CONNECTION&ssl=false&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&compress=%s%s",
139
Constants.HTTP_PORT),
14-
ClickhouseHttpJdbc2("com.clickhouse.jdbc.ClickHouseDriver",
10+
// default http implementation
11+
ClickhouseHttpJdbc("com.clickhouse.jdbc.ClickHouseDriver",
12+
"jdbc:ch://%s:%s/%s?http_connection_provider=HTTP_URL_CONNECTION&ssl=false&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&compress=%s%s",
13+
Constants.HTTP_PORT),
14+
ClickhouseHttpUrlConnectionJdbc("com.clickhouse.jdbc.ClickHouseDriver",
15+
"jdbc:ch://%s:%s/%s?http_connection_provider=HTTP_URL_CONNECTION&ssl=false&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&compress=%s%s",
16+
Constants.HTTP_PORT),
17+
ClickhouseHttpClientJdbc("com.clickhouse.jdbc.ClickHouseDriver",
1518
"jdbc:ch://%s:%s/%s?http_connection_provider=HTTP_CLIENT&ssl=false&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&compress=%s%s",
1619
Constants.HTTP_PORT),
20+
// default gRPC implementation
1721
ClickhouseGrpcJdbc("com.clickhouse.jdbc.ClickHouseDriver",
1822
"jdbc:ch:grpc://%s:%s/%s?ssl=false&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&max_inbound_message_size=2147483647&compress=%s%s",
1923
Constants.GRPC_PORT),
20-
ClickhouseJdbc("ru.yandex.clickhouse.ClickHouseDriver",
24+
ClickhouseGrpcNettyJdbc("com.clickhouse.jdbc.ClickHouseDriver",
25+
"jdbc:ch:grpc://%s:%s/%s?ssl=false&use_okhttp=false&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&max_inbound_message_size=2147483647&compress=%s%s",
26+
Constants.GRPC_PORT),
27+
ClickhouseGrpcOkHttpJdbc("com.clickhouse.jdbc.ClickHouseDriver",
28+
"jdbc:ch:grpc://%s:%s/%s?ssl=false&use_okhttp=true&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&max_inbound_message_size=2147483647&compress=%s%s",
29+
Constants.GRPC_PORT),
30+
// version prior to 0.3.2
31+
ClickhouseLegacyJdbc("ru.yandex.clickhouse.ClickHouseDriver",
32+
"jdbc:clickhouse://%s:%s/%s?ssl=false&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&compress=%s%s",
33+
Constants.HTTP_PORT),
34+
35+
// ClickHouse4j
36+
Clickhouse4j("cc.blynk.clickhouse.ClickHouseDriver",
2137
"jdbc:clickhouse://%s:%s/%s?ssl=false&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&compress=%s%s",
2238
Constants.HTTP_PORT),
2339
// ClickHouse Native JDBC Driver
2440
ClickhouseNativeJdbc("com.github.housepower.jdbc.ClickHouseDriver",
2541
"jdbc:clickhouse://%s:%s/%s?ssl=false&user=%s&password=%s&use_server_time_zone=false&use_time_zone=UTC&compress=%s%s",
2642
Constants.NATIVE_PORT),
27-
2843
// MariaDB Java Client
2944
MariadbJavaClient("org.mariadb.jdbc.Driver",
3045
"jdbc:mariadb://%s:%s/%s?user=%s&password=%s&useSSL=false&useServerPrepStmts=false&useCompression=%s"
3146
+ "&rewriteBatchedStatements=true&cachePrepStmts=true&serverTimezone=UTC%s",
3247
Constants.MYSQL_PORT),
33-
3448
// MySQL Connector/J
3549
MysqlConnectorJava("com.mysql.cj.jdbc.Driver",
3650
"jdbc:mysql://%s:%s/%s?user=%s&password=%s&useSSL=false&useServerPrepStmts=false"
3751
+ "&rewriteBatchedStatements=true&cachePrepStmts=true&connectionTimeZone=UTC&useCompression=%S%s",
3852
Constants.MYSQL_PORT),
39-
4053
// PostgreSQL JDBC Driver
4154
PostgresqlJdbc("org.postgresql.Driver",
4255
"jdbc:postgresql://%s:%s/%s?user=%s&password=%s&ssl=false&sslmode=disable&preferQueryMode=simple&compress=%s%s",

0 commit comments

Comments
 (0)