-
Notifications
You must be signed in to change notification settings - Fork 17
fix: clearCheckSums generated invalid SQL #354
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
Conversation
Spanner requires that all UPDATE and DELETE statements contain a WHERE clause as safety precaution against accidental updates and deletes. Liquibase however by default generates UPDATE and DELETE statements without a WHERE clause if none has been specified. The Spanner Liquibase provider therefore now adds custom generators for those statements that automatically add a `WHERE true` clause to statements that do not have a WHERE clause.
|
Awesome thanks! We're on a production incident now, and would appreciate an expedited tagging of this release so we can resolve the new build. |
https://github.com/cloudspannerecosystem/liquibase-spanner/releases/tag/4.29.2.1 |
|
@olavloite We're wondering what causes clear-checksum to run in the first place. We hadn't checked in any changes to any of the scripts. We verified they remained un-modified. We also hadn't deployed any new scripts. Are there other events that may trigger clear-checksum to try to run, other than a checksum mismatch? Or is it possible to have a checksum-mismatch triggered erroneously? Thanks for any additional insight you could provide us on this issue. |
|
More context, 4.29.2 was running in prod since 7 days, we tried to deploy new spring boot update. We have canary deployment, which runs extra pod before it prompt to primary one. After canary failure, primary pod which was created 7 days ago was also starting to fail to scale because of same reason. I verified and reported issue to google immediately through DoIT. I checked all the DATABASECHANGELOG and LOCK, there were nothing modified. As @thejeff77 mentioned, I think some other library is triggering this, I am able to re-produce in my local. Is it side effect of spanner-jdbc? I can explain more in details if you need. |
|
` Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. Process finished with exit code 1 ` |
|
@patiramyadav I don't know what triggers Liquibase to run If you look at the Liquibase source code for version 4.29.2 (https://github.com/liquibase/liquibase/blob/v4.29.2/liquibase-standard/src/main/java/liquibase/changelog/StandardChangeLogHistoryService.java), then you'll see that this looks impossible, as line 282 is empty. Could it be that Spring or some of the other dependencies in your application are pulling in a different version of Liquibase? Could you otherwise check what that line is in the version of Liquibase that you are using? |
|
|
@patiramyadav But one possible reason for this problem here is that you seem to have conflicting Liquibase versions on your classpath. The Spanner Liquibase versions are kept in sync with the Liquibase versions. Meaning that Liquibase Spanner v4.29.2 should be used with Liquibase 4.29.2. If you add Liquibase core 4.17.2 to the classpath, and at the same time also use Liquibase Spanner 4.29.2, then the two might not be compatible. Exactly which version will be picked up by your application can then then also be rather arbitrary, meaning that completely unrelated changes (or even just building on a different machine) could trigger the other version to be picked up. That again can trigger this check to nullify all existing checksums: https://github.com/liquibase/liquibase/blob/347c33d055305df45b5df8ba70f0ed03cdb1ce20/liquibase-core/src/main/java/liquibase/changelog/StandardChangeLogHistoryService.java#L250 |
|
Thanks, We also forced to use exact version. |


Spanner requires that all UPDATE and DELETE statements contain a WHERE clause as safety precaution against accidental updates and deletes. Liquibase however by default generates UPDATE and DELETE statements without a WHERE clause if none has been specified. The Spanner Liquibase provider therefore now adds custom generators for those statements that automatically add a
WHERE trueclause to statements that do not have a WHERE clause.The
clear-checksumscommand (https://docs.liquibase.com/commands/utility/clear-checksums.html) generated such an update statement, and would therefore fail with an error like this: