ClickHouse / clickhouse-jdbc-bridge

A JDBC proxy from ClickHouse to external databases
Apache License 2.0
167 stars 60 forks source link

Exception thrown after insertion #83

Closed sliontc closed 3 years ago

sliontc commented 3 years ago

QQ20210108-213336 How to get this fixed?

zhicwu commented 3 years ago

Can you increase max execution time in config/vertx.json?

sliontc commented 3 years ago

Can you increase max execution time in config/vertx.json?

I didn't use that configuration. My usecase is inserting data into jdbc table engine.

zhicwu commented 3 years ago

Are you using docker? Regardless, you can take this as an example, put config/vertx.json under your work directory(e.g. /app/config/vertx.json in docker container).

sliontc commented 3 years ago

Are you using docker? Regardless, you can take this as an example, put config/vertx.json under your work directory(e.g. /app/config/vertx.json in docker container).

No, I use Java CLI after building your git repo. Here is my datasource config. image Seems vertx.json is not used.

sliontc commented 3 years ago

image The insert is almost done.

zhicwu commented 3 years ago

Seems vertx.json is not used.

You can create the file if it does not exist.

sliontc commented 3 years ago

Seems vertx.json is not used.

You can create the file if it does not exist.

I created the file vertx.json:

{ "maxEventLoopExecuteTime": 15, "maxEventLoopExecuteTimeUnit": "SECONDS", "maxWorkerExecuteTime": 3000, "maxWorkerExecuteTimeUnit": "SECONDS", "workerPoolSize": 20 }

But it failed with different error: image image

sliontc commented 3 years ago

If I insert select top 100 records, it run successfully.

zhicwu commented 3 years ago

What's the log level in your log4j.properties? You may hit the error when trace level is enabled. Can you edit the file in your clickhouse-jdbc-bridge jar file by changing log level to WARN or ERROR?

Alternatively, you can use this new build, which turned off debug log causing the problem.

sliontc commented 3 years ago

What's the log level in your log4j.properties? You may hit the error when trace level is enabled. Can you edit the file in your clickhouse-jdbc-bridge jar file by changing log level to WARN or ERROR?

Alternatively, you can use this new build, which turned off debug log causing the problem.

Your log4j.properties is same with mine like below:

log4j.rootLogger=DEBUG, STDOUT log4j.category.ru.yandex.clickhouse=WARN log4j.category.ru.yandex.clickhouse.jdbcbridge=DEBUG log4j.category.ru.yandex.clickhouse.jdbcbridge.internal=WARN log4j.appender.STDOUT=ru.yandex.clickhouse.jdbcbridge.internal.log4j.ConsoleAppender log4j.appender.STDOUT.layout=ru.yandex.clickhouse.jdbcbridge.internal.log4j.PatternLayout log4j.appender.STDOUT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.sss} [%t] [%-5p] {%c{1}:%L} - %m%n

zhicwu commented 3 years ago

I see. Did you try the alternative approach? Changing log level to warn/error works too.

sliontc commented 3 years ago

I see. Did you try the alternative approach? Changing log level to warn/error works too. I use your build and following error: image

sliontc commented 3 years ago

And this is error from CK log: image

zhicwu commented 3 years ago

Thank you @sliontc for reporting the issues. From your screenshots, it seems the 2M rows were all inserted into SQL server, but in the end JDBC bridge failed to telling ClickHouse the mutation has been completed. Let me try to fix the issue(and the incorrect effectedRows in log) later today. Meanwhile, you may want to verify if all 2,515,081 rows were inserted into SQL server successfully.

select * from jdbc('<your datasource>', 'select count(1) from t_UnionResource')

Moreover, I noticed that the insertion took 470 seconds, so maybe batch_size(defaults to 100) can be increased for further improvement.

sliontc commented 3 years ago

Thank you @sliontc for reporting the issues. From your screenshots, it seems the 2M rows were all inserted into SQL server, but in the end JDBC bridge failed to telling ClickHouse the mutation has been completed. Let me try to fix the issue(and the incorrect effectedRows in log) later today. Meanwhile, you may want to verify if all 2,515,081 rows were inserted into SQL server successfully.

select * from jdbc('<your datasource>', 'select count(1) from t_UnionResource')

Moreover, I noticed that the insertion took 470 seconds, so maybe batch_size(defaults to 100) can be increased for further improvement.

yes, the data were all inserted.

sliontc commented 3 years ago

So the bug is fixed?

zhicwu commented 3 years ago

Yes, it's been fixed. However, I'm currently having trouble releasing 2.0.0 because of slowness issue on sonatype. I'll try again tomorrow morning and then merge released code into master branch.

Meantime, if you don't want to wait, please follow instructions below:

sliontc commented 3 years ago

Whoo, that's great. You are so awesome.