@clickhouse/client 0.3.0
This release primarily focuses on improving the Keep-Alive mechanism's reliability on the client side.
New features
-
Idle sockets timeout rework; now, the client attaches internal timers to idling sockets and forcefully removes them from the pool if it is considered that a particular socket has been idling for too long. This additional socket housekeeping intends to eliminate "Socket hang-up" errors that could previously still occur on certain configurations. Now, the client does not rely on the KeepAlive agent when it comes to removing the idling sockets; in most cases, the server will not close the socket before the client does.
-
There is a new
keep_alive.idle_socket_ttlconfiguration parameter. The default value is2500(milliseconds), which is considered to be safe, as ClickHouse versions prior to 23.11 hadkeep_alive_timeoutset to 3 seconds by default, andkeep_alive.idle_socket_ttlis supposed to be slightly less than that to allow the client to remove the sockets that are about to expire before the server does so. -
Logging improvements: more internal logs on failing requests; all client methods except ping will log an error on failure now. A failed ping will log a warning since the underlying error is returned as a part of its result. Client logging still needs to be enabled explicitly by specifying the desired
log.levelconfig option, as the log level isOFFby default. Currently, the client logs the following events, depending on the selectedlog.levelvalue:TRACE- low-level information about the Keep-Alive sockets lifecycle.DEBUG- response information (without authorization headers and host info).INFO- still mostly unused, will print the current log level when the client is initialized.WARN- non-fatal errors; failedpingrequest is logged as a warning, as the underlying error is included in the returned result.ERROR- fatal errors fromquery/insert/exec/commandmethods, such as a failed request.
Breaking changes
keep_alive.retry_on_expired_socketandkeep_alive.socket_ttlconfiguration parameters are removed.- The
max_open_connectionsconfiguration parameter is now 10 by default, as we should not rely on the KeepAlive agent's defaults. - Fixed the default
request_timeoutconfiguration value (now it is correctly set to30_000, previously300_000(milliseconds)).
Bug fixes
- Fixed a bug with Ping that could lead to an unhandled "Socket hang-up" propagation.
- The client ensures proper
Connectionheader value considering Keep-Alive settings. If Keep-Alive is disabled, its value is now forced to "close".