cancel
Showing results for 
Search instead for 
Did you mean: 

Liquigraph to liquibase migration: Validation Failed change sets check sum

gonzalad
Node Link

Hello,

I'm migrating my current Spring Boot Application from liquigraph usage to liquibase 4.10.0.

I have executed successfully the liquigraph migrate-to-liquibase command as documented here: Migrate to Liquibase - Liquigraph

/liquigraph-cli/liquigraph.sh migrate-to-liquibase \
  --changelog infrastructure/neo4j-adapter/neo4j-adapter-migration/src/main/resources/db/liquigraph/changelog.xml \
  --url jdbc:neo4j:bolt://localhost \
  --file ./liquibase.xml

I include liquibase-core and liquibase-neo4j (both at version 4.10.0) into my spring boot application and set in my application.yml:

spring:
  liquibase:
    change-log: classpath:liquibase.xml

When my spring boot application starts, I get the following error:

Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
     11 change sets check sum
          liquibase.xml::cof.0.8.37.0-SCOL-6934-3::Nantes was: 8:4f6f103bc9778b4279c12637aa23db4d but is now: 8:50eb2e5b8b4df0fee307ca4b60a52363
          liquibase.xml::cof.0.8.38.0-SCOL-4466-1::Nantes was: 8:0227810d1693b795cbfeabcf0f96c8c3 but is now: 8:9505b36e309178461d1db23fe4f6bd1e
          liquibase.xml::cof.0.8.38.0-SCOL-4463-1::Nantes was: 8:cbdd7a7eddfaf845542de0da9e0780b1 but is now: 8:d7863e386ac188e732e6e5b5ebe96fd9
          liquibase.xml::cof.0.8.38.0-of-obl-del::Nantes was: 8:a5f34bfc90cb5c0b2dba609a1c55749e but is now: 8:bcd2d0d35d3889c904856a780985d8ce
          liquibase.xml::cof.1.1.0.41-SCOL-7584-1::Nantes was: 8:e4f58cd2930a62de6823d5b688f18cf7 but is now: 8:b70bafc9838f4e8da4dc9833fd01ccb8
          liquibase.xml::cof.1.1.0.41-SCOL-7584-2::Nantes was: 8:d00d53028def4e4909d1c7f95e287757 but is now: 8:59db271c915664055f8217a813bf1527
          liquibase.xml::cof.1.1.0.41-SCOL-6346-3::Nantes was: 8:17beaa171d1c078dd59ad058c3779bc9 but is now: 8:4b6ddcbc8c60f257b671b765a05c6d84
          liquibase.xml::cof.1.1.0.43-SCOL-8662-1::Nantes was: 8:ca246a0f0f44cdca384a8961ff380338 but is now: 8:07802c04a9edf0d5fe4c440800dcdc5c
          liquibase.xml::cof.1.2.0.48-SCOL-8771::Nantes was: 8:0b43e5509d178a99414b356c742f5748 but is now: 8:a702293ea772f916838004623863ba83
          liquibase.xml::cof.2.0.0.52-SCOL-10036-1::Nantes was: 8:f003b0450278f23feb8720ef42405fd4 but is now: 8:bea8ff0bca26b780111348bbc62ec8e6
          liquibase.xml::cof.2.0.0.54-SCOL-10875-1::Nantes was: 8:eb3669c160b865340be4a69d9d62e4da but is now: 8:224bbb06387c0a50ef93b4c216c1a0c5

	at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:296)
	at liquibase.Liquibase.lambda$update$1(Liquibase.java:231)
	at liquibase.Scope.lambda$child$0(Scope.java:180)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:179)
	at liquibase.Scope.child(Scope.java:158)
	at liquibase.Liquibase.runInScope(Liquibase.java:2405)
	at liquibase.Liquibase.update(Liquibase.java:211)
	at liquibase.Liquibase.update(Liquibase.java:197)
	at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:314)
	at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:269)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
	... 17 common frames omitted

This is weird, I have a little more than 80 changesets.

So only a subset of the hash computation was failed.

I don't know if it rings a bell for someone.

I'm a bit concerned at publishing the migrations in a public forum since it's for a real application ;(

I can send them in mp

Thanks,
Adrian

1 REPLY 1

gonzalad
Node Link

Hi, just for the record

I finished liquigraph -> liquibase migration some weeks ago.

Issues I had

  1. As noted before, I had an issue on the checkSum computation (the migration CLI gave some bad value for some migrations)

  2. Another issue particular to my project is that liquigraph migrations came from 2 locations:

  • my own application
  • but also a reusable library

When I executed the liquigraph migration tool all the migrations where extracted to the same file and hence with the same changeLog property (liquibase.xml)

What I did

  1. Execute the migration tool on my develop branch (and on a dev db) - see Migrate to Liquibase - Liquigraph
  2. Change the generated liquibase.xml (i.e. move that to subfolder as you like, and change the changeLog values in this file). In this step I needed to split the liquibase.xml into 2 files (one for my app and another for the reusable lib)
    These files will be now stored in my gitlab repos (src/main/resources similar to the previous liquigraph migrations)
  3. Remove the liquigraph migrations
    Now you have you liquibase powered migration.
    I now need to handle the existing production/tests databases.
  4. Since I'm using kubernetes, I create an init container for the liquigraph -> liquibase migration, in this container I execute:
    a. the liquigraph migration tool
    b. and the script to handle the manipulations I did on step 2 and to fix the checksum computation issue
    Something like:
// fix checksums
MATCH (cs:`__LiquibaseChangeSet`)
WHERE cs.changeLog = 'liquibase.xml'
SET cs.checkSum = null;

// changelog path customisation
MATCH (cs:`__LiquibaseChangeSet`)
WHERE cs.changeLog = 'liquibase.xml'
SET cs.changeLog = 'db/changelog/V3.0/S74/myapp.3.0.74-1_migration_liquigraph_liquibase.xml';

And that's all

I hope this can help someone

Cheers,
Adrian

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.