Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules/clickhouse: JDBC driver name changed, liveness port #5474

Merged
merged 7 commits into from Jun 28, 2022
Merged

modules/clickhouse: JDBC driver name changed, liveness port #5474

merged 7 commits into from Jun 28, 2022

Conversation

anavrotski
Copy link
Contributor

  • driver changed from ru.yandex.clickhouse (deprected) to com.clickhouse
  • as soon as class ClickHouseContainerextends class with generic type (JdbcDatabaseContainer) I think it should extend it in same way as MySQLContainer or PostgreSQLContainer etc.
  • method getLivenessCheckPortNumbers changed to be the same as in containers mentioned above.

@anavrotski anavrotski requested a review from a team as a code owner June 3, 2022 20:09
Copy link
Member

@eddumelendez eddumelendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your contribution @anavrotski ! the PR looks good to me, just wondering if we can make it compatible with both drivers? wdyt @kiview @bsideup ?

Comment on lines 54 to 55
this.withExposedPorts(HTTP_PORT, NATIVE_PORT);
this.waitingFor(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.withExposedPorts(HTTP_PORT, NATIVE_PORT);
this.waitingFor(
withExposedPorts(HTTP_PORT, NATIVE_PORT);
waitingFor(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I removed this. - IntelliJ Idea shows me a warning: 'SELF' used without 'try'-with-resources statement`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About support of both drivers - Clickhouse is now separate company, not part of Yandex. And when old driver is used:

2022-06-06T18:45:27.806+0900	WARN	main	ru.yandex.clickhouse.ClickHouseDriver	******************************************************************************************
2022-06-06T18:45:27.806+0900	WARN	main	ru.yandex.clickhouse.ClickHouseDriver	* This driver is DEPRECATED. Please use [com.clickhouse.jdbc.ClickHouseDriver] instead.  *
2022-06-06T18:45:27.807+0900	WARN	main	ru.yandex.clickhouse.ClickHouseDriver	* Also everything in package [ru.yandex.clickhouse] will be removed starting from 0.4.0. *
2022-06-06T18:45:27.807+0900	WARN	main	ru.yandex.clickhouse.ClickHouseDriver	******************************************************************************************

So I think its usage should be avoided.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it complained about this. because the previous code for some reason did not pass a generic argument to JdbcDatabaseContainer, this should fix it:
https://github.com/testcontainers/testcontainers-java/pull/5474/files#r892189020

@bsideup
Copy link
Member

bsideup commented Jun 8, 2022

@eddumelendez I do see a problem with dropping the support for an old driver, as this is a breaking change.

@eddumelendez
Copy link
Member

In order to keep backward compatibility we can do something like this

@Override
public String getDriverClassName() {
    try {
        Class.forName("ru.yandex.clickhouse.ClickHouseDriver");
        return "ru.yandex.clickhouse.ClickHouseDriver";
    } catch (ClassNotFoundException e) {
        return "com.clickhouse.jdbc.ClickHouseDriver";
    }
}

@pan3793
Copy link
Contributor

pan3793 commented Jun 14, 2022

Why not try to load the new driver class first, and fall back to the old one if failed?

@eddumelendez
Copy link
Member

@anavrotski by any chance do you have some time to work on the changes? Thanks in advance.

@eddumelendez eddumelendez added this to the next milestone Jun 28, 2022
eddumelendez and others added 3 commits June 27, 2022 23:59
…/ClickHouseContainer.java

Co-authored-by: Sergei Egorov <bsideup@gmail.com>
…/ClickHouseContainer.java

Co-authored-by: Sergei Egorov <bsideup@gmail.com>
@eddumelendez eddumelendez merged commit e23f378 into testcontainers:master Jun 28, 2022
@anavrotski anavrotski deleted the clickhouse_driver_update branch June 28, 2022 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants