-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Named Flyway config assumes values from adjusted default Flyway config #33058
Comments
/cc @cristhiank (flyway), @gastaldi (flyway), @geoand (flyway), @gsmet (flyway) |
/cc @radcortez |
I believe that if you modify the default configuration (eg. |
@gastaldi I don't think so, at least that's not what we are doing in other extensions. Named config are independent from the unnamed one. They are configuring different instances. |
I believe this is (deeper) config issue, not a Flyway issue (PR is completely fine), that's why I cc Roberto before. |
I agree with @gsmet , the previous behavior is the correct one |
This is not a behavior provided by Config. There is no relationship between defaults for unnamed and named configs. The issue here is that if a named config is not found, then the default is returned (but this is coded manually), here: quarkus/extensions/flyway/runtime/src/main/java/io/quarkus/flyway/runtime/FlywayRuntimeConfig.java Lines 19 to 28 in 6cf647c
And because the app config contains oracle related properties: It triggers the Flyway container creation for that named datasource (which doesn't exist and fallbacks to the default). |
ah, you are right, my bad, thank you |
So the solution is to create a new ConfigMapping explicitly? eg. default FlywayDataSourceRuntimeConfig getConfigForDataSourceName(String dataSourceName) {
if (DataSourceUtil.isDefault(dataSourceName)) {
return defaultDataSource();
}
FlywayDataSourceRuntimeConfig config = namedDataSources().get(dataSourceName);
if (config == null) {
SmallRyeConfig smallRyeConfig = ConfigProvider.getConfig().unwrap(SmallRyeConfig.class);
config = smallRyeConfig.getConfigMapping(FlywayDataSourceRuntimeConfig.class, "quarkus.flyway." + dataSourceName);
}
return config;
} |
Ideally, we should have SmallRye Config return a config with the default values when doing @radcortez does the newly introduced @gastaldi FYI, there is some work in progress here to prototype it with Hibernate Search: #32854 . Let's wait for it to be sorted out before moving other extensions to it. @yrodiere what's the status? |
Not yet. The plan was to support it. We first added support for the unnamed key to keep everything in a single Regardless, I'll try to add that support ASAP. |
I'll revert my commit meanwhile and reapply it once the |
Neither
My PR (#32854) is ready, but we need a Smallrye config dependency upgrade before we merge it. As to the feature you're talking about (default instances of config interfaces), as Roberto said we first need to agree on a solution. I personally would be in favor of switching from The discussion is there: https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/Config.20mapping.20take.202 |
Describe the bug
#32925 migrated Flyway to
@ConfigMapping
. I have app that uses 2+ datasources. Default datasource PG has Flyway configured via defaultquarkus.flyway.*
while Oracle is configured viaquarkus.flyway.oracle.*
. In past when I changedquarkus.flyway.migrate-at-start
at runtime, it only affected PG, now it also affects Oracle unless I override it withquarkus.flyway.oracle.migrate-at-start=false
. In past, Flyway extension simply created new default instance ofFlywayDataSourceRuntimeConfig
instead of loading it from Config.Expected behavior
https://quarkus.io/guides/all-config#quarkus-flyway_quarkus.flyway.-named-data-sources-.migrate-at-start says default is false, so I expect one of:
false
unless I override value withquarkus.flyway.oracle
quarkus.flyway.migrate-at-start
in documentation so that my expectations are correctedActual behavior
quarkus.flyway.migrate-at-start
changes default ofquarkus.flyway.oracle.migrate-at-start
How to Reproduce?
Reproducer
git clone [email protected]:michalvavrik/quarkus-test-suite.git
cd quarkus-test-suite/sql-db/vertx-sql
git checkout -b repro-flyway-defaults
mvn clean test
Output of
uname -a
orver
Linux Fedora
Output of
java -version
openjdk version "11.0.18" 2023-01-17
GraalVM version (if different from Java)
22.3
Quarkus version or git rev
999-SNAPSHOT
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.6
Additional information
No response
The text was updated successfully, but these errors were encountered: