You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, things like temporary tables rely on the same connection to operate. To ensure that today, we need to ensure we start the clickhouse client with max_open_connections: 1 as per the docs, but that means down our application stack we need to keep 2 versions of clickhouse client:
one for the default connection pool
one that is a constructor to starting a new clickhouse client with max_open_connections = 1 and a fixed sticky session.
Basically, allow the clickhouseClient to hold a "sticky session" which can occupy the same connection pool (i.e. respect the same max_open_connections).
The API could look something like:
constchClient=createClickhouseClient(...)// All handled in the closure.awaitchClient.execStickySession(async(// maybe a different type that inherits the same ClickhouseClient types but indicates it is sticky? chClient: ClickhouseClient,){// automatically uses the same session id for the next 2 commandsawaitchClient.command(...);awaitchClient.command(...)})// Or explicitly.conststickySession=awaitchClient.startStickySession();try{
...
}finally{
stickySession.close();}
Describe the alternatives you've considered
We're basically passing 2 different clickhouse clients down the stack now.
The text was updated successfully, but these errors were encountered:
Use case
Today, things like temporary tables rely on the same connection to operate. To ensure that today, we need to ensure we start the clickhouse client with
max_open_connections: 1
as per the docs, but that means down our application stack we need to keep 2 versions of clickhouse client:max_open_connections = 1
and a fixed sticky session.Describe the solution you'd like
This takes inspiration from the
database/sql
Golang package and how they handle transactions.Basically, allow the
clickhouseClient
to hold a "sticky session" which can occupy the same connection pool (i.e. respect the samemax_open_connections
).The API could look something like:
Describe the alternatives you've considered
We're basically passing 2 different clickhouse clients down the stack now.
The text was updated successfully, but these errors were encountered: