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

Regression when using multiple datasources 1.12.2.Final => 1.13.0.Final #16220

Closed
jaybeepee opened this issue Apr 3, 2021 · 7 comments
Closed
Labels
kind/bug Something isn't working triage/invalid This doesn't seem right

Comments

@jaybeepee
Copy link

Describe the bug

changing from Quarkus version 1.12.2.Final to 1.13.0.Final results in our multiple datasources configuration to fail on boot.

Expected behavior

No errors should be observed and DB connections in both datasources should be established successfully

Actual behavior

The primary (default) datasource fails with an error stating that the driver doesn't support the db url (connection string)
stack trace:
HHH000342: Could not obtain connection to query metadata: java.sql.SQLException: Driver does not support the provided URL: jdbc:mysql://a.b.c.d/dbname
at io.agroal.pool.ConnectionFactory.connectionSetup(ConnectionFactory.java:215)
at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:200)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:452)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:434)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:65)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)

I can only assume that for some reason the incorrect driver (most likely the pgsql driver) is being used for our default datasource (which is supposed to be mysql driver)

To Reproduce

Steps to reproduce the behavior:

  1. Configure a multiple datasources (default mysql and another named datasource like pgsql) project
  2. Run the project

Configuration

example config:
quarkus.http.port=8081
quarkus.datasource.db-kind=mysql
quarkus.datasource.username=dbname
quarkus.datasource.jdbc.url=jdbc:mysql://a.b.c.d/dbname
quarkus.hibernate-orm.packages=guru.jini
quarkus.datasource."pabx".db-kind=postgresql
quarkus.datasource."pabx".username=root
quarkus.datasource."pabx".jdbc.driver=org.postgresql.Driver
quarkus.datasource."pabx".jdbc.url=jdbc:postgresql://w.x.y.z/dbname
quarkus.hibernate-orm."pabx".datasource=pabx
quarkus.hibernate-orm."pabx".packages=guru.jini.buzzbox.services.pabx.model
quarkus.datasource."pabx".jdbc.max-size=200
quarkus.datasource."pabx".jdbc.initial-size=2
quarkus.datasource."pabx".jdbc.min-size=2
quarkus.datasource."pabx".jdbc.transaction-isolation-level=read-committed
quarkus.datasource."pabx".jdbc.validation-query-sql=commit
quarkus.flyway.pabx.migrate-at-start=true
quarkus.flyway.pabx.baseline-on-migrate=true
quarkus.flyway.pabx.baseline-version=1.0.0
quarkus.flyway.pabx.baseline-description=Initial version
quarkus.flyway.pabx.connect-retries=10
quarkus.flyway.pabx.schemas=public
quarkus.flyway.pabx.table=flyway_history
quarkus.flyway.pabx.locations=classpath:db/migration
quarkus.datasource.jdbc.max-size=200
quarkus.datasource.jdbc.initial-size=2
quarkus.datasource.jdbc.min-size=2
quarkus.datasource.jdbc.transaction-isolation-level=read-committed
quarkus.datasource.jdbc.validation-query-sql=commit
quarkus.transaction-manager.default-transaction-timeout=600
quarkus.http.cors=true
quarkus.log.file.enable=false
quarkus.log.category."io.agroal.pool".level=ERROR
quarkus.thread-pool.max-threads=200
quarkus.thread-pool.keep-alive-time=120
quarkus.thread-pool.core-threads=8
quarkus.log.console.json=false
quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss,SSS} %X{traceId} %-5p %c{3.}:%M (%t) %s%e%n

Environment (please complete the following information):

Output of uname -a or ver

Linux 5.8.0-48-generic #54~20.04.1-Ubuntu SMP

Output of java -version

openjdk 15.0.1 2020-10-20
OpenJDK Runtime Environment AdoptOpenJDK (build 15.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15.0.1+9, mixed mode, sharing)

GraalVM version (if different from Java)

Quarkus version or git rev

1.13.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.6.3

@jaybeepee jaybeepee added the kind/bug Something isn't working label Apr 3, 2021
@gsmet
Copy link
Member

gsmet commented Apr 3, 2021

Is it in dev mode only or it also happens when you run the jar?

@jaybeepee
Copy link
Author

jaybeepee commented Apr 3, 2021 via email

@gsmet
Copy link
Member

gsmet commented Apr 6, 2021

@jaybeepee it's a bit hard to see what's going on here. Any chance you could prepare a small reproducer?

@jaybeepee
Copy link
Author

sure @gsmet - will do one sometime today / this eve

@gsmet
Copy link
Member

gsmet commented Apr 6, 2021

OK cool. 1.13.1.Final is planned for tomorrow and I would like to get to the bottom of it before that!

@jaybeepee
Copy link
Author

jaybeepee commented Apr 6, 2021

Hey @gsmet

So it turns out this is not a bug, my sincere apologies. What we found is that if there is a submodule with an application.properties file that is configured for only one of the DBs (as the default and different to the 'global' default), then this error is happening. For some reason in 1.12.2 this did not cause an issue and I guess was ignored but in 1.13.0 it gets 'confused' somehow.

To illustrate the issue (fyi):
main application.properties will have the following:
quarkus.datasource.db-kind=mysql the default datasource
quarkus.datasource.jdbc.url=jdbc:mysql://a.b.c.d/dbname
...
quarkus.datasource."pabx".db-kind=postgresql the second datasource
quarkus.datasource."pabx".jdbc.url=jdbc:postgresql://w.x.y.z/dbname
...

Now, if a submodule of the project, for example a microservice, has it's own application.properties that is configured with a different default datasource as follows:
quarkus.datasource.db-kind=postgresql service-specific datasource - different to main project default datasource
quarkus.datasource.jdbc.url=jdbc:postgresql://w.x.y.z/dbname

Then the issue is triggered in 1.13.0. As mentioned, for some reason, 1.12.2 (and prior) doesn't mind this.

Fixing the issue on our side, in cfg of the submodule:
quarkus.datasource."pabx".db-kind=postgresql
quarkus.datasource."pabx".jdbc.url=jdbc:postgresql://w.x.y.z/dbname

Apologies for the assumption this was a bug. It was more a misconfiguration on our side that for some reason was masked/ignored prior to 1.13.0

@geoand
Copy link
Contributor

geoand commented Jul 28, 2021

This is likely due to a config change that went in.

@geoand geoand closed this as completed Jul 28, 2021
@geoand geoand added the triage/invalid This doesn't seem right label Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants