ClickHouse / ClickHouse/clickhouse-java

ClickHouse java client - reusing same instance of ClickHouseClient gives execution timeout after 10 inserts

オープン
#1,668 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:network client-api-v2 enhancement
主要言語
Java
スター
1.6k
フォーク
636
平均マージ
2日 23時間
マージ済み PR(30日)
29

説明

I am new using clickhouse and I have assembled a project in java using java client.

```xml

com.clickhouse
clickhouse-http-client
0.6.0

org.apache.httpcomponents.client5
httpclient5
5.2.1

```

```java
HashMap options = new HashMap<>();
options.put("user", "user");
options.put("password", "pass");

String url = "my-clickhouse-host";
ClickHouseNode server = ClickHouseNode.of(url, options);
ClickHouseRequest read = ClickHouseClient.builder()
.nodeSelector(ClickHouseNodeSelector.of(ClickHouseProtocol.HTTP))
.option(ClickHouseClientOption.SOCKET_KEEPALIVE, true)
.build()
.read(server).write();

for (int i = 0; i < 11; i++) {

String id = UUID.randomUUID().toString();
String field1 = "field1" + (i);
String field2 = "field2" + (i);
String field3 = "field3" + (i);
String field4 = "field4" + (i);

String query = String.format("INSERT INTO mytable VALUES ('%s', '%s', '%s', '%s', '%s')",
id,
field1,
field2,
field3,
field4);

read.format(ClickHouseFormat.CustomSeparated)
.query(query)
.executeAndWait();

}
```

This code only inserts 10 records, after that I get an Code: 159. Execution timed out Exception

I have already tried to change and add some ClickHouseClientOptions but I always get the same behaviour. How can I reuse the same client connections in clickhouse using java client?

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with the Java reproduction in the issue, especially ClickHouseClient.builder(), the ClickHouseRequest setup, and the executeAndWait() loop using clickhouse-http-client 0.6.0. Reproduce the timeout after the tenth insert, then inspect the client and request lifecycle to determine whether the same connection can be reused. Done means repeated inserts complete without the Code 159 execution timeout.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
databases
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。