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
LB-2131: databasechangeloglock table creation not threadsafe #2198
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nvoxland
suggested changes
Nov 9, 2021
liquibase-core/src/main/java/liquibase/lockservice/StandardLockService.java
Outdated
Show resolved
Hide resolved
liquibase-core/src/main/java/liquibase/lockservice/StandardLockService.java
Outdated
Show resolved
Hide resolved
liquibase-core/src/main/java/liquibase/lockservice/StandardLockService.java
Outdated
Show resolved
Hide resolved
liquibase-core/src/main/java/liquibase/lockservice/StandardLockService.java
Outdated
Show resolved
Hide resolved
…n message, and move rollback to higher try/catch
# Conflicts: # liquibase-core/src/main/java/liquibase/lockservice/StandardLockService.java
suryaaki2
approved these changes
Nov 10, 2021
nvoxland
approved these changes
Nov 10, 2021
This was referenced Jan 5, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Environment
Liquibase Version:
Liquibase Integration & Version: <Pick one: CLI, maven, gradle, spring boot, servlet, etc.>
Liquibase Extension(s) & Version:
Database Vendor & Version:
Operating System Type & Version:
Pull Request Type
Description
The creation of the databasechangeloglock table was not threadsafe. If the creation of the table failed, Liquibase would exit. This change introduces a retry loop with a random wait between failed iterations so that multiple instances of Liquibase can be run concurrently on a fresh database.
Steps To Reproduce
This can be reproduced with a shell script that calls the liquibase command line multiple times concurrently, when run against a database that does not already contain the databasechangelog table:
The changelogfile should contain something that can be run multiple times successfully, like this:
assuming that the table was created with a script like this:
Actual Behavior
Expected/Desired Behavior
If the table already exists, Liquibase sleeps for a random amount of time and then tries again, trying a maximum of ten times to create the databasechangeloglock table if it does not exist.
Screenshots (if appropriate)
Additional Context
This closes issue #2083
Fast Track PR Acceptance Checklist:
Need Help?
Come chat with us on our discord channel