Liquibase.percona.options and ability to use pt-online-schema

Are all mysql DML changes using pt-online-schema by default?

ref : GitHub - liquibase/liquibase-percona: Liquibase Percona Extension

i added this to changelog.xml

    </changeSet>
    <changeSet author="root" id="1623122124813-7">
        <addColumn tableName="t1">
            <column name="address" type="varchar(255)"/>
        </addColumn>
    </changeSet>

updated successfully

[2021-06-08 04:08:58] INFO [liquibase.changelog] Columns address(varchar(255)) added to t1
[2021-06-08 04:08:58] INFO [liquibase.changelog] ChangeSet test2.xml::1623122124813-7::root ran successfully in 69ms
[2021-06-08 04:08:58] INFO [liquibase.lockservice] Successfully released change log lock
Liquibase: Update has been successful.

So the supported changeset types can be found here:

If the plugin is installed correctly and you have percona-toolkit installed, you will see output like this:

[2021-06-08 17:51:44] INFO [liquibase.ext] Executing: pt-online-schema-change --recursion-method=none --set-vars wait_timeout=31536000,innodb_lock_wait_timeout=31536000,lock_wait_timeout=31536000 --max-load Threads_running=80 --critical-load Threads_running=200 --alter-foreign-keys-method=auto --alter="ADD COLUMN town VARCHAR(60) NULL" --password=*** --execute h=db,P=3306,u=root,D=demodb,t=example
[2021-06-08 17:51:44] INFO [liquibase.ext] No slaves found.  See --recursion-method if host 0e45c2eb292a has slaves.
[2021-06-08 17:51:44] INFO [liquibase.ext] Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
[2021-06-08 17:51:45] INFO [liquibase.ext] 
[2021-06-08 17:51:45] INFO [liquibase.ext] # A software update is available:
[2021-06-08 17:51:45] INFO [liquibase.ext] Operation, tries, wait:
[2021-06-08 17:51:45] INFO [liquibase.ext]   analyze_table, 10, 1
[2021-06-08 17:51:45] INFO [liquibase.ext]   copy_rows, 10, 0.25
[2021-06-08 17:51:45] INFO [liquibase.ext]   create_triggers, 10, 1
[2021-06-08 17:51:45] INFO [liquibase.ext]   drop_triggers, 10, 1
[2021-06-08 17:51:45] INFO [liquibase.ext]   swap_tables, 10, 1
[2021-06-08 17:51:45] INFO [liquibase.ext]   update_foreign_keys, 10, 1
[2021-06-08 17:51:45] INFO [liquibase.ext] No foreign keys reference `demodb`.`example`; ignoring --alter-foreign-keys-method.
[2021-06-08 17:51:45] INFO [liquibase.ext] Altering `demodb`.`example`...
[2021-06-08 17:51:45] INFO [liquibase.ext] Creating new table...
[2021-06-08 17:51:45] INFO [liquibase.ext] Created new table demodb._example_new OK.
[2021-06-08 17:51:45] INFO [liquibase.ext] Altering new table...
[2021-06-08 17:51:45] INFO [liquibase.ext] Altered `demodb`.`_example_new` OK.
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Creating triggers...
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Created triggers OK.
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Copying approximately 1 rows...
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Copied rows OK.
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Analyzing new table...
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Swapping tables...
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Swapped original and new tables OK.
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Dropping old table...
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Dropped old table `demodb`.`_example_old` OK.
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Dropping triggers...
[2021-06-08 17:51:45] INFO [liquibase.ext] 2021-06-08T17:51:45 Dropped triggers OK.
[2021-06-08 17:51:45] INFO [liquibase.ext] Successfully altered `demodb`.`example`.
[2021-06-08 17:51:45] INFO [liquibase.ext] 
[2021-06-08 17:51:45] INFO [liquibase.changelog] Columns town(VARCHAR(60 BYTE)) added to example
[2021-06-08 17:51:45] INFO [liquibase.changelog] ChangeSet schema/150.xml::150-1::user ran successfully in 1284ms
[2021-06-08 17:51:45] INFO [liquibase.lockservice] Successfully released change log lock
Liquibase: Update has been successful.

Check out my Dockerfile where I set this up at:

1 Like

@erinlkolp can you share the command you used to make the change using pt-osc in the above example ?

Sure thing, it was just “liquibase update” – as long as the tag is supported by Percona Toolkit, then it will default to that. Are you on a Mac or a Linux machine by chance? And have you used Docker before? It might make this really easy for you to test locally.

You’re right i was able to test it locally by simply copying liquibase-percona-x.x.x.jar and percona toolkit.

had issues creating docker image , due to issues installing perl libdbi-perl libdbd-mysql-perl libterm-readkey-perl libio-socket-ssl-perl, i will give it another try

Also the examples suggest using only xml and yaml for pt-osc , how about sql files ?

Also the examples suggest using only xml and yaml for pt-osc , how about sql files ?

FYI - the new liquibase-percona 4.19.1 now supports formatted SQL changelogs.

@adangel can you pls look into this issue ?
https://forum.liquibase.org/t/liquibase-4-20-doesnt-support-pt-osc-on-sql-files-as-expected/8049