DBD::mysql bug causes pt-upgrade to use wrong precision (M) and scale (D)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Medium
|
Daniel Nichter |
Bug Description
The function that parses the result set to generate table structure used for comparing rows does not return the correct column definition for double/float data types. The definition of double/float column is returned as float|double(SCALE, PRECISION), while it should be float|double(
In the following assignment:
$struct-
= ($type =~ m/(?:float|
: ($type =~ m/(?:decimal)/) ? "($p[$i],$s[$i])"
: ($type =~ m/(?:char|varchar)/ && $p[$i]) ? "($p[$i])"
The line
= ($type =~ m/(?:float|
should be changed to
= ($type =~ m/(?:float|
Related branches
- Daniel Nichter: Approve
-
Diff: 1111 lines (+359/-195)21 files modifiedbin/pt-upgrade (+182/-120)
lib/MockSyncStream.pm (+9/-6)
t/lib/MockSyncStream.t (+2/-2)
t/pt-upgrade/basics.t (+75/-33)
t/pt-upgrade/daemon.t (+3/-3)
t/pt-upgrade/rewrite_non_select.t (+4/-4)
t/pt-upgrade/samples/001/non-selects-rewritten.txt (+3/-3)
t/pt-upgrade/samples/001/non-selects.txt (+1/-1)
t/pt-upgrade/samples/001/one-error-no-clear-warnings.txt (+3/-3)
t/pt-upgrade/samples/001/one-error.txt (+3/-3)
t/pt-upgrade/samples/001/select-everyone-no-stats.txt (+1/-1)
t/pt-upgrade/samples/001/select-everyone-rows.txt (+1/-1)
t/pt-upgrade/samples/001/select-everyone.txt (+1/-1)
t/pt-upgrade/samples/001/select-one-rows.txt (+1/-1)
t/pt-upgrade/samples/001/select-one.txt (+1/-1)
t/pt-upgrade/samples/002/report-01.txt (+2/-2)
t/pt-upgrade/samples/003/double.log (+4/-0)
t/pt-upgrade/samples/003/report001.txt (+42/-0)
t/pt-upgrade/samples/003/tables.sql (+11/-0)
t/pt-upgrade/skip_non_select.t (+4/-4)
t/pt-upgrade/warnings.t (+6/-6)
Changed in percona-toolkit: | |
assignee: | nobody → Daniel Nichter (daniel-nichter) |
importance: | Undecided → Medium |
status: | New → In Progress |
tags: | added: pt-upgrade wrong-sql |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Triaged |
Changed in percona-toolkit: | |
status: | Triaged → In Progress |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
I think this a DBD::mysql bug or oddity because the code works as-is. You're correct, in theory, it should be (p,s) because according to http:// dev.mysql. com/doc/ refman/ 5.1/en/ precision- math-decimal- changes. html p=m=precision and s=d=scale. Yet, on DBD::mysql 4.018 the results for two tests using a double column are correct: (7,2) and (31,23). Yet, on the same version of DBD::mysql, the order is correct for decimal types, (p,s), which again is tested and produces (31,12).