Issues

Select view

Select search mode

 

LP #1036311: Option --where is missing from pt-online-schema-change

Not a Bug

Description

**Reported in Launchpad by fursten last update 28-10-2013 22:48:17

When massaging a table I often want to restrict the content at the same time as I change the schema. For that a --where option on pt-online-schema-change would come in handy.

Since NibbleIterator already supports --where I think the only needed change would be to add the documentation (since the allowed options are parsed from the documentation). It works for me at least.

Environment

None

Smart Checklist

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 24, 2018 at 6:51 PM
Updated February 4, 2018 at 12:38 AM
Resolved January 24, 2018 at 6:52 PM

Activity

lpjirasyncJanuary 24, 2018 at 6:52 PM

**Comment from Launchpad by: Nathan Johnson on: 28-10-2013 22:48:16

I actually took a stab at #3. https://code.launchpad.net/~nathanejohnson/percona-toolkit/percona-toolkit

lpjirasyncJanuary 24, 2018 at 6:52 PM

**Comment from Launchpad by: Nathan Johnson on: 28-10-2013 17:56:50

I have added a potential solution to the issue with the triggers not respecting the where clause. I've attached the code to the blueprint that was created above.

The way I see it, there are three ways to deal with it:

1) don't deal with it, warn the user of the potential issues.

2) allow the user to specify a conditional that will be evaluated to determine whether changed rows are reflected in the temporary table. This would require the user to reference column names by the NEW and OLD aliases, as with all mysql triggers.

3) parse the where clause and try to determine which columns are being referenced, automatically / intelligently try to determine appropriate conditions to check in the triggers.

I have linked an implementation of #2. #3 would be kind of neat, but it would be difficult to implement correctly. #1 is obviously the easiest.

lpjirasyncJanuary 24, 2018 at 6:52 PM

**Comment from Launchpad by: Daniel Nichter on: 01-03-2013 01:30:50

Since this isn't a bug, I've created https://blueprints.launchpad.net/percona-toolkit/+spec/pt-osc-where instead.

lpjirasyncJanuary 24, 2018 at 6:52 PM

**Comment from Launchpad by: Daniel Nichter on: 16-08-2012 15:53:02

I can't recall off the top of my head, but I think there's a reason why we didn't include --where in the tool. It might be related to the triggers which won't respect --where. I'll leave this bug open while I think about this more.