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

addBatch write timed out

Open imyoubo opened this issue 4 years ago • 6 comments

image image

I batch write clickhouse through jdbc client. But I ran into a problem while writing it. When addBatch is executed about 2000 times, it is blocked, stuck there and cannot continue, and after exceeding the set socket_timeout, an exception of Write timed out is reported. It's weird that the same code ru.yandex.clickhouse.ClickHouseDriver doesn't have this problem

The version is 0.3.2-patch10 Please help with this issue, thanks!

我通过jdbc client 批量写clickhouse。 但是在写的时候遇到了一个问题。 当addBatch 执行了大约2000次左右时,就阻塞住了,卡在那里无法继续,然后超过设置的socket_timeout后,报Write timed out 异常了。 很奇怪,同样的代码 ru.yandex.clickhouse.ClickHouseDriver 没有出现这个问题

版本是 0.3.2-patch10 请帮忙看一下这个问题,谢谢!

imyoubo avatar Jul 11 '22 13:07 imyoubo

My program is executeBatch every 25w records But every time after executing addBatch about 2000 times, it blocks, let alone executeBatch

我的程序是每25w条记录执行一次executeBatch 但是每次都是执行了2000次左右addBatch后,它就阻塞了,更没有执行过 executeBatch

imyoubo avatar Jul 11 '22 13:07 imyoubo

Hi @imyoubo, could you change max_queued_buffers to zero(unlimited) and try again? For example: jdbc:ch://localhost?max_queued_buffers=0.

zhicwu avatar Jul 11 '22 13:07 zhicwu

I'll remove the size limit in JDBC driver, so that nobody has to set the parameter explicitly.

zhicwu avatar Jul 11 '22 13:07 zhicwu

Hi @imyoubo, could you change max_queued_buffers to zero(unlimited) and try again? For example: jdbc:ch://localhost?max_queued_buffers=0.

oh I tried it just now, and it really solved it. It seems to be the configuration problem of max_queued_buffers, thank you very much

imyoubo avatar Jul 11 '22 13:07 imyoubo

Hi @zhicwu There seems to be a new problem, When executing executeBatch, an error is reported, "Please call addBatch method at least once before batch execution" image

imyoubo avatar Jul 12 '22 02:07 imyoubo

Is https://github.com/ClickHouse/clickhouse-jdbc/issues/977

imyoubo avatar Jul 12 '22 02:07 imyoubo