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

Changes with pt-osc are executed multiple times (liquibase 4.19.1) #303

Closed
adangel opened this issue Mar 2, 2023 · 0 comments · Fixed by #304
Closed

Changes with pt-osc are executed multiple times (liquibase 4.19.1) #303

adangel opened this issue Mar 2, 2023 · 0 comments · Fixed by #304
Labels
Milestone

Comments

@adangel
Copy link
Collaborator

adangel commented Mar 2, 2023

With the upgrade of liquibase from 4.19.0 to 4.19.1 all the changesets are executed multiple times when percona toolkit is used.

This shows up in the integration tests:

[INFO] Altering new table...
[INFO] 	(in cleanup) Error altering new table `testdb`.`_person_new`: DBD::mysql::db do failed: Duplicate key name 'emailIdx' [for Statement "ALTER TABLE `testdb`.`_person_new` ADD UNIQUE INDEX emailIdx (email(10))"] at /home/runner/work/liquibase-percona/liquibase-percona/target/percona-toolkit/percona-toolkit-3.5.1/bin/pt-online-schema-change line 9511.
[INFO] 
[INFO] 2023-03-02T12:01:24 Dropping new table...
[INFO] 2023-03-02T12:01:24 Dropped new table OK.
[INFO] `testdb`.`person` was not altered.
[INFO] Error altering new table `testdb`.`_person_new`: DBD::mysql::db do failed: Duplicate key name 'emailIdx' [for Statement "ALTER TABLE `testdb`.`_person_new` ADD UNIQUE INDEX emailIdx (email(10))"] at /home/runner/work/liquibase-percona/liquibase-percona/target/percona-toolkit/percona-toolkit-3.5.1/bin/pt-online-schema-change line 9511.
[INFO] 

This is the second run and the change has already been applied, so it can't be applied once more...

The change in liquibase that introduced this is liquibase/liquibase#3574 - for creating the log of the sql statements, the method generate of the statement is called. And that's when pt-osc is executed...

@adangel adangel added the bug label Mar 2, 2023
@adangel adangel changed the title Changeset with pt-osc are executed multiple times (liquibase 4.19.1) Changes with pt-osc are executed multiple times (liquibase 4.19.1) Mar 2, 2023
@adangel adangel added this to the v4.19.1 milestone Mar 2, 2023
adangel added a commit to adangel/liquibase-percona that referenced this issue Mar 2, 2023
adangel added a commit that referenced this issue Mar 2, 2023
…ement (#304)

* Refactor PTOnlineSchemaChangeStatement to be a ExecutablePreparedStatement

Fixes #303

* Avoid duplicated logging when percona toolkit can't be used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant