hub
hub copied to clipboard
Quarkus hot reloading fails due to missing Flyway migration
Please agree to the following
- [X] I have searched existing issues for duplicates
- [X] I agree to follow this project's Code of Conduct
Summary
Hot Reloading fails due to missing V2 migration
System Setup
- Quarkus: 3.0.1.Final
- Flyway: 9.16.3 (transitive via quarkus-flyway)
Steps to Reproduce
- Start
mvn quarkus:dev - Visit
localhost:8080, triggering the initial set of Flyway migrations - Change anything (i.e. add a whitespace in some Java file)
- Refresh
localhost:8080, triggering a Quarkus reload
Expected Behavior
Flyway validates the database successfully (no migration required)
Actual Behavior
Flyway fails to validate the database: Detected applied migration not resolved locally: 2.
Reproducibility
Always
Relevant Log Output
2023-07-13 13:04:53,002 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (vert.x-worker-thread-1) Failed to start quarkus: io.quarkus.dev.appstate.ApplicationStartException: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:58)
at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:123)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:222)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartCallback(IsolatedDevModeMain.java:203)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:543)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:441)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$4.handle(VertxHttpHotReplacementSetup.java:152)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$4.handle(VertxHttpHotReplacementSetup.java:139)
at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:104)
... 1 more
Caused by: org.flywaydb.core.api.exception.FlywayValidateException: Validate failed: Migrations have failed validation
Detected applied migration not resolved locally: 2.
If you removed this migration intentionally, run repair to mark the migration as deleted.
Need more flexibility with validation rules? Learn more: https://rd.gt/3AbJUZE
at org.flywaydb.core.Flyway.lambda$migrate$0(Flyway.java:146)
at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:196)
at org.flywaydb.core.Flyway.migrate(Flyway.java:140)
at io.quarkus.flyway.runtime.FlywayRecorder.doStartActions(FlywayRecorder.java:93)
at io.quarkus.deployment.steps.FlywayProcessor$startActions2035800939.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.FlywayProcessor$startActions2035800939.deploy(Unknown Source)
... 11 more
Anything else?
The V2 migration is our deprecated Java-based migration (V2__Initialize_Settings.java). Other than the SQL-based migrations, this seems to be invisible during a hot reload.
Related to #183 and #184
This is our config:
https://github.com/cryptomator/hub/blob/72150eaba3ee6812e1218b1974eb31ee040f902f/backend/src/main/resources/application.properties#L62-L63
For the record, when setting %dev.quarkus.flyway.ignore-missing-migrations=true, hot reloading works again. But the logs confirm, that V2 is indeed not found:
These are migrations on first start:
2023-07-13 14:55:45,416 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Current version of schema "public": << Empty Schema >>
2023-07-13 14:55:45,430 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Migrating schema "public" to version "1 - Create Tables"
2023-07-13 14:55:45,499 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Migrating schema "public" to version "2 - Initialize Settings"
2023-07-13 14:55:45,537 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Migrating schema "public" to version "3 - Initialize Settings"
2023-07-13 14:55:45,577 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Migrating schema "public" to version "4 - Update PKs"
2023-07-13 14:55:45,676 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Migrating schema "public" to version "5 - UTC Timestamps"
...
and after hot reloading, V2 is simply missing:
2023-07-13 14:56:44,857 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Current version of schema "public": << Empty Schema >>
2023-07-13 14:56:44,872 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Migrating schema "public" to version "1 - Create Tables"
2023-07-13 14:56:44,966 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Migrating schema "public" to version "3 - Initialize Settings"
2023-07-13 14:56:45,010 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Migrating schema "public" to version "4 - Update PKs"
2023-07-13 14:56:45,130 INFO [org.fly.cor.int.com.DbMigrate] (Quarkus Main Thread) Migrating schema "public" to version "5 - UTC Timestamps"
...
After adding a baseline migration (B14), this workaround might have become obsolete.