clickhouse-cpp icon indicating copy to clipboard operation
clickhouse-cpp copied to clipboard

How to set timeout config

Open ChunyunShen opened this issue 4 years ago • 3 comments

When I establish a clickhouse client to send requests to clickhouse server, I expect to set a maximum time for each request. When timeout occurs, client should stop waiting for server. However, I find in the class Client this mechanism is not supported. Are there any other ways to achieve this goal?

ChunyunShen avatar Jan 20 '22 07:01 ChunyunShen

Not supported now. Feel free to add/send PR.

See https://stackoverflow.com/a/2939145

filimonov avatar Jan 20 '22 14:01 filimonov

@ChunyunShen you can try using Client::SelectCancelable together with in-query SETTING clause. But right now there are no tests that properly verify that.

Enmk avatar Mar 02 '22 14:03 Enmk

In the working environment, we encountered the situation that the clickhouse machine hangs up several times. At this time, the server can receive the client's request, but will not respond, which will cause the client to be stuck in the recv() link, which will affect the subsequent data. write. Adding the timeout config and cooperating with the logic of switching the write replica when the write fails can avoid the above problems.

King-Authur avatar Jul 22 '22 03:07 King-Authur

fixed in https://github.com/ClickHouse/clickhouse-cpp/pull/205 ?

rr0gi avatar Nov 08 '22 17:11 rr0gi