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
Added MSSQLDatabase specific error evaluation when creating lock table #1817
Conversation
Hi @stalbrecht We have a new build process. If the build succeeds, you should be able to download your fix. We will evaluate whether we need to change or update the code before merging it in. Here's what happens next:
The PR will be prioritized according to our internal development and testing capacity. We’ll let you know when it’s ready to move to the next step or if any changes are needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix. I made a minor change to the new method name, and made it protected so subclasses can provide their own logic checks on the exception.
➤ Erzsebet Carmean commented: Liquibase Internal QA Notes on Fix Scope However, at 5 concurrent Liquibase updates, at least one will fail due to a violation of the PRIMARY KEY constraint, PK_DATABASECHANGELOGLOCK. [2021-11-08 12:17:13] SEVERE [liquibase.integration] Violation of PRIMARY KEY constraint 'PK_DATABASECHANGELOGLOCK'. |
➤ Erzsebet Carmean commented: UPDATE :: Liquibase Internal QA Notes The concurrency issues with DATABASECHANGELOGLOCK are addressed more broadly in #2198 ( https://github.com/liquibase/liquibase/pull/2198|smart-link ) . PR 2198 addresses the original issue as well as the PK constraint violation noted during testing of this PR. |
Proposed fix for #1816
Dev Handoff Notes (Internal Use)
Links
Testing
Dev Verification
Ran locally
(did not save output at the time)
Test Requirements (Internal Liquibase QA)
The bug is a race condition when multiple Liquibase updates are running at the same time.
The fix allows update operations to continue if the DATABASECHANGELOGLOCK table already exists.
The scripts attached to reproduce this bug are Windows-specific files; batch script (.cmd) and powershell (ps1). If you are not on Windows, please do not take this ticket; duplicating effort to rewrite scripts in bash just isn’t where we want to spend our test time. The powershell script runs 3 concurrent Liquibase operations. I have found 3 concurrent Liquibase operations is sufficient to get into the race condition. However, to increase the number of concurrent Liquibase operations, change the
$list = 1..3
to$list = 1..n
, where n is the new maximum concurrent operations. The powershell script calls a batch script that does the job of setting up and running Liquibase update.When the powershell script runs, you will see three CLI prompts show up.
Logging is enabled in the batch script. The execution will output three log files: lb1555-log.txt, lb1555-log.txt1, lb1555-log.txt2. I’ll attach an example of the log produced when the race condition is encountered. You’ll notice that Liquibase exits/fails in older builds, and does not exit/fail when using the fix build.
To test this fix, you will need:
Manual Tests
Prior to starting the test, ensure your SQL Server database does not have the DATABASECHANGELOGLOCK in the catalog you’re connecting to; do this by running
liquibase drop-all
.Verify Liquibase update does not exit when DATABASECHANGELOGLOCK exists.
.\parallell-foreach.ps1
Automated Tests
┆Issue is synchronized with this Jira Story by Unito