divison by zero errors on default Gentoo mysql
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Medium
|
Brian Fraser |
Bug Description
On a new gentoo box:
$ sudo emerge --sync
$ sudo emerge portage
$ sudo emerge -Du world
$ sudo emerge dev-perl/DBD-mysql
$ sudo emerge bzr
$ bzr branch lp:percona-toolkit
$ cd percona-toolkit/
$ PERCONA_
t/pt-table-
This diff fixes it, although I haven't dug any further than that:
=== modified file 'bin/pt-
--- bin/pt-
+++ bin/pt-
@@ -8929,7 +8929,7 @@
# Update the rate of rows per second for the entire server.
# This is used for the initial chunk size of the next table.
- $total_time += $tbl->{
+ $total_time += $tbl->{nibble_time} || 1;
There's also a similar bug in pt-osc and this:
t/pt-archiver/
Which is $stat_total:
foreach my $stat (
reverse sort { $a->{time} <=> $b->{time} } values %summary )
{
my $pct = $stat->{time} / $stat_total * 100;
$total2 += $stat->{time};
}
---
I've actually investigated a bit further. It may come down to this:
Ubuntu 12.04:
$ perl -MTime::HiRes=time -E '$t = time(); sleep 0.900; $t2 = time(); printf "%.6f\n%.6f\n", $t, $t2; printf "%.6f\n", ($t2 - $t)'
1347624407.872023
1347624407.872031
0.000008
Gentoo:
$ perl -MTime::HiRes=time -E '$t = time(); sleep 0.900; $t2 = time(); printf "%.6f\n%.6f\n", $t, $t2; printf "%.6f\n", ($t2 - $t)'
1347624428.420000
1347624428.420000
0.000000
Maybe Gentoo doesn't have a gettimeofday()? Or has it but with less precision than the spec describes? I don't know how to detect this from Perl, but I figure that defaulting to 0.009 should do the trick -- 1 second would throw the statistics out of the window, and looks like at least two microseconds are guaranteed.
Related branches
- Daniel Nichter: Approve
-
Diff: 77 lines (+40/-5)2 files modifiedbin/pt-table-checksum (+6/-5)
t/pt-table-checksum/bugs.t (+34/-0)
tags: | added: gentoo pt-table-checksum |
description: | updated |
summary: |
- pt-table-checksum fails on default Gentoo mysql + divison by zero errors on default Gentoo mysql |
description: | updated |
tags: | added: pt-archiver pt-online-schema-change |
Changed in percona-toolkit: | |
status: | Triaged → Fix Committed |
assignee: | nobody → Brian Fraser (fraserbn) |
Fixed for pt-table-checksum in 2.1.8