Skip to content

Commit 0888d5c

Browse files
authored
Merge branch 'main' into fix-connection-leak
2 parents 9208ba9 + 753c989 commit 0888d5c

File tree

25 files changed

+453
-289
lines changed

25 files changed

+453
-289
lines changed

.github/workflows/build.yml

Lines changed: 80 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
compile:
3939
runs-on: ubuntu-latest
4040
timeout-minutes: 15
41-
name: Compile using JDK 8
41+
name: Compile (JDK 8)
4242
steps:
4343
- name: Check out repository
4444
uses: actions/checkout@v4
@@ -56,23 +56,15 @@ jobs:
5656
21
5757
cache: "maven"
5858
- name: Build and install libraries
59-
run: mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -DclickhouseVersion=$PREFERRED_LTS_VERSION -Dj8 install
59+
run: mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -Dj8 -DskipITs install
6060
- name: Compile examples
6161
run: |
6262
export LIB_VER=$(grep '<revision>' pom.xml | sed -e 's|[[:space:]]*<[/]*revision>[[:space:]]*||g')
6363
find `pwd`/examples -type f -name pom.xml -exec sed -i -e "s|\(<clickhouse-java.version>\).*\(<\)|\1$LIB_VER\2|g" {} \;
6464
for d in $(ls -d `pwd`/examples/*/); do \
6565
if [ -e $d/pom.xml ]; then cd $d && mvn --batch-mode --no-transfer-progress clean compile; fi;
6666
if [ -e $d/gradlew ]; then cd $d && ./gradlew clean build; fi;
67-
done
68-
- name: Upload test results
69-
uses: actions/upload-artifact@v4
70-
if: failure()
71-
with:
72-
name: result ${{ github.job }}
73-
path: |
74-
**/target/failsafe-reports
75-
**/target/surefire-reports
67+
done
7668
7769
test-multi-env:
7870
needs: compile
@@ -154,9 +146,10 @@ jobs:
154146
# most recent LTS releases as well as latest stable builds
155147
# https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease
156148
clickhouse: ["23.8", "24.3", "24.8", "latest"]
149+
project: ["clickhouse-http-client", "client-v2"]
157150
fail-fast: false
158151
timeout-minutes: 15
159-
name: Java client + CH ${{ matrix.clickhouse }}
152+
name: Java client ( ${{ matrix.project }} ) + CH ${{ matrix.clickhouse }}
160153
steps:
161154
- name: Check out repository
162155
uses: actions/checkout@v4
@@ -191,31 +184,32 @@ jobs:
191184
</toolchain>
192185
</toolchains>
193186
EOF
187+
- name: Build and install libraries
188+
run: mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -Dj8 -DskipITs install
194189
- name: Test Java client
195-
env:
196-
CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}
197-
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
198190
run: |
199-
mvn --also-make --batch-mode --no-transfer-progress --projects clickhouse-http-client -DclickhouseVersion=${{ matrix.clickhouse }} verify
191+
mvn --also-make --batch-mode --no-transfer-progress --projects ${{ matrix.project }} -DclickhouseVersion=${{ matrix.clickhouse }} verify
200192
- name: Upload test results
201193
uses: actions/upload-artifact@v4
202194
if: failure()
203195
with:
204-
name: result ${{ github.job }}
196+
name: result ${{ github.job }}_${{ matrix.clickhouse }}
205197
path: |
206198
**/target/failsafe-reports
207199
**/target/surefire-reports
208-
test-http-client:
200+
201+
test-with-cloud:
209202
runs-on: ubuntu-latest
210203
needs: compile
211204
strategy:
212205
matrix:
213206
# most recent LTS releases as well as latest stable builds
214207
# https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease
215208
clickhouse: ["cloud"]
209+
project: ["clickhouse-http-client", "clickhouse-jdbc", "client-v2", "jdbc-v2"]
216210
fail-fast: false
217211
timeout-minutes: 15
218-
name: Java client (http) + CH ${{ matrix.clickhouse }}
212+
name: ${{ matrix.project }} + CH ${{ matrix.clickhouse }}
219213
steps:
220214
- name: Check out repository
221215
uses: actions/checkout@v4
@@ -252,18 +246,24 @@ jobs:
252246
</toolchains>
253247
EOF
254248
- name: Install Java client
255-
run: mvn --also-make --batch-mode --no-transfer-progress --projects clickhouse-http-client -DskipTests install
249+
run: mvn --also-make --batch-mode --no-transfer-progress -DskipTests install
250+
- name: Generate JWT
251+
env:
252+
JWT_K_PEM: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_JWT_PRIVATE_KEY }}
253+
run: |
254+
npm install jsonwebtoken &&
255+
echo "CLIENT_JWT=$(node jwt-gen.js)" >> "$GITHUB_ENV"
256256
- name: Test http client
257257
env:
258258
CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}
259259
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
260260
run: |
261-
mvn --batch-mode --no-transfer-progress --projects clickhouse-http-client -DclickhouseVersion=${{ matrix.clickhouse }} -Dprotocol=http verify
261+
mvn --batch-mode --no-transfer-progress --projects ${{ matrix.project }} -DclickhouseVersion=${{ matrix.clickhouse }} -Dprotocol=http verify
262262
- name: Upload test results
263263
uses: actions/upload-artifact@v4
264264
if: failure()
265265
with:
266-
name: result ${{ github.job }}
266+
name: result ${{ github.job }}_${{ matrix.project }}_${{ matrix.clickhouse }}
267267
path: |
268268
**/target/failsafe-reports
269269
**/target/surefire-reports
@@ -273,9 +273,10 @@ jobs:
273273
needs: compile
274274
strategy:
275275
matrix:
276-
clickhouse: ["23.8", "24.3", "24.6", "latest", "cloud"]
276+
clickhouse: ["23.8", "24.3", "24.6", "latest"]
277277
# here http, http_client and apache_http_client represent different value of http_connection_provider
278-
protocol: ["http", "http_client", "apache_http_client"]
278+
# protocol: ["http", "http_client", "apache_http_client"]
279+
protocol: ["apache_http_client"]
279280
fail-fast: false
280281
timeout-minutes: 15
281282
name: JDBC driver + CH ${{ matrix.clickhouse }} (${{ matrix.protocol }})
@@ -314,13 +315,13 @@ jobs:
314315
</toolchains>
315316
EOF
316317
- name: Install Java client
317-
run: mvn --also-make --batch-mode --no-transfer-progress --projects clickhouse-http-client -DskipTests install
318+
run: mvn --also-make --batch-mode --no-transfer-progress --projects clickhouse-http-client,client-v2 -DskipTests install
318319
- name: Test JDBC driver
319320
env:
320321
CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}
321322
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
322323
run: |
323-
mvn --batch-mode --no-transfer-progress --projects clickhouse-jdbc -DclickhouseVersion=${{ matrix.clickhouse }} -Dprotocol=${{ matrix.protocol }} verify
324+
mvn --batch-mode --no-transfer-progress --projects clickhouse-jdbc,jdbc-v2 -DclickhouseVersion=${{ matrix.clickhouse }} -Dprotocol=${{ matrix.protocol }} verify
324325
- name: Upload test results
325326
uses: actions/upload-artifact@v4
326327
if: failure()
@@ -391,113 +392,56 @@ jobs:
391392
**/target/failsafe-reports
392393
**/target/surefire-reports
393394
394-
test-timezone-support:
395-
runs-on: ubuntu-latest
396-
needs: compile
397-
strategy:
398-
matrix:
399-
serverTz:
400-
[
401-
"Asia/Chongqing",
402-
"America/Los_Angeles",
403-
"Etc/UTC",
404-
"Europe/Berlin",
405-
"Europe/Moscow",
406-
]
407-
clientTz:
408-
[
409-
"Asia/Chongqing",
410-
"America/Los_Angeles",
411-
"Etc/UTC",
412-
"Europe/Berlin",
413-
"Europe/Moscow",
414-
]
415-
fail-fast: false
416-
timeout-minutes: 20
417-
name: "TimeZone(C/S): ${{ matrix.clientTz }} vs. ${{ matrix.serverTz }}"
418-
steps:
419-
- name: Check out repository
420-
uses: actions/checkout@v4
421-
- name: Check out PR
422-
run: |
423-
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
424-
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
425-
if: github.event.inputs.pr != ''
426-
- name: Install JDK 8 and Maven
427-
uses: actions/setup-java@v4
428-
with:
429-
distribution: "temurin"
430-
java-version: 8
431-
cache: "maven"
432-
- name: Install Java client
433-
run: mvn --also-make --batch-mode --no-transfer-progress --projects clickhouse-http-client -Dj8 -DskipTests install
434-
- name: Test JDBC and R2DBC drivers
435-
run: |
436-
mvn --batch-mode --no-transfer-progress --projects clickhouse-jdbc,clickhouse-r2dbc -DclickhouseVersion=$PREFERRED_LTS_VERSION \
437-
-DclickhouseTimezone=${{ matrix.serverTz }} -Duser.timezone=${{ matrix.clientTz }} \
438-
-Dj8 -DskipUTs verify
439-
- name: Upload test results
440-
uses: actions/upload-artifact@v4
441-
if: failure()
442-
with:
443-
name: result ${{ github.job }}
444-
path: |
445-
**/target/failsafe-reports
446-
**/target/surefire-reports
447-
448-
test-client-v2:
449-
runs-on: ubuntu-latest
450-
needs: compile
451-
strategy:
452-
matrix:
453-
# most recent LTS releases as well as latest stable builds
454-
# https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease
455-
clickhouse: ["24.3", "24.8", "latest"]
456-
fail-fast: false
457-
timeout-minutes: 15
458-
name: Client V2 + CH ${{ matrix.clickhouse }}
459-
steps:
460-
- name: Check out repository
461-
uses: actions/checkout@v4
462-
- name: Check out PR
463-
run: |
464-
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
465-
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
466-
if: github.event.inputs.pr != ''
467-
- name: Install JDK 17 and Maven
468-
uses: actions/setup-java@v4
469-
with:
470-
distribution: "temurin"
471-
java-version: |
472-
8
473-
17
474-
cache: "maven"
475-
- name: Setup Toolchain
476-
shell: bash
477-
run: |
478-
mkdir -p $HOME/.m2 \
479-
&& cat << EOF > $HOME/.m2/toolchains.xml
480-
<?xml version="1.0" encoding="UTF8"?>
481-
<toolchains>
482-
<toolchain>
483-
<type>jdk</type>
484-
<provides>
485-
<version>17</version>
486-
</provides>
487-
<configuration>
488-
<jdkHome>${{ env.JAVA_HOME }}</jdkHome>
489-
</configuration>
490-
</toolchain>
491-
</toolchains>
492-
EOF
493-
- name: Test Java client
494-
run: |
495-
mvn --also-make --batch-mode --no-transfer-progress --projects client-v2 -Dclient.tests.useNewImplementation=true -DclickhouseVersion=${{ matrix.clickhouse }} verify
496-
- name: Upload test results
497-
uses: actions/upload-artifact@v4
498-
if: failure()
499-
with:
500-
name: result ${{ github.job }}
501-
path: |
502-
**/target/failsafe-reports
503-
**/target/surefire-reports
395+
# test-timezone-support:
396+
# runs-on: ubuntu-latest
397+
# needs: compile
398+
# strategy:
399+
# matrix:
400+
# serverTz:
401+
# [
402+
# "Asia/Chongqing",
403+
# "America/Los_Angeles",
404+
# "Etc/UTC",
405+
# "Europe/Berlin",
406+
# "Europe/Moscow",
407+
# ]
408+
# clientTz:
409+
# [
410+
# "Asia/Chongqing",
411+
# "America/Los_Angeles",
412+
# "Etc/UTC",
413+
# "Europe/Berlin",
414+
# "Europe/Moscow",
415+
# ]
416+
# fail-fast: false
417+
# timeout-minutes: 20
418+
# name: "TimeZone(C/S): ${{ matrix.clientTz }} vs. ${{ matrix.serverTz }}"
419+
# steps:
420+
# - name: Check out repository
421+
# uses: actions/checkout@v4
422+
# - name: Check out PR
423+
# run: |
424+
# git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
425+
# origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
426+
# if: github.event.inputs.pr != ''
427+
# - name: Install JDK 8 and Maven
428+
# uses: actions/setup-java@v4
429+
# with:
430+
# distribution: "temurin"
431+
# java-version: 8
432+
# cache: "maven"
433+
# - name: Install Java client
434+
# run: mvn --also-make --batch-mode --no-transfer-progress --projects clickhouse-http-client -Dj8 -DskipTests install
435+
# - name: Test JDBC and R2DBC drivers
436+
# run: |
437+
# mvn --batch-mode --no-transfer-progress --projects clickhouse-jdbc,clickhouse-r2dbc -DclickhouseVersion=$PREFERRED_LTS_VERSION \
438+
# -DclickhouseTimezone=${{ matrix.serverTz }} -Duser.timezone=${{ matrix.clientTz }} \
439+
# -Dj8 -DskipUTs verify
440+
# - name: Upload test results
441+
# uses: actions/upload-artifact@v4
442+
# if: failure()
443+
# with:
444+
# name: result ${{ github.job }}
445+
# path: |
446+
# **/target/failsafe-reports
447+
# **/target/surefire-reports

clickhouse-client/src/test/java/com/clickhouse/client/ClientIntegrationTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,11 @@ public void testCompressedRequest(ClickHouseCompression compression, int startLe
580580
.content(new ByteArrayInputStream("32\t1\n43\t2\n54\t3\n65\t4".getBytes()))
581581
.build())
582582
.query("select x.* from x inner join y on x.i = y.i where i in (select i from " + tableName
583-
+ ")")
583+
+ ") ORDER BY 1")
584584
.set("select_sequential_consistency", isCloud() ? 1 : null)
585585
.executeAndWait()) {
586586
int j = 0;
587+
587588
for (ClickHouseRecord r : response.records()) {
588589
Assert.assertEquals(r.getValue(0).asInteger(), j == 0 ? 1 : 4);
589590
Assert.assertEquals(r.getValue(1).asInteger(), j == 0 ? 23 : 56);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public static void parseSummary(String text, OperationMetrics metrics) {
1818
parser.nextToken(); // skip START_OBJECT
1919
JsonToken t = parser.nextToken();
2020

21+
for (ServerMetrics m : ServerMetrics.values()) {
22+
metrics.updateMetric(m, -1);
23+
}
2124
while (t != null) {
2225
if (t == JsonToken.FIELD_NAME) {
2326
String fieldName = parser.currentName();

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ public final class ServerSettings {
3232
* Possible values are 'throw' or 'break'. Default is 'throw'
3333
*/
3434
public static final String RESULT_OVERFLOW_MODE = "result_overflow_mode";
35+
36+
public static final String ASYNC_INSERT = "async_insert";
37+
38+
public static final String WAIT_ASYNC_INSERT = "wait_for_async_insert";
3539
}

0 commit comments

Comments
 (0)