What does liquibase validate really do, and when should I use it?

It looks like changeLogSync should run the validate method as part of that processing. 

The error looks like a problem with the checksum changing between when you ran “update” and when you run validate. It’s strange that would happen if there were no steps between them. Can you post an example of the problem changeSets? Are they using changelog parameters or anything that could vary?



I have a job that runs in “paranoid” mode, to do all possible checks I can think of, before I let the next step (update) start.

So it does liquibase validate, but in some cases I get an error like:

Validation Error: 

     2 change sets have changed since they were ran against the database

          changelog.innovid_iroll_apps.xml::1402218962182-3::gavriel (generated)

          changelog.innovid_iroll_apps.xml::1402218962182-7::gavriel (generated)

The strange thing is that just a few minutes earlied I “ran” these changes with liquibase changelogSync successfully. Here’s the scenario:

1. liquibase changelogSync

  1. added some new changesets

  2. liquibase update

  3. liquibase validate => validation error

Any idea why? In the “paranoia” mode checks should I run validate or not? Does updateSQL fail if someone changed a changeset that already ran?

Nothing changed in the xml files between step 3 and 4. There were changes before step 1, but I assumed that if both changelogSync and update passed without any warnings, then it means everything is OK. 

To me it looks like validate validates things that update doesn’t check. Is it possible? In other words I have some old changesets that have their hash changed, but when I run update it doesn’t care, doesn’t warn. Only when I run validate it shouts. If this is the case then I wonder what is validate aimed for? Would updateSQL shout when there are hashes changed that would cause update to fail? If yes, then I won’t add validate to the pre-test, only updateSQL.

There should be no difference. The Liquibase.validate() method is called in both cases.

UpdateSQL will also run validate just like update does, so updateSql should be sufficient.