[client-v2] Migration guide marks SESSION_ID, SESSION_CHECK and SESSION_TIMEOUT as ✗, but Client.Builder supports them
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 86/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
docs/clickhouse-docs/client.mdx の移行テーブルの4つのセルと AUTO_SESSION コメントを、issue に記載された Client.Builder メソッドを使って編集します。まず V2 設定テーブルとリンク先の Sessions API ドキュメントを読みます。サポートされている setter を示すように行を更新し、コメントを修正します。移行ガイドが client-v2 はセッションをサポートしていないと示唆しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
The V1 → V2 configuration table of the migration guide (docs/clickhouse-docs/client.mdx, tab "Timeouts & Retry", published as Configuration Parameters Match) marks three V1 options as ✗ (no V2 builder method). client-v2 has a method for each of them, released in 0.10.0:
| V1 option | Table | client-v2 on main |
|---|---|---|
ClickHouseClientOption#SESSION_ID |
✗ | Client.Builder#setSessionId, Client#updateSessionId |
ClickHouseClientOption#SESSION_CHECK |
✗ | Client.Builder#setSessionCheck |
ClickHouseClientOption#SESSION_TIMEOUT |
✗ | Client.Builder#setSessionTimeout |
The operation settings (QuerySettings, InsertSettings, CommandSettings) have the same three setters, and all have use(Session).
In the tab "Miscellaneous", ClickHouseDefaults#AUTO_SESSION has the comment "Session support will be reviewed". The ✗ of that row is correct (client-v2 does not make a session by itself), but the comment also says that client-v2 has no sessions. The REPEAT_ON_SESSION_LOCK ✗ is correct.
A V1 user who migrates reads that client-v2 has no sessions. The V2 part of client.mdx has no section about sessions, so the page shows no other information. The feature table in docs/clickhouse-docs/index.mdx says "Sessions ✔" for Client V2, and docs/features.md ("Session handling") describes the API.
Steps to reproduce
- Run the program below against a local server.
- Each case uses one of the three builder methods. The server result shows that the server applies the parameter.
Error Log or Exception StackTrace
1. setSessionId: CREATE TEMPORARY TABLE t: OK
1. setSessionId: SELECT FROM t: OK
2. setSessionCheck(true), unknown session: Code: 372. DB::Exception: Session 4114d1b9-86de-40df-8d79-d05e408086d0 not found. (SESSION_NOT_FOUND) (queryId= )
3. setSessionTimeout(1): first query: OK
3. setSessionTimeout(60): first query: OK
3. timeout 1 s: session_check after 5 s: Code: 372. DB::Exception: Session 48b06230-8dfe-4bbe-b7ee-bbac6af8b584 not found. (SESSION_NOT_FOUND) (queryId= )
3. timeout 60 s: session_check after 5 s: OK
Expected Behaviour
The three rows name the V2 builder methods, and the AUTO_SESSION comment does not say that sessions are not supported. The output above shows that the server applies each parameter that client-v2 sends: the temporary table stays in the session (session_id), an unknown session fails with SESSION_NOT_FOUND (session_check), and the session with session_timeout=1 is gone after 5 s while the one with 60 is not.
The stale cells are at docs/clickhouse-docs/client.mdx:1384-1386 (the three rows) and docs/clickhouse-docs/client.mdx:1482 (the AUTO_SESSION comment). The builder methods are at client-v2/src/main/java/com/clickhouse/client/api/Client.java:1079-1120.
The fix is a change of four table cells; a short Sessions section in the V2 part of client.mdx is optional. Polyglot AI can open a fix PR if a maintainer assigns this issue to @polyglotAI-bot.
Related: #2892 (open) asks to restructure the same configuration tables.
Code Example
Reproduction program (Java, 39 lines)
import com.clickhouse.client.api.Client;
import com.clickhouse.client.api.query.QueryResponse;
import java.util.UUID;
public class Repro {
static Client.Builder base() {
return new Client.Builder().addEndpoint("http://localhost:8123").setUsername("default").setPassword("");
}
static void run(Client c, String label, String sql) {
try (QueryResponse r = c.query(sql).get()) {
System.out.println(label + ": OK");
} catch (Exception e) {
System.out.println(label + ": " + e.getMessage().split("\n")[0]);
}
}
public static void main(String[] args) throws Exception {
try (Client c = base().setSessionId(UUID.randomUUID().toString()).build()) {
run(c, "1. setSessionId: CREATE TEMPORARY TABLE t", "CREATE TEMPORARY TABLE t (x UInt8)");
run(c, "1. setSessionId: SELECT FROM t", "SELECT * FROM t");
}
try (Client c = base().setSessionId(UUID.randomUUID().toString()).setSessionCheck(true).build()) {
run(c, "2. setSessionCheck(true), unknown session", "SELECT 1");
}
String s1 = UUID.randomUUID().toString(), s60 = UUID.randomUUID().toString();
try (Client a = base().setSessionId(s1).setSessionTimeout(1).build();
Client b = base().setSessionId(s60).setSessionTimeout(60).build()) {
run(a, "3. setSessionTimeout(1): first query", "SELECT 1");
run(b, "3. setSessionTimeout(60): first query", "SELECT 1");
}
Thread.sleep(5000);
try (Client a = base().setSessionId(s1).setSessionCheck(true).build();
Client b = base().setSessionId(s60).setSessionCheck(true).build()) {
run(a, "3. timeout 1 s: session_check after 5 s", "SELECT 1");
run(b, "3. timeout 60 s: session_check after 5 s", "SELECT 1");
}
}
}
Configuration
Client Configuration
// In the program: Client.Builder with setSessionId, setSessionCheck(true), setSessionTimeout(1) and setSessionTimeout(60).
Environment
- Cloud
- Client version: client-v2
main(8480ca001, 0.12.0-rc1-SNAPSHOT) - Language version: Java 17.0.21
- OS: Linux (Docker)
ClickHouse Server
- ClickHouse Server version: 26.11.4.11
- ClickHouse Server non-default settings, if any: none
CREATE TABLEstatements for tables involved: none (the program makes a temporary table)- Sample data for all these tables: none
Classification: impact: none · area: Docs & project (migration guide)
Found by automated analysis (Polyglot AI) while working on ClickHouse/clickhouse-cs#785. Verified against a live server.
- 主要言語
- Java
- スター
- 1.6k
- フォーク
- 657
- 平均マージ
- 2日 6時間
- マージ済み PR(30日)
- 36
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ClickHouse/clickhouse-java のほかの issue
-
[jdbc-v1] PreparedStatement insert silently cuts a FixedString(N) value that is longer than N bytesオープンbug data-types jdbc legacy
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
ClickHouse/clickhouse-java#3468 ·
メンテナーはふだん 1 日以内に返信
-
[jdbc-v2] Statement.execute and prepareStatement throw RuntimeException, not SQLException, for two statements in one call対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンapi-diagnostics bug jdbc
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
ClickHouse/clickhouse-java#3464 ·
メンテナーはふだん 1 日以内に返信
-
tests
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ClickHouse/clickhouse-java#3452 ·
メンテナーはふだん 1 日以内に返信
-
bug jdbc performance queries sql-parser
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
ClickHouse/clickhouse-java#3451 ·
メンテナーはふだん 1 日以内に返信
-
bug jdbc legacy queries
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
ClickHouse/clickhouse-java#3444 ·
メンテナーはふだん 1 日以内に返信
ClickHouse/clickhouse-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Card-Forge/forge#13128 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/flink-agents#1480 ·
メンテナーはふだん 2 日以内に返信
-
Beam P2
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
ai-friendly good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
CategoricalData/CQL#148 ·
メンテナーはふだん 1 日以内に返信