Merged fix-1050737-1075638-ptc-division-by-zero-nibble_time

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-12-05 20:32:25 -03:00
2 changed files with 40 additions and 5 deletions

View File

@@ -9477,14 +9477,15 @@ sub main {
# Update the rate of rows per second for the entire server.
# This is used for the initial chunk size of the next table.
$total_rows += $cnt;
$total_time += $tbl->{nibble_time};
$total_rate = int($total_rows / $total_time);
$total_time += ($tbl->{nibble_time} || 0);
$total_rate = $total_time ? int($total_rows / $total_time) : 0;
PTDEBUG && _d('Total avg rate:', $total_rate);
# Adjust chunk size. This affects the next chunk.
if ( $o->get('chunk-time') ) {
$tbl->{chunk_size}
= $tbl->{rate}->update($cnt, $tbl->{nibble_time});
$tbl->{chunk_size} = $tbl->{nibble_time}
? $tbl->{rate}->update($cnt, $tbl->{nibble_time})
: $o->get('chunk-time');
if ( $tbl->{chunk_size} < 1 ) {
# This shouldn't happen. WeightedAvgRate::update() may return
@@ -9500,7 +9501,7 @@ sub main {
. "or increase --chunk-time. The last chunk, number "
. "$chunk of table $tbl->{db}.$tbl->{tbl}, "
. "selected $cnt rows and took "
. sprintf('%.3f', $tbl->{nibble_time})
. sprintf('%.3f', $tbl->{nibble_time} || 0)
. " seconds to execute.\n");
}
}