Verified locally. After that patch, we can able to add before triggers in table.
nil@Dell-XPS:~/sandboxes/msb_5_5_36$ pt-online-schema-change --alter "ADD COLUMN c1 INT" D=test,t=foo --user=msandbox --password=msandbox --socket=/tmp/mysql_sandbox5536.sock --execute
No slaves found. See --recursion-method if host nilnandan-Dell-XPS has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
The table `test`.`foo` has triggers. This tool needs to create its own triggers, so the table cannot already have triggers.
nil@Dell-XPS:~/sandboxes/msb_5_5_36$
nil@Dell-XPS:~/sandboxes/msb_5_5_36$ vim /usr/bin/pt-online-schema-changenil@Dell-XPS:~/sandboxes/msb_5_5_36$ sudo vim /usr/bin/pt-online-schema-change
------ADD PATCH FOR BEFORE TRIGGER
nil@Dell-XPS:~/sandboxes/msb_5_5_36$ pt-online-schema-change --alter "ADD COLUMN c1 INT" D=test,t=foo --user=msandbox --password=msandbox --socket=/tmp/mysql_sandbox5536.sock --execute
No slaves found. See --recursion-method if host nilnandan-Dell-XPS has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_foreign_keys, 10, 1
Altering `test`.`foo`...
Creating new table...
Created new table test._foo_new OK.
Altering new table...
Altered `test`.`_foo_new` OK.
2014-05-07T10:13:07 Creating triggers...
2014-05-07T10:13:07 Created triggers OK.
2014-05-07T10:13:07 Copying approximately 1 rows...
2014-05-07T10:13:07 Copied rows OK.
2014-05-07T10:13:07 Swapping tables...
2014-05-07T10:13:07 Swapped original and new tables OK.
2014-05-07T10:13:07 Dropping old table...
2014-05-07T10:13:07 Dropped old table `test`.`_foo_old` OK.
2014-05-07T10:13:07 Dropping triggers...
2014-05-07T10:13:07 Dropped triggers OK.
Successfully altered `test`.`foo`.
nil@Dell-XPS:~/sandboxes/msb_5_5_36$
Verified locally. After that patch, we can able to add before triggers in table.
nil@Dell- XPS:~/sandboxes /msb_5_ 5_36$ pt-online- schema- change --alter "ADD COLUMN c1 INT" D=test,t=foo --user=msandbox --password=msandbox --socket= /tmp/mysql_ sandbox5536. sock --execute XPS:~/sandboxes /msb_5_ 5_36$
No slaves found. See --recursion-method if host nilnandan-Dell-XPS has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
The table `test`.`foo` has triggers. This tool needs to create its own triggers, so the table cannot already have triggers.
nil@Dell-
nil@Dell- XPS:~/sandboxes /msb_5_ 5_36$ vim /usr/bin/ pt-online- schema- changenil@ Dell-XPS: ~/sandboxes/ msb_5_5_ 36$ sudo vim /usr/bin/ pt-online- schema- change
------ADD PATCH FOR BEFORE TRIGGER
nil@Dell- XPS:~/sandboxes /msb_5_ 5_36$ pt-online- schema- change --alter "ADD COLUMN c1 INT" D=test,t=foo --user=msandbox --password=msandbox --socket= /tmp/mysql_ sandbox5536. sock --execute foreign_ keys, 10, 1 XPS:~/sandboxes /msb_5_ 5_36$
No slaves found. See --recursion-method if host nilnandan-Dell-XPS has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_
Altering `test`.`foo`...
Creating new table...
Created new table test._foo_new OK.
Altering new table...
Altered `test`.`_foo_new` OK.
2014-05-07T10:13:07 Creating triggers...
2014-05-07T10:13:07 Created triggers OK.
2014-05-07T10:13:07 Copying approximately 1 rows...
2014-05-07T10:13:07 Copied rows OK.
2014-05-07T10:13:07 Swapping tables...
2014-05-07T10:13:07 Swapped original and new tables OK.
2014-05-07T10:13:07 Dropping old table...
2014-05-07T10:13:07 Dropped old table `test`.`_foo_old` OK.
2014-05-07T10:13:07 Dropping triggers...
2014-05-07T10:13:07 Dropped triggers OK.
Successfully altered `test`.`foo`.
nil@Dell-