liquibase: Liquibase lib upgrade to 4.21.1 breaking rollback working earlier
Search first
- I searched and no similar issues were found
Description
Hi Team,
Recently we had updated the liquibase library from 4.8.0 to 4.21.1 and we are noticing the below issue when we are executing liquibase.rollback on a single changeset which is present externally
rror updating database: liquibase.exception.ChangeLogParseException: The file tracing_data_15.xml was not found in the configured search path: More locations can be added with the ‘searchPath’ parameter. liquibase.exception.CommandExecutionException: liquibase.exception.ChangeLogParseException: The file tracing_data_15.xml was not found in the configured search path: More locations can be added with the ‘searchPath’ parameter. at liquibase.command.CommandScope.execute(CommandScope.java:235) at liquibase.Liquibase.rollback(Liquibase.java:734) at liquibase.Liquibase.rollback(Liquibase.java:717) at liquibase.Liquibase.rollback(Liquibase.java:712) at liquibase.Liquibase.rollback(Liquibase.java:696) at TestProg3.main(TestProg3.java:44) Caused by: liquibase.exception.ChangeLogParseException: The file tracing_data_15.xml was not found in the configured search path: More locations can be added with the ‘searchPath’ parameter. at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:114) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:15) at liquibase.command.core.helpers.DatabaseChangelogCommandStep.getDatabaseChangeLog(DatabaseChangelogCommandStep.java:100) at liquibase.command.core.helpers.DatabaseChangelogCommandStep.run(DatabaseChangelogCommandStep.java:77) at liquibase.command.CommandScope.execute(CommandScope.java:212) … 5 more
he code is simple liquibase.rollback below which used to work with earlier version of library
String tracingFilePath = "tracxing_data_15.xml";
SearchPathResourceAccessor resourceAccessor = new SearchPathResourceAccessor(
new DirectoryResourceAccessor(Paths.get("C:\\SIU_1011_RC3\\var\\").toAbsolutePath().toFile()));
Liquibase liquibase = new Liquibase(tracingFilePath, resourceAccessor, database);
liquibase.validate();
liquibase.rollback("tracing_data_15_create", "");
Steps To Reproduce
In windowsplace the tracing_data_15.xml in C:\SIU_1011_RC3\var\ dir
place the lib with below code and dependencies in C:\SIU_1011_RC3\ directory String tracingFilePath = “tracxing_data_15.xml”; SearchPathResourceAccessor resourceAccessor = new SearchPathResourceAccessor( new DirectoryResourceAccessor(Paths.get(“C:\SIU_1011_RC3\var\”).toAbsolutePath().toFile())); Liquibase liquibase = new Liquibase(tracingFilePath, resourceAccessor, database); liquibase.validate(); liquibase.rollback(“tracing_data_15_create”, “”);
Running the above jar fails with liquibase 4.21.1 library with below exception More locations can be added with the ‘searchPath’ parameter. liquibase.exception.CommandExecutionException: liquibase.exception.ChangeLogParseException: The file tracing_data_15.xml was not found in the configured search path: More locations can be added with the ‘searchPath’ parameter. at liquibase.command.CommandScope.execute(CommandScope.java:235) at liquibase.Liquibase.rollback(Liquibase.java:734) at liquibase.Liquibase.rollback(Liquibase.java:717) at liquibase.Liquibase.rollback(Liquibase.java:712) at liquibase.Liquibase.rollback(Liquibase.java:696) at TestProg3.main(TestProg3.java:44) Caused by: liquibase.exception.ChangeLogParseException: The file tracing_data_15.xml was not found in the configured search path: More locations can be added with the ‘searchPath’ parameter. at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:114) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:15) at liquibase.command.core.helpers.DatabaseChangelogCommandStep.getDatabaseChangeLog(DatabaseChangelogCommandStep.java:100) at liquibase.command.core.helpers.DatabaseChangelogCommandStep.run(DatabaseChangelogCommandStep.java:77) at liquibase.command.CommandScope.execute(CommandScope.java:212) … 5 more
The code is simple liquibase.rollback below which used to work with earlier version of library
However the code succeeds with liquibase 4.8.0 library.
Expected/Desired Behavior
the rollback should succeed ideally
Liquibase Version
4.21.1
Database Vendor & Version
mysql 8.0.23
Liquibase Integration
No response
Liquibase Extensions
liquibase-core
OS and/or Infrastructure Type/Provider
windows
Additional Context
No response
Are you willing to submit a PR?
- I’m willing to submit a PR (Thank you!)
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (10 by maintainers)
Apologies if it oversteps, but here is a PR suggestion: #4591
This looks good. Having the exact same issue.
For us it is on change sets where we are using properties from liquibase.properties.
Oh, of course! I was uselessly searching for “4406” on the release notes 🤦 Thank you very much!
Hello @blaghed ! You mean the changes on this PR -> https://github.com/liquibase/liquibase/pull/4591 ? They were included in Liquibase 4.24.0 😃
@blaghed we are changing our build process and in the last week or so we were not able to run our full test suite against some PR’s, and we need all steps to pass before merging to master . Hopefully it will be fixed still this week so we can get it merged for next release.
Thanks @rdhzl and @blaghed ! The code I added above is mostly a copy from what we did on Liquibase class when we refactored rollback command. So we can create a PR to add the missing CHANGELOG_PARAMETERS . Anyone would be able to do create it so I can fast track to the next release probabily next week?
About Liquibase class @rdhzl , it will stay deprecated until Liquibase 5 is released. That said, we have no plans for 5 so far, and Liquibase class may even be refactored again for it, but there is a chance it goes away and the way forward is the Command framework - and if Liquibase class remains it will be just wrappers for commands. So Scope.child and CommandScope are the present and the future .
Hi @filipelautert ,
We are also facing this issue, as far as I can understand it. A quick browse seems to show that this may have been accidentally caused during a refactor between 4.20.0 and 4.21.0, and then further buried with a much larger refactor of the project’s layout during 4.22.0.
With the current latest version, there is a new (much tidier) approach to run liquibase, but it does require setting up the execution correctly, as we can see, for example, on the update command: https://github.com/liquibase/liquibase/blob/v4.23.0/liquibase-standard/src/main/java/liquibase/Liquibase.java#L311
On the rollback command, you may note that the “
DatabaseChangelogCommandStep.CHANGELOG_PARAMETERS
” parameters are not passed in at all: https://github.com/liquibase/liquibase/blob/v4.23.0/liquibase-standard/src/main/java/liquibase/Liquibase.java#L488-L500There are plenty of other methods in that class making use of “
addArgumentValue
” that also don’t set these parameters, so please be sure to check those as well, but I believe that those are likely correct. Only the several “rollback
” operations are, imho, mistakenly missing that.This seems like an honest mistake happening due to the refactors, so likely it just needs a small patch for having a quick win. I don’t mind contributing it myself, but I get the feeling I will trip all over your contribution guidelines. If you simply don’t have time for it yourself, however, I will be happy to do so, so just let me know.
Hello @rdhzl ! would you be able to test it again with Liquibase 4.23.0 ? We added some fixes related to those methods in that version.