docs: HTTP sessions on a multi-replica ClickHouse Cloud service need replica-aware routing
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 30/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp
- Domain
- documentation
Research direction
Read docs/http.mdx, especially the Session management section and Best practices > Sessions, then look at TestUtilities.GetTestCustomHeaders() and ClickHouse.Driver/AGENTS.md for the exact header pattern the repo already uses. The note should say state lives on the serving replica, show a snippet sending X-ClickHouse-Replica-Tag per session, and list the best-effort/scaling caveats, with a cross-link from Best practices. An open PR (#766) already covers this, so check it before duplicating work.
Written by the indexing model from the issue text.
Description
TLDR: On a ClickHouse Cloud service with more than one replica, UseSession alone doesn't keep a session's queries on one replica, so a temporary table or a SET can vanish between two queries. docs/http.mdx doesn't say so, though this repo's own Cloud tests already work around it with X-ClickHouse-Replica-Tag.
What happens
A session's temporary tables and settings live on the replica that ran the query. Cloud load-balances HTTP requests across replicas, and session_id doesn't influence which replica a request reaches.
Measured on a ClickHouse Cloud service (26.6, 3–4 replicas) with driver 1.5.0:
| HTTP replica-aware routing | Client | Result |
|---|---|---|
| off | 12 requests, same session_id, new connections |
answered by all 3 replicas (4 / 3 / 5) |
| on | 12 requests, same session_id, one kept-alive connection |
answered by 4 replicas |
| on | 12 requests with X-ClickHouse-Replica-Tag |
answered by 1 replica |
| on | 10 sessions: UseSession = true, then CREATE TEMPORARY TABLE, INSERT, 3 × SELECT |
10 of 10 failed (Unknown table expression identifier) |
| on | the same 10 sessions with CustomHeaders = { ["X-ClickHouse-Replica-Tag"] = sessionId } |
0 of 10 failed |
Replica-aware routing fixes this. Turn on the service's HTTP toggle, and send the same X-ClickHouse-Replica-Tag on every request of the session. The repo already does this for its Cloud test runs, in TestUtilities.GetTestCustomHeaders(), and notes it in ClickHouse.Driver/AGENTS.md: "without them, a session, a Memory table or a read of a row that the test just inserted can reach another replica and fail". Only the user-facing docs are missing it.
Proposed change
In docs/http.mdx, add a note to Session management and a pointer to it from Best practices > Sessions:
- sessions keep state only on the replica that served the query;
- on a multi-replica Cloud service, turn on HTTP replica-aware routing and send
X-ClickHouse-Replica-Tagwith every query of the session, with a snippet; - the caveats: best-effort, and a tag can move to another replica when the service scales.
Docs only; no code change. A PR follows.
- Dominant language
- C#
- Stars
- 102
- Forks
- 31
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 40
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ClickHouse/clickhouse-cs
-
bug documentation queries
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ClickHouse/clickhouse-cs#815 ·
Maintainers usually reply within 1 day
-
bug data-types native-format
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/clickhouse-cs#813 ·
Maintainers usually reply within 1 day
-
bug data-types documentation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ClickHouse/clickhouse-cs#811 ·
Maintainers usually reply within 1 day
-
bug data-types
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ClickHouse/clickhouse-cs#809 ·
Maintainers usually reply within 1 day
-
bug data-types
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ClickHouse/clickhouse-cs#806 · 1 comment ·
Maintainers usually reply within 1 day
All issues in ClickHouse/clickhouse-cs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
XML grammar: only the closing --> of a comment gets the scope comment.block.xmlPossibly taken @alexeyfala claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
danipen/TextMateSharp#145 · 2 comments ·
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Klyroo/klyroo-dashboard#12 ·
Maintainers usually reply within 1 day
-
CONTRIBUTING rules Node out in step 0, then tells client-side contributors to run node --test, which is what CI gates onPossibly taken @yadavraj2001 claimed this today. Opendocumentation good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
juandresrodca/AdminForge#73 · 1 comment ·
Maintainers usually reply within 1 day
-
[辞書] VIVANTOpen要トリアージ 辞書
Difficulty 1/5 Under an hour Newbie friendliness 70/100
Maintainers usually reply within 1 day