Skip to content
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

Remove duplicate databasechangeloglock SQL when running update-sql against a new database #2335

Merged
merged 1 commit into from Jan 24, 2022

Conversation

nvoxland
Copy link
Contributor

@nvoxland nvoxland commented Jan 5, 2022

Description

Fixes #2309

Caused by the "are we locked?" loop we added to catch race conditions in clusters, since in "update sql" mode the table doesn't get created like it normally would.

When looking at the output SQL, I also saw that the lock table got unlocked and re-locked due to the HubService.register() logic thinking it can prompt when it really can't and so unnecessarily unlocking.


Dev Handoff Notes (Internal Use)

Links

Testing

Dev Verification

Ran update-sql against a new h2 database, and made sure the create and lock logic happens only once

Test Requirements (Liquibase Internal QA)

Setup

Make sure DATABASECHANGELOGLOCK table is not present in database.

Manual Tests

Verify update-sql outputs correct number of statements related to DATABASECHANGELOGLOCK table.

  • liquibase update-sql --changelog-file lb2208-changelog.xml
  • there is only one CREATE TABLE DATABASECHANGELOGLOCK statement
  • there is only one INSERT INTO DATABASECHANGELOGLOCK statement
  • there is only one DELETE FROM DATABASECHANGELOGLOCK statement
  • there are only two UPDATE DATABASECHANGELOGLOCK statements (one before changesets and one after)

Execute update with setup label: liquibase update --changelog-file lb2208-changelog --labels setup

Verify update-sql outputs correct number of statements when DATABASECHANGELOGLOCK table already exists.

  • liquibase update-sql --changelog-file lb2208-changelog --labels test
  • there are no CREATE TABLE DATABASECHANGELOGLOCK statements
  • there are no INSERT INTO DATABASECHANGELOGLOCK statements
  • there are no DELETE FROM DATABASECHANGELOGLOCK statements
  • there are only two UPDATE DATABASECHANGELOGLOCK statements (one before changesets and one after)

Automated Tests

No new functional tests required for this fix.

┆Issue is synchronized with this Jira Bug by Unito

… times.

- When running in a headless environment, the lock table gets unlocked because HubService.register() thinks it can prompt when it really can't
@nvoxland nvoxland added this to To Do in Conditioning++ via automation Jan 5, 2022
@nvoxland nvoxland moved this from To Do to Code Review in Conditioning++ Jan 5, 2022
@nvoxland nvoxland linked an issue Jan 6, 2022 that may be closed by this pull request
@suryaaki2 suryaaki2 moved this from Code Review to Ready for Handoff (In JIRA) in Conditioning++ Jan 6, 2022
@nvoxland nvoxland merged commit 462d721 into master Jan 24, 2022
Conditioning++ automation moved this from Ready for Handoff (In JIRA) to Done Jan 24, 2022
@nvoxland nvoxland deleted the fix-changeloglock-duplication-on-updatesql branch January 24, 2022 19:08
@nvoxland nvoxland added this to the v4.8.0 milestone Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
4 participants