pt-online-schema-change will not run on tables with BEFORE triggers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
In Progress
|
Medium
|
Carlos Salguero |
Bug Description
pt-online-
Steps to reproduce:
- Create a simple table with a BEFORE trigger:
use test;
create table foo (id int not null auto_increment primary key, val int);
create trigger tr_foo before insert on foo for each row set new.val = 7;
- Now try running pt-online-
pt-online-
And it fails with this message:
The table `test`.`foo` has triggers. This tool needs to create its own triggers, so the table cannot already have triggers.
Suggested fix:
Replace these 3 lines of code:
# There cannot be any triggers on the original table.
my $sql = 'SHOW TRIGGERS FROM ' . $q->quote(
. ' LIKE ' . $q->literal_
With these 3 lines:
# There cannot be any AFTER triggers on the original table.
my $sql = "SHOW TRIGGERS FROM " . $q->quote(
. " WHERE `Table` = '$orig_tbl->{tbl}' AND `Timing` = 'AFTER'";
I've tested this change on MySQL 5.1, 5.5, and 5.6. I have not tested it on 5.0 yet, but as far as I know SHOW TRIGGERS with WHERE is supported back to 5.0.10.
tags: | added: mysql-5.6 |
Changed in percona-toolkit: | |
status: | Confirmed → In Progress |
importance: | Undecided → Medium |
milestone: | none → 2.2.18 |
assignee: | nobody → Frank Cizmich (frank-cizmich) |
Changed in percona-toolkit: | |
milestone: | 2.2.18 → 2.2.19 |
Changed in percona-toolkit: | |
milestone: | 2.2.19 → 2.2.20 |
Changed in percona-toolkit: | |
assignee: | Frank Cizmich (frank-cizmich) → Carlos Salguero (carlos-salguero) |
Changed in percona-toolkit: | |
milestone: | 2.2.20 → 2.2.21 |
Changed in percona-toolkit: | |
milestone: | 2.2.21 → 3.0.2 |
Changed in percona-toolkit: | |
milestone: | 3.0.2 → none |
Hi,
i started a post in the forum yesterday.
Can you give me more news on this assertion?
pt-online- schema- change uses AFTER triggers to keep the data
best regards