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

Breaks out of LockService.init loop after validations are completed #3576

Conversation

filipelautert
Copy link
Collaborator

@filipelautert filipelautert commented Dec 14, 2022

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

We have a loop trying to generate table that runs 10 times even if it already created the required table. Breaks out of loop when it's done.

For a simple google bigquery execution it may have a 50% performance increase.

Things to be aware of

Things to worry about

Additional Context

Fixes #3545

@github-actions
Copy link

github-actions bot commented Dec 14, 2022

Unit Test Results

  5 239 files  ±0    5 239 suites  ±0   35m 26s ⏱️ - 1m 22s
  4 823 tests ±0    4 603 ✔️ ±0     220 💤 ±0  0 ±0 
61 867 runs  ±0  55 851 ✔️ ±0  6 016 💤 ±0  0 ±0 

Results for commit 9c52a94. ± Comparison against base commit 4d06b43.

♻️ This comment has been updated with latest results.

@filipelautert filipelautert changed the title Breaks out of the loop if all is done without any exceptions. Breaks out of LockService.init loop after validations are completed Dec 14, 2022
Copy link
Contributor

@XDelphiGrl XDelphiGrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR removes unnecessary looping when initializing the DATABASECHANGELOGLOCK table. Prior to this fix, the code checked for the existence of the DATABASECHANGELOGLOCK table 10 times, even after the result evaluated to true. With this fix, the loop exits as soon as the result is true (instead of continuing a potential nine more times through the loop).

  • This improves performance for some database platforms.
  • A side-effect is cleaner FINE level logging during DATABASECHANGELOGLOCK initialization.
  • Functional and test harness executions passing.
  • No additional testing required.

APPROVED

…ized-loop-doesnt-break-out-soon-as-it-should
@filipelautert filipelautert added this to the 1NEXT milestone Jan 2, 2023
@filipelautert filipelautert merged commit 320978c into master Jan 2, 2023
@filipelautert filipelautert deleted the 3545-standardlockservices-check-if-initialized-loop-doesnt-break-out-soon-as-it-should branch January 2, 2023 20:00
benkard added a commit to benkard/mulkcms2 that referenced this pull request Jan 21, 2023
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [org.liquibase.ext:liquibase-hibernate5](https://github.com/liquibase/liquibase-hibernate/wiki) ([source](https://github.com/liquibase/liquibase-hibernate)) | build | minor | `4.18.0` -> `4.19.0` |
| [org.liquibase:liquibase-maven-plugin](http://www.liquibase.org/liquibase-maven-plugin) ([source](https://github.com/liquibase/liquibase)) | build | minor | `4.18.0` -> `4.19.0` |
| [io.quarkus:quarkus-maven-plugin](https://github.com/quarkusio/quarkus) | build | minor | `2.15.3.Final` -> `2.16.0.Final` |

---

### Release Notes

<details>
<summary>liquibase/liquibase-hibernate</summary>

### [`v4.19.0`](https://github.com/liquibase/liquibase-hibernate/releases/tag/v4.19.0)

[Compare Source](liquibase/liquibase-hibernate@v4.18.0...v4.19.0)

Support for Liquibase 4.19.0.

#### What's Changed

-   Support Hibernate ORM 6.1 with Jakarta EE 10 by [@&#8203;papegaaij](https://github.com/papegaaij) in liquibase/liquibase-hibernate#434
-   Bump hibernate.version from 6.1.5.Final to 6.1.6.Final by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase-hibernate#447
-   Bump spring.version from 6.0.2 to 6.0.3 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase-hibernate#448

#### New Contributors

-   [@&#8203;papegaaij](https://github.com/papegaaij) made their first contribution in liquibase/liquibase-hibernate#434

**Full Changelog**: liquibase/liquibase-hibernate@v4.18.0...v4.19.0

</details>

<details>
<summary>liquibase/liquibase</summary>

### [`v4.19.0`](https://github.com/liquibase/liquibase/releases/tag/v4.19.0)

[Compare Source](liquibase/liquibase@v4.18.0...v4.19.0)

##### Liquibase v4.19.0 is a patch release with an XSD upgrade.

#### Enhancements

-   Simplify assert calls and replaced with simpler and equivalent calls. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3497
-   Delete unused import statement.  by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3522
-   Added call to modifyChangeSet during execute method to allow the changeSet to be correctly set on the executor DAT-12388 by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3511
-   Remove unnecessary local variables that add nothing to the comprehensibility of a method. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3373
-   Allow loading gzipped data files by [@&#8203;mike-seger](https://github.com/mike-seger) in liquibase/liquibase#3379
-   Use try-with-resources Statement when is possible. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3374
-   Define and reuse constants. Use an empty array styles to convert a collection to an array. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3500
-   Add support for block comment rollback commands on SQL changesets by [@&#8203;krishnaenugandula](https://github.com/krishnaenugandula) in liquibase/liquibase#1399
-   Allow primary key on addColumn for H2 by [@&#8203;nick318](https://github.com/nick318) in liquibase/liquibase#3372
-   Additional (optional) tableType attribute on the CreateTableChange by [@&#8203;MartinRied](https://github.com/MartinRied) in liquibase/liquibase#3108
-   Include "path" in databasechangelog's description column for all change types with "path" attributes by [@&#8203;MichaelKern-IVV](https://github.com/MichaelKern-IVV) in liquibase/liquibase#3244
-   [#&#8203;1466](liquibase/liquibase#1466): Add ignore:true changeset attribute to Formatted SQL changeLogs by [@&#8203;skrivenko](https://github.com/skrivenko) in liquibase/liquibase#3377
-   [#&#8203;1290](liquibase/liquibase#1290): Forbid empty changeSet id and author by [@&#8203;skrivenko](https://github.com/skrivenko) in liquibase/liquibase#3397
-   Allow to drop and create a view for a Postgres database if replacing the view would fail by [@&#8203;rozenshteyn](https://github.com/rozenshteyn) in liquibase/liquibase#3399
-   Rename DatabaseObjectComparator class to be DatabaseObjectCollectionComparator for clarity DAT-10112 by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3544
-   Do not lower case the ProvidedValue description if the string is capitalized, i.e. it starts with 2 upper-case characters DAT-12614 by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3589
-   Use 'Integer.compare' instead by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3528
-   Simplify 'Map' operations. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3527
-   Remove unnecessary semicolon. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3571
-   Missing Override annotations. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3558
-   Prevents redundant loop iterations. Early loop exit in 'if' condition. by [@&#8203;arturobernalg](https://github.com/arturobernalg) in liquibase/liquibase#3547
-   DAT 6635 - Implement TagCommand by [@&#8203;filipelautert](https://github.com/filipelautert) in liquibase/liquibase#3570
-   DAT-12576 update release workflow to attach artifact by run_id by [@&#8203;ap-liquibase](https://github.com/ap-liquibase) in liquibase/liquibase#3629
-   DAT-12365 update install4j script to version 10.x by [@&#8203;jnewton03](https://github.com/jnewton03) in liquibase/liquibase#3641
-   Upgrades installer JDK version for next release. by [@&#8203;filipelautert](https://github.com/filipelautert) in liquibase/liquibase#3440
-   remove licenses that were moved to individual extensions (DAT-12784) by [@&#8203;StevenMassaro](https://github.com/StevenMassaro) in liquibase/liquibase#3646
-   DAT-12597 include commercial sources and javadoc in reversion by [@&#8203;ap-liquibase](https://github.com/ap-liquibase) in liquibase/liquibase#3671

#### Security, Driver, and other updates

-   Bump mariadb-java-client from 3.0.8 to 3.1.0 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3471
-   Bump testcontainers-bom from 1.17.5 to 1.17.6 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3477
-   Bump snowflake-jdbc from 3.13.22 to 3.13.25 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3475
-   Bump slf4j-jdk14 from 2.0.3 to 2.0.4 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3485
-   Bump maven-install-plugin from 3.0.1 to 3.1.0 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3484
-   Bump castlabs/get-package-version-id-action from 2.0 to 2.1 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3490
-   Bump sqlite-jdbc from 3.39.4.0 to 3.40.0.0 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3510
-   Bump jaybird from 4.0.6.java8 to 4.0.8.java8 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3509
-   Bump mockito-inline from 4.8.1 to 4.10.0 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3580
-   Bump targetMavenVersion from 3.8.5 to 3.8.6 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3593
-   Bump junit-jupiter-params from 5.8.1 to 5.9.1 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3592
-   Bump jaybird from 4.0.6.java8 to 4.0.8.java8 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3602
-   Bump slf4j-jdk14 from 2.0.4 to 2.0.6 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3566
-   Bump snowflake-jdbc from 3.13.25 to 3.13.26 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3579
-   Bump robinraju/release-downloader from 1.6 to 1.7 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3603
-   Bump ojdbc8 from 21.7.0.0 to 21.8.0.0 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3551
-   Bump up the max number of code points for JSON/YAML parser DAT-12657 by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3552
-   Bump actions/cache from 3.0.11 to 3.2.3 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3654
-   update changelog version - 4.19 by [@&#8203;suryaaki2](https://github.com/suryaaki2) in liquibase/liquibase#3676
-   Update changelog xsd 4.19 by [@&#8203;suryaaki2](https://github.com/suryaaki2) in liquibase/liquibase#3678
-   Bump targetMavenVersion from 3.8.5 to 3.8.7 by [@&#8203;dependabot](https://github.com/dependabot) in liquibase/liquibase#3634
-   Update release-published.yml by [@&#8203;jnewton03](https://github.com/jnewton03) in liquibase/liquibase#3540
-   DAT-12783 Adding extension license information by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3614

#### Fixes

-   fix overwriteOutputFile parameter for GenerateChangelog (DAT-12036) by [@&#8203;StevenMassaro](https://github.com/StevenMassaro) in liquibase/liquibase#3543
-   Avoid ClassCastException when loading LogService from Scope by [@&#8203;mattbertolini](https://github.com/mattbertolini) in liquibase/liquibase#3518
-   Adds exclusions for mariadb newly added waffle dependency. by [@&#8203;filipelautert](https://github.com/filipelautert) in liquibase/liquibase#3559
-   Correctly handle indexes with descending columns in snapshot DAT-11447 by [@&#8203;wwillard7800](https://github.com/wwillard7800) in liquibase/liquibase#3535
-   Fix getting default schema issue for firebird by [@&#8203;MalloD12](https://github.com/MalloD12) in liquibase/liquibase#3390
-   Fix generatedSQL logic to allow setting up a function as a default value for MySQL version 8 by [@&#8203;MalloD12](https://github.com/MalloD12) in liquibase/liquibase#3362
-   DAT-11579: when generating changelogs for MySQL, ignore table column order for PKs by [@&#8203;StevenMassaro](https://github.com/StevenMassaro) in liquibase/liquibase#3486
-   Included SQL to return unique constraints for Sybase by [@&#8203;crenan](https://github.com/crenan) in liquibase/liquibase#3517
-   Add varbinary and binary support for DB2 - fixes [#&#8203;3408](liquibase/liquibase#3408)  by [@&#8203;mihaelaDev](https://github.com/mihaelaDev) in liquibase/liquibase#3428
-   Added support for COMPUTED values inside CSV files for loadData change by [@&#8203;zbynekvavros](https://github.com/zbynekvavros) in liquibase/liquibase#944
-   Prevent Executors collision due to hash used as a Map's key part by [@&#8203;Dasiu](https://github.com/Dasiu) in liquibase/liquibase#3533
-   Breaks out of LockService.init loop after validations are completed by [@&#8203;filipelautert](https://github.com/filipelautert) in liquibase/liquibase#3576
-   implement SingletonObject to solve [#&#8203;2349](liquibase/liquibase#2349) by [@&#8203;yairogen](https://github.com/yairogen) in liquibase/liquibase#3624
-   Postgresql - Fallback to default schema name in SequenceSnapshotGenerator when this is null by [@&#8203;djochim](https://github.com/djochim) in liquibase/liquibase#3637

##### OWASP Dependency Check: Reported Vulnerabilities

-   snakeyaml.jar - This is a ["critical" vulnerability reported against the snakeyaml library](https://ossindex.sonatype.org/vulnerability/CVE-2022-1471). We are currently on the newest version of snakeyaml and there is no fix for the issue as of yet.

#### New Contributors

-   [@&#8203;mike-seger](https://github.com/mike-seger) made their first contribution in liquibase/liquibase#3379
-   [@&#8203;crenan](https://github.com/crenan) made their first contribution in liquibase/liquibase#3517
-   [@&#8203;mihaelaDev](https://github.com/mihaelaDev) made their first contribution in liquibase/liquibase#3428
-   [@&#8203;krishnaenugandula](https://github.com/krishnaenugandula) made their first contribution in liquibase/liquibase#1399
-   [@&#8203;skrivenko](https://github.com/skrivenko) made their first contribution in liquibase/liquibase#3397
-   [@&#8203;zbynekvavros](https://github.com/zbynekvavros) made their first contribution in liquibase/liquibase#944
-   [@&#8203;Dasiu](https://github.com/Dasiu) made their first contribution in liquibase/liquibase#3533
-   [@&#8203;yairogen](https://github.com/yairogen) made their first contribution in liquibase/liquibase#3624
-   [@&#8203;djochim](https://github.com/djochim) made their first contribution in liquibase/liquibase#3637

**Full Changelog**: liquibase/liquibase@v4.18.0...v4.19.0

##### Get Certified

Learn all the Liquibase fundamentals from free online courses by Liquibase experts and see how to apply them in the real world at https://learn.liquibase.com/.

##### Read the Documentation

Please check out and contribute to the continually improving docs, now at https://docs.liquibase.com/.

##### Meet the Community

Our community has built a lot. From extensions to integrations, you’ve helped make Liquibase the amazing open source project that it is today. Keep contributing to making it stronger:

[Contribute code](https://www.liquibase.org/development/contribute.html)
[Make doc updates](https://github.com/Datical/liquibase-docs)
[Help by asking and answering questions](https://forum.liquibase.org/)
[Set up a chat with the Product team](https://calendly.com/liquibase-outreach/product-feedback)

Thanks to everyone who helps make the Liquibase community strong!

#### File Descriptions

-   **Liquibase CLI** -- Includes open source + commercial functionality
-   **liquibase-x.y.z.tar.gz** -- Archive in tar.gz format
-   **liquibase-x.y.z.zip** -- Archive in zip format
-   **liquibase-windows-x64-installer-x.y.z.exe** -- Installer for Windows
-   **liquibase-macos-installer-x.y.z.dmg** -- Installer for MacOS
-   **Primary Libraries** - For embedding in other software
    -   **liquibase-core-x.y.z.jar** – Base Liquibase library (open source)
    -   **liquibase-commerical-x.y.z.jar** – Additional commercial functionality
-   **liquibase-additional-x.y.z.zip** – Contains additional, less commonly used files
    -   Additional libraries such as liquibase-maven-plugin.jar and liquibase-cdi.jar
    -   Javadocs for all the libraries
    -   Source archives for all the open source libraries
    -   ASC/MD5/SHA1 verification hashes for all files
    **NOTE: liquibase-core-<version>.jar** contains only the open-source license. If you use Liquibase Pro or other commercial add-ons, you must also **install liquibase-commercial-<version>.jar**

</details>

<details>
<summary>quarkusio/quarkus</summary>

### [`v2.16.0.Final`](quarkusio/quarkus@2.15.3.Final...2.16.0.Final)

[Compare Source](quarkusio/quarkus@2.15.3.Final...2.16.0.Final)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

👻 **Immortal**: This MR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

StandardLockService's "check if initialized" loop doesn't break out soon as it should
4 participants