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

Liquibase validation failures in native image #15809

Closed
sfauvart opened this issue Mar 17, 2021 · 4 comments · Fixed by #15815
Closed

Liquibase validation failures in native image #15809

sfauvart opened this issue Mar 17, 2021 · 4 comments · Fixed by #15815
Assignees
Labels
area/liquibase kind/bug Something isn't working
Milestone

Comments

@sfauvart
Copy link

Describe the bug

I have a quarkus application with a Postgres database and liquibase changeset.
All work fine on "classic" JVM but on native mode some liquibase change instruction seems have a problem and throw ValidationFailedException on startup.
I have this behavior on update instruction

Expected behavior

Like on classic JVM, the application should apply the migration and startup without error.

Actual behavior

On native run I have this error :

2021-03-17 15:53:24,316 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): liquibase.exception.ValidationFailedException: Validation Failed:
     1 changes have validation failures
          tableName is required, liquibase/changeLog.xml::1613578374533-3::sfauvart

	at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:299)
	at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:275)
	at liquibase.Liquibase.validate(Liquibase.java:2220)
	at io.quarkus.liquibase.runtime.LiquibaseRecorder.doStartActions(LiquibaseRecorder.java:49)
	at io.quarkus.deployment.steps.LiquibaseProcessor$startLiquibase763757012.deploy_0(LiquibaseProcessor$startLiquibase763757012.zig:67)
	at io.quarkus.deployment.steps.LiquibaseProcessor$startLiquibase763757012.deploy(LiquibaseProcessor$startLiquibase763757012.zig:40)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:629)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:100)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)

tableName is present in my changelog.xml file and run correctly on classic JVM.

To Reproduce

You can use this git repo : https://github.com/sfauvart/quarkus-liquibase-validation-fail

This repo is simply a quarkus project with jdbc postgres and liquibase extensions with this liquibase changelog :

<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd">

  <changeSet author="sfauvart" id="1613578374533-1">
    <createTable tableName="cart">
      <column name="id" type="UUID">
        <constraints nullable="false" primaryKey="true" primaryKeyName="cartPK"/>
      </column>
      <column name="created_at" type="TIMESTAMP WITHOUT TIME ZONE">
        <constraints nullable="false"/>
      </column>
    </createTable>
  </changeSet>
  <changeSet author="sfauvart" id="1613578374533-2">
    <addColumn tableName="cart">
      <column name="updated_at" type="TIMESTAMP WITHOUT TIME ZONE"/>
    </addColumn>
  </changeSet>
  <changeSet author="sfauvart" id="1613578374533-3">
    <update tableName="cart">
      <column name="updated_at" valueComputed="created_at"/>
    </update>
  </changeSet>
</databaseChangeLog>

Steps to reproduce the behavior:

  1. Start postgresql with docker :
docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name quarkusdb -e POSTGRES_USER=db_user -e POSTGRES_PASSWORD=asecretpassword -e POSTGRES_DB=cart -p 5432:5432 postgres:12.2
  1. Install graalvm with sdkman, build project in native mode and run it :
sdk install java 21.0.0.r11-grl
mvn clean package -Pnative
./target/code-with-quarkus-1.0.0-SNAPSHOT-runner
  1. If you try with the classic JVM it's ok :
./mvnw compile quarkus:dev

Configuration

quarkus.datasource.db-kind=postgresql
quarkus.datasource.jdbc.url=jdbc:postgresql:cart
quarkus.datasource.username=db_user
quarkus.datasource.password=asecretpassword
quarkus.liquibase.migrate-at-start=true
quarkus.liquibase.change-log=liquibase/changeLog.xml

Environment (please complete the following information):

Output of uname -a or ver

MacBook Pro 2019 on Mac OS X
Darwin M100263 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment GraalVM CE 21.0.0 (build 11.0.10+8-jvmci-21.0-b06)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.0 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)

Quarkus version or git rev

1.12.2.Final

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

Maven home: /Users/sfauvart/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 11.0.10, vendor: GraalVM Community, runtime: /Users/sfauvart/.sdkman/candidates/java/21.0.0.r11-grl
Default locale: fr_FR, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"

Additional context

I have try with a linux compilation with docker but the same exception happen.

@sfauvart sfauvart added the kind/bug Something isn't working label Mar 17, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 17, 2021

/cc @andrejpetras, @geoand, @gsmet

@gsmet
Copy link
Member

gsmet commented Mar 17, 2021

@andrejpetras would you have the time to take a look at this one?

@sfauvart sfauvart changed the title Liquibase validation failures Liquibase validation failures in native image Mar 17, 2021
@gsmet
Copy link
Member

gsmet commented Mar 17, 2021

OK, so... adding liquibase.change.core.AbstractModifyDataChange for reflection fixes the issue but my guess is that we need to add all the classes marked with @DatabaseChangeProperty. That will inflate the size of the native image but I don't see any other solution.

@gsmet
Copy link
Member

gsmet commented Mar 17, 2021

#15815 should take care of this. Thanks for the reproducer, it was really helpful!

@quarkus-bot quarkus-bot bot added this to the 1.14 - main milestone Mar 17, 2021
@gsmet gsmet modified the milestones: 1.14 - main, 1.13.0.Final Mar 23, 2021
derkoe added a commit to porscheinformatik/angular-spring-heroes that referenced this issue May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/liquibase kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants