Liquibase is not working after upgrading 3.5.5 to 3.8.9

Liquibase is not working after upgrading to 3.8.9 which leads to getting the following error (While starting the spring boot application):

Caused by: java.lang.RuntimeException: Cannot use default schema name my-schema on Microsoft SQL Server because the login schema of the current user (dbo) is different and MSSQL does not support setting the default schema per session.

Base on the error it looks like permission issue; I even tried with the user having permission on the particular schema my-schema and then tried again but now the logs say:

2020-07-28 14:42:50,759 INFO  [main] liquibase.logging.core.Slf4jLogger: select schema_name()
2020-07-28 14:42:50,915 INFO  [main] liquibase.logging.core.Slf4jLogger: SELECT TOP 1 MD5SUM FROM DATABASECHANGELOG WHERE MD5SUM IS NOT NULL
2020-07-28 14:42:51,068 INFO  [main] liquibase.logging.core.Slf4jLogger: select schema_name()
2020-07-28 14:42:51,221 INFO  [main] liquibase.logging.core.Slf4jLogger: UPDATE DATABASECHANGELOG SET MD5SUM = NULL
2020-07-28 14:42:51,537 INFO  [main] liquibase.logging.core.Slf4jLogger: select schema_name()
2020-07-28 14:42:51,690 INFO  [main] liquibase.logging.core.Slf4jLogger: select schema_name()
2020-07-28 14:42:51,838 INFO  [main] liquibase.logging.core.Slf4jLogger: SELECT COUNT(*) FROM DATABASECHANGELOG
2020-07-28 14:42:51,987 INFO  [main] liquibase.logging.core.Slf4jLogger: Reading from DATABASECHANGELOG
2020-07-28 14:42:51,994 INFO  [main] liquibase.logging.core.Slf4jLogger: select schema_name()
2020-07-28 14:42:52,145 INFO  [main] liquibase.logging.core.Slf4jLogger: SELECT * FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
2020-07-28 14:42:53,188 INFO  [main] liquibase.logging.core.Slf4jLogger: select schema_name()
2020-07-28 14:42:53,343 INFO  [main] liquibase.logging.core.Slf4jLogger: UPDATE DATABASECHANGELOG SET MD5SUM = '8:417f9207fe8e8268e383719af6f9d7c7' WHERE ID = '1' AND AUTHOR = 'system' AND FILENAME = 'database/changelog/initial_schema.xml'
2020-07-28 14:42:53,654 INFO  [main] liquibase.logging.core.Slf4jLogger: select schema_name()
2020-07-28 14:42:53,810 INFO  [main] liquibase.logging.core.Slf4jLogger: UPDATE DATABASECHANGELOG SET MD5SUM = '8:30308b26d27500571e3f9bbaf68918de' WHERE ID = '2' AND AUTHOR = 'system' AND FILENAME = 'database/changelog/initial_schema.xml'

Liquibase has updated the my-schema.DATABASECHANGELOG MD5SUM column value. It has modified some of the records MD5SUM as NULL and for some of the field it has set new MD5SUM value; its performing this operation each and every time I am starting the spring boot application.

It works fine with Liquibase 3.5.5 but for 3.8.9 I am facing this issue.

Hi @vinodthebest,

If I read correctly looks like the md5 checksums got recalculated, probably b/c of a change in the way those versions calculate checksum.

I am curious, if you roll back to 3.5.5 what is the error? Is it checksum related b/c then you can just clear the checksums and use 3.5.5.

Are you using MSSQL? The only other thing I found was this user having too much permissions but, that does not sound right.

Are you able to run liquibase directly? I ask b/c I am not a SpringBoot expert, want to take that configuration specfics out of the troubleshooting arena.

Thanks,

Ronak

Hi @ronak,

Thanks for the help.

I would like to share my finding and how I resolved this issue; firstly I am using the MSSQL server, in Liquibase 3.5.5 the default user worked fine for the schema level changes and we didn’t face any permission issue but from Liquibase 3.8.9 this was not the case so we created a new user and gave the permission so it resolved the permission issue. This was a major issue.

I checked the Liquibase blog (https://www.liquibase.org/blog/liquibase-3-6-0-released) and came to know that it has updated the Checksum logic base on which it trying to re-calculating the MD5SUM value as per the new algorithm so it’s fine for me. But in DB after performing the above operation; when I check I found some of the values were turned to NULL and other all columns were having the values as **7:abc… only.
That is values are the same which are being generated with Liquibase 3.5.5 either they are not updated or turned into NULL.
Due to which Liquibase is performing this update operation each and every time while starting the spring boot application using Liquibase 3.8.9; because it’s trying to update the value to as per the new algorithm but was unable to execute the operation completely.

My finding says it was not permission issue; the issue was in some worst cases Liquibase was unable to update the existing MD5SUM values with newly calculated values; as you suggested I tried to clear the existing checksum and in Spring we do that using ( spring.liquibase.clear-checksums=true ) and then perform the action and that solution worked in my case.

For testing purposes, I have even rolled back to 3.5.5 it automatically updated the DATABASECHANGELOG MD5SUM back to 7:abc*. base on the old algorithm. And now when I switched back to Liquibase 3.8.9 it worked without any issue that is I don’t require to clear the checksum also. And this time it automatically updates the MD5SUM to 8:abc*.

Thanks a lot for all your help.

1 Like

@vinodthebest Thank you so much for sharing in such detail how you resolved this issue. I am hoping others can benefit from the work you did to recover from the change in md5 calculation algorithm (and it sounds like you were also dealing with an error in converting from one old calculation scheme to the new).

Glad to have you sharing and glad to have you as a part of the Liquibase community!

-Ronak