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

Update Ant Tasks to use DatabaseFactory rather than create connection itself #1427

Merged

Conversation

mattbertolini
Copy link
Contributor

@mattbertolini mattbertolini commented Sep 23, 2020


name: Pull Request
about: Create a report to help us improve
title: ''
labels: Status:Discovery
assignees: ''


Environment

Liquibase Version: 3.10.x

Liquibase Integration & Version: Ant

Liquibase Extension(s) & Version: N/A

Database Vendor & Version: N/A

Operating System Type & Version: All

Pull Request Type

  • Bug fix (non-breaking change which fixes an issue.)
  • Enhancement/New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Fixes #1378

Description

I have been investigating #1378 and I believe the issue is the Ant tasks are creating the DatabaseConnection themselves and not respecting the logic found in the DatabaseFactory. This PR updates the Ant tasks to leverage the DatabaseFactory to keep consistent with the rest of the integration types (CLI, Maven, etc).

This involved a small refactoring of the DatabaseFactory so it can accept a pre-configured Properties object as that is needed by Ant. The refactoring is entirely backward compatible and was accomplished using simple method and argument extraction. I added several unit tests before the refactor to make sure compatibility was maintained.

This would be good to backport into 3.10.x but I will leave that up to you.

Steps To Reproduce

The bug is a bit difficult to reproduce. See #1378 for details. I believe there is a small race condition that can cause the exception where a pro connection is used in the tasks when its not desired. The changes in this PR should remove the race condition.

Actual Behavior

A clear and concise description of what happens in the software before this pull request.

  • Include console output if relevant
  • Include log files if available.

Expected/Desired Behavior

A clear and concise description of what happens in the software after this pull request.

Screenshots (if appropriate)

If applicable, add screenshots to help explain your problem.

Additional Context

Add any other context about the problem here.

Fast Track PR Acceptance Checklist:

Need Help?

Come chat with us on our discord channel

@codecov
Copy link

codecov bot commented Sep 23, 2020

Codecov Report

Merging #1427 into master will increase coverage by 0.73%.
The diff coverage is 81.94%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1427      +/-   ##
============================================
+ Coverage     47.51%   48.25%   +0.73%     
+ Complexity     8053     7915     -138     
============================================
  Files           801      793       -8     
  Lines         39753    38454    -1299     
  Branches       7275     6894     -381     
============================================
- Hits          18890    18557     -333     
+ Misses        18353    17445     -908     
+ Partials       2510     2452      -58     
Impacted Files Coverage Δ Complexity Δ
...a/liquibase/integration/ant/BaseLiquibaseTask.java 70.78% <57.14%> (-1.31%) 22.00 <4.00> (+1.00) ⬇️
...a/liquibase/integration/ant/type/DatabaseType.java 59.84% <80.00%> (+6.98%) 43.00 <0.00> (+2.00)
.../main/java/liquibase/database/DatabaseFactory.java 84.78% <85.71%> (+41.47%) 44.00 <14.00> (+20.00)
...base/integration/ant/AbstractDatabaseDiffTask.java 70.96% <100.00%> (ø) 7.00 <0.00> (ø)
...s/javacc/liquibase/util/grammar/TokenMgrError.java
...uibase/util/grammar/SimpleSqlGrammarConstants.java
.../javacc/liquibase/util/grammar/ParseException.java
...ase/util/grammar/SimpleSqlGrammarTokenManager.java
...avacc/liquibase/util/grammar/SimpleCharStream.java
...s/plugin/org/liquibase/maven/plugins/HelpMojo.java
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 552237d...532b213. Read the comment docs.

@molivasdat
Copy link
Contributor

Thanks @mattbertolini We take a look at this and get it into a release soon.
Thanks for all the work on #1378

@molivasdat molivasdat added DBAll ImpactHigh IntegrationAnt RiskLow Trivial changes in spelling, documentation changes, focused bug fixes, etc. TypeBug labels Oct 2, 2020
@nvoxland nvoxland merged commit 7a94066 into liquibase:master Nov 3, 2020
@nvoxland
Copy link
Contributor

nvoxland commented Nov 3, 2020

Cherry picked the changes into 4.2.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DBAll ImpactHigh IntegrationAnt RiskLow Trivial changes in spelling, documentation changes, focused bug fixes, etc. TypeBug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

executeCommand changeSet fails on >=3.10.1
4 participants