pt-online-schema-change doesn't report how many warnings it suppressed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Medium
|
Brian Fraser |
Bug Description
I've been using pt-online-
...
Altered `db`.`_MyTable_new` OK.
Creating triggers...
Created triggers OK.
Copying approximately 39934116 rows...
Copying rows caused a MySQL error 1265: Data truncated for column 'date_cancelled' at row 334
This MySQL error is being ignored and further occurrences of it will not be reported.
Copying `db`.`MyTable`: 0% 02:08:21 remain
...
Given the command used was :
pt-online-
I can't really see why this warning may be happening, yet converting a large table suddenly worries me.
Using the direct ALTER TABLE statement I don't get this.
When using PTDEBUG=1 .... I see there's an INSERT LOW_PRIORITY IGNORE statement and in this particular case there are 6 parameters shown as '?', and the logging shows:
# Retry:2745 14391 Try 1 of 3
# pt_online_
WHERE ((`user_id` > ?) OR (`user_id` = ? AND `t_id` >= ?)) AND ((`user_id` < ?) OR (`user_id` = ? AND `t_id` <= ?)) /*pt-online-
2 upper boundary: 0 0 167958864
but I don't know how to figure out the 6 parameters that need to be passed to the SQL command to test this manually and see
why this may be giving this warning.
Therefore:
(1) Please consider making the debug output show explicitly the parameters that are used in the SQL query, and how they refer to the boundaries that are mentioned, as this may clarify if the truncation is occurring on the inserted data or some conversion used as part of the where clause.
The current definition is: (sorry for obfuscating the column names )
CREATE TABLE `UserBooking` (
`user_id` int(10) unsigned NOT NULL,
`t_id` int(10) unsigned NOT NULL,
`hr_id` int(10) unsigned NOT NULL DEFAULT '0',
`h_id` mediumint(9) NOT NULL DEFAULT '0',
`ci` date DEFAULT NULL,
`co` date DEFAULT NULL,
`p` double NOT NULL DEFAULT '0',
`cc` char(3) DEFAULT NULL,
`status` enum('value1'
`date_cancelled` date DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT '1970-01-01 01:00:01',
`a_id` int(10) unsigned NOT NULL DEFAULT '0',
`rp` tinyint(3) unsigned NOT NULL DEFAULT '1',
`bp` tinyint(3) unsigned NOT NULL DEFAULT '1',
`obi` tinyint(3) unsigned DEFAULT '0',
`v` enum('value1'
PRIMARY KEY (`user_id`,`t_id`),
KEY `hr_id` (`hr_id`),
KEY `created` (`created`),
KEY `transaction_id` (`t_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
(2) Don't do this: This MySQL error is being ignored and further occurrences of it will not be reported.
Please collect a counter of the warnings and since you know the number of inserts it would be good to write at the end of the run:
XXXX inserts completed into the new table: `db`.`MyTable`
XXX warnings found when executing those inserts.
This gives the DBA a better clue as to whether the issue was a one off or not which when modifying multiple GB tables is really an absolute must. Otherwise it seems to be "trust the script and hope for the best", something I'd like to do but only if it tells me all I need to know.
Seen this on:
* MySQL-server-5.5.16
* CentOS 5.6, x86_64
* percona-
I can provide more detailed log files if needed.
Related branches
- Brian Fraser (community): Approve
- Daniel Nichter: Approve
-
Diff: 724 lines (+513/-20)6 files modifiedbin/pt-online-schema-change (+433/-16)
t/pt-online-schema-change/basics.t (+29/-4)
t/pt-online-schema-change/option_sanity.t (+6/-0)
t/pt-online-schema-change/samples/bug_1045317.sql (+10/-0)
t/pt-online-schema-change/samples/stats-dry-run.txt (+16/-0)
t/pt-online-schema-change/samples/stats-execute.txt (+19/-0)
Changed in percona-toolkit: | |
status: | New → Triaged |
importance: | Undecided → Medium |
assignee: | nobody → Brian Fraser (fraserbn) |
tags: | added: ambiguity error-message pt-online-schema-change |
Changed in percona-toolkit: | |
status: | Triaged → In Progress |
summary: |
- pt-online-schema-change doesn't report parameters passed in INSERT - LOW_PRIORITY IGNORE + pt-online-schema-change doesn't report how many warnings it suppressed |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
We can do (1). Imo, it's important to warn about this once in case the user isn't expecting it. We can add a --statistics like pt-query-digest has to print counts of important events/ warnings/ etc.
Brian: to do (1), search for "ignore_code" in the tool and look at the surrounding code, i.e. the retry() call. See pqd for how it collects and prints --statistics (though pt-osc will be a lot simpler, less stats).